4.19.149-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 174/245 printk: handle blank console arguments passed in.
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 193/245 x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 170/245 e1000: Do not perform reset in reset_task if we are already down
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 143/245 scsi: qedi: Fix termination timeouts in session logout
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit b9b97e6903032ec56e6dcbe137a9819b74a17fea ]
The destroy connection ramrod timed out during session logout. Fix the wait delay for graceful vs abortive termination as per the FW requirements.
--- drivers/scsi/qedi/qedi_iscsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/qedi/qedi_iscsi.c +3 -0
@@ -1065,6 +1065,9 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)break ; } +if (!abrt_conn) + wait_delay += qedi->pf_params.iscsi_pf_params.two_msl_timer; + qedi_ep->state =EP_STATE_DISCONN_START ; ret = qedi_ops->destroy_conn (qedi->cdev, qedi_ep->handle, abrt_conn);if (ret) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 185/245 wlcore: fix runtime pm imbalance in wl1271_tx_work
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 142/245 mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
In reply to Greg Kroah-HartmanFrom: Jaewon Kim <[email protected]>
[ Upstream commit 09ef5283fd96ac424ef0e569626f359bf9ab86c9 ]
On passing requirement to vm_unmapped_area, arch_get_unmapped_area and arch_get_unmapped_area_topdown did not set align_offset. Internally on both unmapped_area and unmapped_area_topdown, if info->align_mask is 0, then info->align_offset was meaningless.
But commit df529cabb7a2 ("mm: mmap: add trace point of vm_unmapped_area") always prints info->align_offset even though it is uninitialized.
Fix this uninitialized value issue by setting it to 0 explicitly.
Before:
vm_unmapped_area: addr=0x755b155000 err=0 total_vm=0x15aaf0 flags=0x1 len=0x109000 lo=0x8000 hi=0x75eed48000 mask=0x0 ofs=0x4022
After:
vm_unmapped_area: addr=0x74a4ca1000 err=0 total_vm=0x168ab1 flags=0x1 len=0x9000 lo=0x8000 hi=0x753d94b000 mask=0x0 ofs=0x0
--- mm/mmap.c | 2 ++ 1 file changed, 2 insertions(+)
mm/mmap.c +2 -0
@@ -2077,6 +2077,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.low_limit = mm->mmap_base; info.high_limit =TASK_SIZE ; info.align_mask =0 ; + info.align_offset =0 ; return vm_unmapped_area(&info); }#endif
@@ -2118,6 +2119,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, info.low_limit =max (PAGE_SIZE , mmap_min_addr); info.high_limit = mm->mmap_base; info.align_mask =0 ; + info.align_offset =0 ; addr =vm_unmapped_area (&info);/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 186/245 wlcore: fix runtime pm imbalance in wlcore_regdomain_config
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 184/245 ASoC: img-i2s-out: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 172/245 drm/nouveau: fix runtime pm imbalance on error
In reply to Greg Kroah-HartmanFrom: 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 · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 146/245 perf stat: Force error in fallback on :k events
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 147/245 bdev: Reduce time holding bd_mutex in sync in blkdev_close()
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 189/245 ceph: fix potential race in ceph_check_caps
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 173/245 drm/nouveau/dispnv50: fix runtime pm imbalance on error
In reply to Greg Kroah-HartmanFrom: 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 · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 181/245 perf util: Fix memory leak of prefix_if_not_in
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 183/245 perf kcore_copy: Fix module map when there are no modules loaded
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 187/245 mtd: rawnand: omap_elm: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 141/245 nvmet-rdma: fix double free of rdma queue
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit 21f9024355e58772ec5d7fc3534aa5e29d72a8b6 ]
In case rdma accept fails at nvmet_rdma_queue_connect(), release work is scheduled. Later on, a new RDMA CM event may arrive since we didn't destroy the cm-id and call nvmet_rdma_queue_connect_fail(), which schedule another release work. This will cause calling nvmet_rdma_free_queue twice. To fix this we implicitly destroy the cm_id with non-zero ret code, which guarantees that new rdma_cm events will not arrive afterwards. Also add a qp pointer to nvmet_rdma_queue structure, so we can use it when the cm_id pointer is NULL or was destroyed.
--- drivers/nvme/target/rdma.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/nvme/target/rdma.c +18 -12
@@ -83,6 +83,7 @@ enum nvmet_rdma_queue_state {struct nvmet_rdma_queue {struct rdma_cm_id *cm_id; +struct ib_qp *qp;struct nvmet_port *port;struct ib_cq *cq;atomic_t sq_wr_avail;
@@ -471,7 +472,7 @@ static int nvmet_rdma_post_recv(struct nvmet_rdma_device *ndev,if (ndev->srq) ret =ib_post_srq_recv (ndev->srq, &cmd->wr,NULL );else - ret =ib_post_recv (cmd->queue->cm_id->qp, &cmd->wr,NULL ); + ret =ib_post_recv (cmd->queue->qp, &cmd->wr,NULL );if (unlikely (ret))pr_err ("post_recv cmd failed\n" );
@@ -510,7 +511,7 @@ static void nvmet_rdma_release_rsp(struct nvmet_rdma_rsp *rsp)atomic_add (1 + rsp->n_rdma, &queue->sq_wr_avail);if (rsp->n_rdma) { -rdma_rw_ctx_destroy (&rsp->rw, queue->cm_id->qp, +rdma_rw_ctx_destroy (&rsp->rw, queue->qp, queue->cm_id->port_num, rsp->req.sg, rsp->req.sg_cnt,nvmet_data_dir (&rsp->req)); }
@@ -594,7 +595,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc)WARN_ON (rsp->n_rdma <=0 );atomic_add (rsp->n_rdma, &queue->sq_wr_avail); -rdma_rw_ctx_destroy (&rsp->rw, queue->cm_id->qp, +rdma_rw_ctx_destroy (&rsp->rw, queue->qp, queue->cm_id->port_num, rsp->req.sg, rsp->req.sg_cnt,nvmet_data_dir (&rsp->req)); rsp->n_rdma =0 ;
@@ -737,7 +738,7 @@ static bool nvmet_rdma_execute_command(struct nvmet_rdma_rsp *rsp) }if (nvmet_rdma_need_data_in (rsp)) { -if (rdma_rw_ctx_post (&rsp->rw, queue->cm_id->qp, +if (rdma_rw_ctx_post (&rsp->rw, queue->qp, queue->cm_id->port_num, &rsp->read_cqe,NULL ))nvmet_req_complete (&rsp->req,NVME_SC_DATA_XFER_ERROR ); }else {
@@ -1020,6 +1021,7 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue)pr_err ("failed to create_qp ret= %d\n" , ret); goto err_destroy_cq; } + queue->qp = queue->cm_id->qp;atomic_set (&queue->sq_wr_avail, qp_attr.cap.max_send_wr);
@@ -1048,11 +1050,10 @@ err_destroy_cq:static void nvmet_rdma_destroy_queue_ib (struct nvmet_rdma_queue *queue) { -struct ib_qp *qp = queue->cm_id->qp; - -ib_drain_qp (qp); -rdma_destroy_id (queue->cm_id); -ib_destroy_qp (qp); +ib_drain_qp (queue->qp); +if (queue->cm_id) +rdma_destroy_id (queue->cm_id); +ib_destroy_qp (queue->qp);ib_free_cq (queue->cq); }
@@ -1286,9 +1287,12 @@ static int nvmet_rdma_queue_connect(struct rdma_cm_id *cm_id, ret =nvmet_rdma_cm_accept (cm_id, queue, &event->param.conn);if (ret) { -schedule_work (&queue->release_work); -/* Destroying rdma_cm id is not needed here */ -return 0 ; +/* +* Don't destroy the cm_id in free path, as we implicitly +* destroy the cm_id here with non-zero ret code. +*/ + queue->cm_id =NULL ; + goto free_queue; }mutex_lock (&nvmet_rdma_queue_mutex);
@@ -1297,6 +1301,8 @@ static int nvmet_rdma_queue_connect(struct rdma_cm_id *cm_id,return 0 ; +free_queue: +nvmet_rdma_free_queue (queue); put_device:kref_put (&ndev->ref, nvmet_rdma_free_dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 168/245 scsi: cxlflash: Fix error return code in cxlflash_probe()
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 156/245 atm: fix a memory leak of vcc->user_back
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 167/245 USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 155/245 dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 165/245 powerpc/traps: Make unrecoverable NMIs die instead of panic
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 159/245 phy: samsung: s5pv210-usb2: Add delay after reset
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 157/245 perf mem2node: Avoid double free related to realloc
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 163/245 tty: serial: samsung: Correct clock selection logic
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 166/245 fuse: dont check refcount after stealing page
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 164/245 ALSA: hda: Fix potential race in unsol event handler
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 160/245 Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
In reply to Greg Kroah-HartmanFrom: 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
Hi!
Quoted 5 lines
This is the start of the stable review cycle for the 4.19.149 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 01 Oct 2020 10:59:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.149-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.
No problems detected by CIP testing:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/195833156
The failures are caused by boards being offline; they are not caused by kernel problems.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman
maintainerPATCH 152/245 staging:r8188eu: avoid skb_clone for amsdu to msdu conversion
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 140/245 mm/vmscan.c: fix data races using kswapd_classzone_idx
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit 5644e1fbbfe15ad06785502bbfe5751223e5841d ]
pgdat->kswapd_classzone_idx could be accessed concurrently in wakeup_kswapd(). Plain writes and reads without any lock protection result in data races. Fix them by adding a pair of READ|WRITE_ONCE() as well as saving a branch (compilers might well optimize the original code in an unintentional way anyway). While at it, also take care of pgdat->kswapd_order and non-kswapd threads in allow_direct_reclaim(). The data races were reported by KCSAN,
BUG: KCSAN: data-race in wakeup_kswapd / wakeup_kswapd
write to 0xffff9f427ffff2dc of 4 bytes by task 7454 on cpu 13:
wakeup_kswapd+0xf1/0x400 wakeup_kswapd at mm/vmscan.c:3967 wake_all_kswapds+0x59/0xc0 wake_all_kswapds at mm/page_alloc.c:4241 __alloc_pages_slowpath+0xdcc/0x1290 __alloc_pages_slowpath at mm/page_alloc.c:4512 __alloc_pages_nodemask+0x3bb/0x450 alloc_pages_vma+0x8a/0x2c0 do_anonymous_page+0x16e/0x6f0 __handle_mm_fault+0xcd5/0xd40 handle_mm_fault+0xfc/0x2f0 do_page_fault+0x263/0x6f9 page_fault+0x34/0x40
1 lock held by mtest01/7454:
#0: ffff9f425afe8808 (&mm->mmap_sem#2){++++}, at:
do_page_fault+0x143/0x6f9 do_user_addr_fault at arch/x86/mm/fault.c:1405 (inlined by) do_page_fault at arch/x86/mm/fault.c:1539 irq event stamp: 6944085 count_memcg_event_mm+0x1a6/0x270 count_memcg_event_mm+0x119/0x270 __do_softirq+0x34c/0x57c irq_exit+0xa2/0xc0
read to 0xffff9f427ffff2dc of 4 bytes by task 7472 on cpu 38:
wakeup_kswapd+0xc8/0x400 wake_all_kswapds+0x59/0xc0 __alloc_pages_slowpath+0xdcc/0x1290 __alloc_pages_nodemask+0x3bb/0x450 alloc_pages_vma+0x8a/0x2c0 do_anonymous_page+0x16e/0x6f0 __handle_mm_fault+0xcd5/0xd40 handle_mm_fault+0xfc/0x2f0 do_page_fault+0x263/0x6f9 page_fault+0x34/0x40
1 lock held by mtest01/7472:
#0: ffff9f425a9ac148 (&mm->mmap_sem#2){++++}, at:
do_page_fault+0x143/0x6f9 irq event stamp: 6793561 count_memcg_event_mm+0x1a6/0x270 count_memcg_event_mm+0x119/0x270 __do_softirq+0x34c/0x57c irq_exit+0xa2/0xc0 BUG: KCSAN: data-race in kswapd / wakeup_kswapd
write to 0xffff90973ffff2dc of 4 bytes by task 820 on cpu 6:
kswapd+0x27c/0x8d0 kthread+0x1e0/0x200 ret_from_fork+0x27/0x50
read to 0xffff90973ffff2dc of 4 bytes by task 6299 on cpu 0:
wakeup_kswapd+0xf3/0x450 wake_all_kswapds+0x59/0xc0 __alloc_pages_slowpath+0xdcc/0x1290 __alloc_pages_nodemask+0x3bb/0x450 alloc_pages_vma+0x8a/0x2c0 do_anonymous_page+0x170/0x700 __handle_mm_fault+0xc9f/0xd00 handle_mm_fault+0xfc/0x2f0 do_page_fault+0x263/0x6f9 page_fault+0x34/0x40
--- mm/vmscan.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-)
mm/vmscan.c +26 -19
@@ -3109,8 +3109,9 @@ static bool allow_direct_reclaim(pg_data_t *pgdat)/* kswapd must be awake if processes are being throttled */ if (!wmark_ok &&waitqueue_active (&pgdat->kswapd_wait)) { - pgdat->kswapd_classzone_idx =min (pgdat->kswapd_classzone_idx, - (enum zone_type )ZONE_NORMAL ); +if (READ_ONCE (pgdat->kswapd_classzone_idx) >ZONE_NORMAL ) +WRITE_ONCE (pgdat->kswapd_classzone_idx,ZONE_NORMAL ); +wake_up_interruptible (&pgdat->kswapd_wait); }
@@ -3626,9 +3627,9 @@ out:static enum zone_type kswapd_classzone_idx (pg_data_t *pgdat,enum zone_type prev_classzone_idx) { -if (pgdat->kswapd_classzone_idx ==MAX_NR_ZONES ) -return prev_classzone_idx; -return pgdat->kswapd_classzone_idx; +enum zone_type curr_idx =READ_ONCE (pgdat->kswapd_classzone_idx); + +return curr_idx ==MAX_NR_ZONES ? prev_classzone_idx : curr_idx; } static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order,
@@ -3672,8 +3673,11 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o* the previous request that slept prematurely. */ if (remaining) { - pgdat->kswapd_classzone_idx =kswapd_classzone_idx (pgdat, classzone_idx); - pgdat->kswapd_order =max (pgdat->kswapd_order, reclaim_order); +WRITE_ONCE (pgdat->kswapd_classzone_idx, +kswapd_classzone_idx (pgdat, classzone_idx)); + +if (READ_ONCE (pgdat->kswapd_order) < reclaim_order) +WRITE_ONCE (pgdat->kswapd_order, reclaim_order); }finish_wait (&pgdat->kswapd_wait, &wait);
@@ -3755,12 +3759,12 @@ static int kswapd(void *p) tsk->flags |=PF_MEMALLOC |PF_SWAPWRITE |PF_KSWAPD ;set_freezable (); - pgdat->kswapd_order =0 ; - pgdat->kswapd_classzone_idx =MAX_NR_ZONES ; +WRITE_ONCE (pgdat->kswapd_order,0 ); +WRITE_ONCE (pgdat->kswapd_classzone_idx,MAX_NR_ZONES );for ( ; ; ) {bool ret; - alloc_order = reclaim_order = pgdat->kswapd_order; + alloc_order = reclaim_order =READ_ONCE (pgdat->kswapd_order); classzone_idx =kswapd_classzone_idx (pgdat, classzone_idx); kswapd_try_sleep:
@@ -3768,10 +3772,10 @@ kswapd_try_sleep: classzone_idx);/* Read the new order and classzone_idx */ - alloc_order = reclaim_order = pgdat->kswapd_order; + alloc_order = reclaim_order =READ_ONCE (pgdat->kswapd_order); classzone_idx =kswapd_classzone_idx (pgdat, classzone_idx); - pgdat->kswapd_order =0 ; - pgdat->kswapd_classzone_idx =MAX_NR_ZONES ; +WRITE_ONCE (pgdat->kswapd_order,0 ); +WRITE_ONCE (pgdat->kswapd_classzone_idx,MAX_NR_ZONES ); ret =try_to_freeze ();if (kthread_should_stop ())
@@ -3816,20 +3820,23 @@ void wakeup_kswapd(struct zone *zone, gfp_t gfp_flags, int order, enum zone_type classzone_idx) {pg_data_t *pgdat; +enum zone_type curr_idx;if (!managed_zone (zone))return ;if (!cpuset_zone_allowed (zone, gfp_flags))return ; + pgdat = zone->zone_pgdat; + curr_idx =READ_ONCE (pgdat->kswapd_classzone_idx); + +if (curr_idx ==MAX_NR_ZONES || curr_idx < classzone_idx) +WRITE_ONCE (pgdat->kswapd_classzone_idx, classzone_idx); + +if (READ_ONCE (pgdat->kswapd_order) < order) +WRITE_ONCE (pgdat->kswapd_order, order); -if (pgdat->kswapd_classzone_idx ==MAX_NR_ZONES ) - pgdat->kswapd_classzone_idx = classzone_idx; -else - pgdat->kswapd_classzone_idx =max (pgdat->kswapd_classzone_idx, - classzone_idx); - pgdat->kswapd_order =max (pgdat->kswapd_order, order);if (!waitqueue_active (&pgdat->kswapd_wait))return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 162/245 tipc: fix memory leak in service subscripting
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 153/245 sparc64: vcc: Fix error return code in vcc_probe()
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 161/245 USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 158/245 power: supply: max17040: Correct voltage reading
In reply to Greg Kroah-HartmanFrom: 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
Greg Kroah-Hartman
maintainerPATCH 154/245 arm64: cpufeature: Relax checks for AArch32 support at EL[0-2]
In reply to Greg Kroah-HartmanFrom: 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 · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 134/245 ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len
In reply to Greg Kroah-HartmanFrom: Liu Song <[email protected]>
[ Upstream commit acc5af3efa303d5f36cc8c0f61716161f6ca1384 ]
In “ubifs_check_node”, when the value of "node_len" is abnormal, the code will goto label of "out_len" for execution. Then, in the following "ubifs_dump_node", if inode type is "UBIFS_DATA_NODE", in "print_hex_dump", an out-of-bounds access may occur due to the wrong "ch->len".
Therefore, when the value of "node_len" is abnormal, data length should to be adjusted to a reasonable safe range. At this time, structured data is not credible, so dump the corrupted data directly for analysis.
--- fs/ubifs/io.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/ubifs/io.c +14 -2
@@ -237,7 +237,7 @@ int ubifs_is_mapped(const struct ubifs_info *c, int lnum)int ubifs_check_node (const struct ubifs_info *c,const void *buf,int lnum,int offs,int quiet,int must_chk_crc) { -int err = -EINVAL , type, node_len; +int err = -EINVAL , type, node_len, dump_node =1 ;uint32_t crc, node_crc, magic;const struct ubifs_ch *ch = buf;
@@ -290,10 +290,22 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, out_len:if (!quiet)ubifs_err (c,"bad node length %d" , node_len); +if (type ==UBIFS_DATA_NODE && node_len >UBIFS_DATA_NODE_SZ ) + dump_node =0 ; out:if (!quiet) {ubifs_err (c,"bad node at LEB %d:%d" , lnum, offs); -ubifs_dump_node (c, buf); +if (dump_node) { +ubifs_dump_node (c, buf); + }else { +int safe_len =min3 (node_len, c->leb_size - offs, + (int )UBIFS_MAX_DATA_NODE_SZ ); +pr_err ("\tprevent out-of-bounds memory access\n" ); +pr_err ("\ttruncated data node length %d\n" , safe_len); +pr_err ("\tcorrupted data node:\n" ); +print_hex_dump (KERN_ERR ,"\t" ,DUMP_PREFIX_OFFSET ,32 ,1 , + buf, safe_len,0 ); + }dump_stack (); }return err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 133/245 PCI: Use ioremap(), not phys_to_virt() for platform ROM
In reply to Greg Kroah-HartmanFrom: Mikel Rychliski <[email protected]>
[ Upstream commit 72e0ef0e5f067fd991f702f0b2635d911d0cf208 ]
On some EFI systems, the video BIOS is provided by the EFI firmware. The boot stub code stores the physical address of the ROM image in pdev->rom. Currently we attempt to access this pointer using phys_to_virt(), which doesn't work with CONFIG_HIGHMEM.
On these systems, attempting to load the radeon module on a x86_32 kernel can result in the following:
BUG: unable to handle page fault for address: 3e8ed03c #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page *pde = 00000000 Oops: 0000 [#1] PREEMPT SMP CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2 Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS MP11.88Z.005C.B08.0707021221 07/02/07 EIP: radeon_get_bios+0x5ed/0xe50 [radeon] Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06 EAX: 3e8ed03c EBX: 00000000 ECX: 3e8ed03c EDX: 00010000 ESI: 00040000 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0 DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206 CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 000006d0 Call Trace: r520_init+0x26/0x240 [radeon] radeon_device_init+0x533/0xa50 [radeon] radeon_driver_load_kms+0x80/0x220 [radeon] drm_dev_register+0xa7/0x180 [drm] radeon_pci_probe+0x10f/0x1a0 [radeon] pci_device_probe+0xd4/0x140
Fix the issue by updating all drivers which can access a platform provided ROM. Instead of calling the helper function pci_platform_rom() which uses phys_to_virt(), call ioremap() directly on the pdev->rom.
radeon_read_platform_bios() previously directly accessed an __iomem pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().
pci_platform_rom() now has no remaining callers, so remove it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 31 +++++++++++-------- .../drm/nouveau/nvkm/subdev/bios/shadowpci.c | 17 ++++++++-- drivers/gpu/drm/radeon/radeon_bios.c | 30 +++++++++++------- drivers/pci/rom.c | 17 ---------- include/linux/pci.h | 1 - 5 files changed, 52 insertions(+), 44 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +18 -13
@@ -191,30 +191,35 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)static bool amdgpu_read_platform_bios (struct amdgpu_device *adev) { -uint8_t __iomem *bios; -size_t size; +phys_addr_t rom = adev->pdev->rom; +size_t romlen = adev->pdev->romlen; +void __iomem *bios; adev->bios =NULL ; - bios =pci_platform_rom (adev->pdev, &size); -if (!bios) { +if (!rom || romlen ==0 )return false; - } - adev->bios =kzalloc (size,GFP_KERNEL ); -if (adev->bios ==NULL ) + adev->bios =kzalloc (romlen,GFP_KERNEL ); +if (!adev->bios)return false; -memcpy_fromio (adev->bios, bios, size); + bios =ioremap (rom, romlen); +if (!bios) + goto free_bios; -if (!check_atom_bios (adev->bios, size)) { -kfree (adev->bios); -return false; - } +memcpy_fromio (adev->bios, bios, romlen); +iounmap (bios); - adev->bios_size = size; +if (!check_atom_bios (adev->bios, romlen)) + goto free_bios; + + adev->bios_size = romlen;return true; +free_bios: +kfree (adev->bios); +return false; }#ifdef CONFIG_ACPI
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +15 -2
@@ -101,9 +101,13 @@ platform_init(struct nvkm_bios *bios, const char *name)else return ERR_PTR (-ENODEV ); +if (!pdev->rom || pdev->romlen ==0 ) +return ERR_PTR (-ENODEV ); +if ((priv =kmalloc (sizeof (*priv),GFP_KERNEL ))) { + priv->size = pdev->romlen;if (ret = -ENODEV , - (priv->rom =pci_platform_rom (pdev, &priv->size))) + (priv->rom =ioremap (pdev->rom, pdev->romlen)))return priv;kfree (priv); }
@@ -111,11 +115,20 @@ platform_init(struct nvkm_bios *bios, const char *name)return ERR_PTR (ret); } +static void +platform_fini (void *data) +{ +struct priv *priv = data; + +iounmap (priv->rom); +kfree (priv); +} +const struct nvbios_source nvbios_platform = { .name ="PLATFORM" , .init = platform_init, - .fini = (void (*)(void *))kfree, + .fini = platform_fini, .read = pcirom_read, .rw = true, };
drivers/gpu/drm/radeon/radeon_bios.c +19 -11
@@ -104,25 +104,33 @@ static bool radeon_read_bios(struct radeon_device *rdev)static bool radeon_read_platform_bios (struct radeon_device *rdev) { -uint8_t __iomem *bios; -size_t size; +phys_addr_t rom = rdev->pdev->rom; +size_t romlen = rdev->pdev->romlen; +void __iomem *bios; rdev->bios =NULL ; - bios =pci_platform_rom (rdev->pdev, &size); -if (!bios) { +if (!rom || romlen ==0 )return false; - } -if (size ==0 || bios[0 ] !=0x55 || bios[1 ] !=0xaa ) { + rdev->bios =kzalloc (romlen,GFP_KERNEL ); +if (!rdev->bios)return false; - } - rdev->bios =kmemdup (bios, size,GFP_KERNEL ); -if (rdev->bios ==NULL ) { -return false; - } + + bios =ioremap (rom, romlen); +if (!bios) + goto free_bios; + +memcpy_fromio (rdev->bios, bios, romlen); +iounmap (bios); + +if (rdev->bios[0 ] !=0x55 || rdev->bios[1 ] !=0xaa ) + goto free_bios;return true; +free_bios: +kfree (rdev->bios); +return false; }#ifdef CONFIG_ACPI
drivers/pci/rom.c +0 -17
@@ -195,20 +195,3 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)pci_disable_rom (pdev); }EXPORT_SYMBOL (pci_unmap_rom); - -/** -* pci_platform_rom - provides a pointer to any ROM image provided by the -* platform -* @pdev: pointer to pci device struct -* @size: pointer to receive size of pci window over ROM -*/ -void __iomem *pci_platform_rom (struct pci_dev *pdev,size_t *size) -{ -if (pdev->rom && pdev->romlen) { - *size = pdev->romlen; -return phys_to_virt ((phys_addr_t )pdev->rom); - } - -return NULL ; -} -EXPORT_SYMBOL (pci_platform_rom);
include/linux/pci.h +0 -1
@@ -1144,7 +1144,6 @@ int pci_enable_rom(struct pci_dev *pdev);void pci_disable_rom (struct pci_dev *pdev);void __iomem __must_check *pci_map_rom (struct pci_dev *pdev,size_t *size);void pci_unmap_rom (struct pci_dev *pdev,void __iomem *rom); -void __iomem __must_check *pci_platform_rom (struct pci_dev *pdev,size_t *size);/* Power management related routines */ int pci_save_state (struct pci_dev *dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 132/245 svcrdma: Fix leak of transport addresses
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 1a33d8a284b1e85e03b8c7b1ea8fb985fccd1d71 ]
Kernel memory leak detected:
unreferenced object 0xffff888849cdf480 (size 8):
comm "kworker/u8:3", pid 2086, jiffies 4297898756 (age 4269.856s) hex dump (first 8 bytes):
30 00 cd 49 88 88 ff ff 0..I....
backtrace:
[<00000000acfc370b>] __kmalloc_track_caller+0x137/0x183
[<00000000a2724354>] kstrdup+0x2b/0x43
[<0000000082964f84>] xprt_rdma_format_addresses+0x114/0x17d [rpcrdma]
[<00000000dfa6ed00>] xprt_setup_rdma_bc+0xc0/0x10c [rpcrdma]
[<0000000073051a83>] xprt_create_transport+0x3f/0x1a0 [sunrpc]
[<0000000053531a8e>] rpc_create+0x118/0x1cd [sunrpc]
[<000000003a51b5f8>] setup_callback_client+0x1a5/0x27d [nfsd]
[<000000001bd410af>] nfsd4_process_cb_update.isra.7+0x16c/0x1ac [nfsd]
[<000000007f4bbd56>] nfsd4_run_cb_work+0x4c/0xbd [nfsd]
[<0000000055c5586b>] process_one_work+0x1b2/0x2fe
[<00000000b1e3e8ef>] worker_thread+0x1a6/0x25a
[<000000005205fb78>] kthread+0xf6/0xfb
[<000000006d2dc057>] ret_from_fork+0x3a/0x50Introduce a call to xprt_rdma_free_addresses() similar to the way that the TCP backchannel releases a transport's peer address strings.
--- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +1 -0
@@ -256,6 +256,7 @@ xprt_rdma_bc_put(struct rpc_xprt *xprt) {dprintk ("svcrdma: %s: xprt %p\n" , __func__, xprt); +xprt_rdma_free_addresses (xprt);xprt_free (xprt);module_put (THIS_MODULE ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 130/245 scsi: hpsa: correct race condition in offload enabled
In reply to Greg Kroah-HartmanFrom: Don Brace <[email protected]>
[ Upstream commit 3e16e83a62edac7617bfd8dbb4e55d04ff6adbe1 ]
Correct race condition where ioaccel is re-enabled before the raid_map is updated. For RAID_1, RAID_1ADM, and RAID 5/6 there is a BUG_ON called which is bad.
- Change event thread to disable ioaccel only. Send all requests down the RAID path instead.
- Have rescan thread handle offload_enable.
- Since there is only one rescan allowed at a time, turning offload_enabled on/off should not be racy. Each handler queues up a rescan if one is already in progress.
- For timing diagram, offload_enabled is initially off due to a change (transformation: splitmirror/remirror), ...
otbe = offload_to_be_enabled
oe = offload_enabled
Time Event Rescan Completion Request
Worker Worker Thread Thread
---- ------ ------ ---------- -------
T0 | | + UA |
T1 | + rescan started | 0x3f |
T2 + Event | | 0x0e |
T3 + Ack msg | | |
T4 | + if (!dev[i]->oe && | |
T5 | | dev[i]->otbe) | |
T6 | | get_raid_map | |
T7 + otbe = 1 | | |
T8 | | | |
T9 | + oe = otbe | |
T10 | | | + ioaccel request
T11 * BUG_ON T0 - I/O completion with UA 0x3f 0x0e sets rescan flag. T1 - rescan worker thread starts a rescan.
T2 - event comes in
T3 - event thread starts and issues "Acknowledge" message
...
T6 - rescan thread has bypassed code to reload new raid map.
...
T7 - event thread runs and sets offload_to_be_enabled
...
T9 - rescan thread turns on offload_enabled.
T10- request comes in and goes down ioaccel path. T11- BUG_ON.
- After the patch is applied, ioaccel_enabled can only be re-enabled in the re-scan thread.
--- drivers/scsi/hpsa.c | 80 ++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-)
drivers/scsi/hpsa.c +57 -23
@@ -507,6 +507,12 @@ static ssize_t host_store_rescan(struct device *dev,return count; } +static void hpsa_turn_off_ioaccel_for_device (struct hpsa_scsi_dev_t *device) +{ + device->offload_enabled =0 ; + device->offload_to_be_enabled =0 ; +} +static ssize_t host_show_firmware_revision (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1743,8 +1749,7 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h, __func__, h->scsi_host->host_no, logical_drive->bus, logical_drive->target, logical_drive->lun); - logical_drive->offload_enabled =0 ; - logical_drive->offload_to_be_enabled =0 ; +hpsa_turn_off_ioaccel_for_device (logical_drive); logical_drive->queue_depth =8 ; } }
@@ -2496,8 +2501,7 @@ static void process_ioaccel2_completion(struct ctlr_info *h, IOACCEL2_SERV_RESPONSE_FAILURE) {if (c2->error_data.status ==IOACCEL2_STATUS_SR_IOACCEL_DISABLED ) { - dev->offload_enabled =0 ; - dev->offload_to_be_enabled =0 ; +hpsa_turn_off_ioaccel_for_device (dev); }return hpsa_retry_cmd (h, c);
@@ -3676,10 +3680,17 @@ static void hpsa_get_ioaccel_status(struct ctlr_info *h, this_device->offload_config = !!(ioaccel_status &OFFLOAD_CONFIGURED_BIT );if (this_device->offload_config) { - this_device->offload_to_be_enabled = +bool offload_enabled = !!(ioaccel_status &OFFLOAD_ENABLED_BIT ); -if (hpsa_get_raid_map (h, scsi3addr, this_device)) - this_device->offload_to_be_enabled =0 ; +/* +* Check to see if offload can be enabled. +*/ +if (offload_enabled) { + rc =hpsa_get_raid_map (h, scsi3addr, this_device); +if (rc)/* could not load raid_map */ + goto out; + this_device->offload_to_be_enabled =1 ; + } } out:
@@ -3998,8 +4009,7 @@ static int hpsa_update_device_info(struct ctlr_info *h, }else { this_device->raid_level =RAID_UNKNOWN ; this_device->offload_config =0 ; - this_device->offload_enabled =0 ; - this_device->offload_to_be_enabled =0 ; +hpsa_turn_off_ioaccel_for_device (this_device); this_device->hba_ioaccel_enabled =0 ; this_device->volume_offline =0 ; this_device->queue_depth = h->nr_cmds;
@@ -5213,8 +5223,12 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,/* Handles load balance across RAID 1 members. * (2-drive R1 and R10 with even # of drives.) * Appropriate for SSDs, not optimal for HDDs +* Ensure we have the correct raid_map. */ -BUG_ON (le16_to_cpu (map->layout_map_count) !=2 ); +if (le16_to_cpu (map->layout_map_count) !=2 ) { +hpsa_turn_off_ioaccel_for_device (dev); +return IO_ACCEL_INELIGIBLE ; + }if (dev->offload_to_mirror) map_index +=le16_to_cpu (map->data_disks_per_row); dev->offload_to_mirror = !dev->offload_to_mirror;
@@ -5222,8 +5236,12 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,case HPSA_RAID_ADM :/* Handles N-way mirrors (R1-ADM) * and R10 with # of drives divisible by 3.) +* Ensure we have the correct raid_map. */ -BUG_ON (le16_to_cpu (map->layout_map_count) !=3 ); +if (le16_to_cpu (map->layout_map_count) !=3 ) { +hpsa_turn_off_ioaccel_for_device (dev); +return IO_ACCEL_INELIGIBLE ; + } offload_to_mirror = dev->offload_to_mirror; raid_map_helper(map, offload_to_mirror,
@@ -5248,7 +5266,10 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h, r5or6_blocks_per_row =le16_to_cpu (map->strip_size) *le16_to_cpu (map->data_disks_per_row); -BUG_ON (r5or6_blocks_per_row ==0 ); +if (r5or6_blocks_per_row ==0 ) { +hpsa_turn_off_ioaccel_for_device (dev); +return IO_ACCEL_INELIGIBLE ; + } stripesize = r5or6_blocks_per_row *le16_to_cpu (map->layout_map_count);#if BITS_PER_LONG ==32
@@ -8218,7 +8239,7 @@ static int detect_controller_lockup(struct ctlr_info *h)* * Called from monitor controller worker (hpsa_event_monitor_worker) * -* A Volume (or Volumes that comprise an Array set may be undergoing a +* A Volume (or Volumes that comprise an Array set) may be undergoing a * transformation, so we will be turning off ioaccel for all volumes that * make up the Array. */
@@ -8241,6 +8262,9 @@ static void hpsa_set_ioaccel_status(struct ctlr_info *h)* Run through current device list used during I/O requests. */ for (i =0 ; i < h->ndevices; i++) { +int offload_to_be_enabled =0 ; +int offload_config =0 ; + device = h->dev[i];if (!device)
@@ -8258,25 +8282,35 @@ static void hpsa_set_ioaccel_status(struct ctlr_info *h)continue ; ioaccel_status = buf[IOACCEL_STATUS_BYTE ]; - device->offload_config = + +/* +* Check if offload is still configured on +*/ + offload_config = !!(ioaccel_status &OFFLOAD_CONFIGURED_BIT ); -if (device->offload_config) - device->offload_to_be_enabled = +/* +* If offload is configured on, check to see if ioaccel +* needs to be enabled. +*/ +if (offload_config) + offload_to_be_enabled = !!(ioaccel_status &OFFLOAD_ENABLED_BIT ); +/* +* If ioaccel is to be re-enabled, re-enable later during the +* scan operation so the driver can get a fresh raidmap +* before turning ioaccel back on. +*/ +if (offload_to_be_enabled) +continue ; +/* * Immediately turn off ioaccel for any volume the * controller tells us to. Some of the reasons could be: * transformation - change to the LVs of an Array. * degraded volume - component failure -* -* If ioaccel is to be re-enabled, re-enable later during the -* scan operation so the driver can get a fresh raidmap -* before turning ioaccel back on. -* */ -if (!device->offload_to_be_enabled) - device->offload_enabled =0 ; +hpsa_turn_off_ioaccel_for_device (device); }kfree (buf);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 126/245 tools: gpio-hammer: Avoid potential overflow in main
In reply to Greg Kroah-HartmanFrom: Gabriel Ravier <[email protected]>
[ Upstream commit d1ee7e1f5c9191afb69ce46cc7752e4257340a31 ]
If '-o' was used more than 64 times in a single invocation of gpio-hammer, this could lead to an overflow of the 'lines' array. This commit fixes this by avoiding the overflow and giving a proper diagnostic back to the user
--- tools/gpio/gpio-hammer.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/gpio/gpio-hammer.c +16 -1
@@ -138,7 +138,14 @@ int main(int argc, char **argv) device_name = optarg;break ;case 'o' : - lines[i] =strtoul (optarg,NULL ,10 ); +/* +* Avoid overflow. Do not immediately error, we want to +* be able to accurately report on the amount of times +* '-o' was given to give an accurate error message +*/ +if (i <GPIOHANDLES_MAX ) + lines[i] =strtoul (optarg,NULL ,10 ); + i++;break ;case '?' :
@@ -146,6 +153,14 @@ int main(int argc, char **argv)return -1 ; } } + +if (i >=GPIOHANDLES_MAX ) { +fprintf (stderr, +"Only %d occurences of '-o' are allowed, %d were found\n" , +GPIOHANDLES_MAX , i +1 ); +return -1 ; + } + nlines = i;if (!device_name || !nlines) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 131/245 SUNRPC: Fix a potential buffer overflow in svc_print_xprts()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b25b60d7bfb02a74bc3c2d998e09aab159df8059 ]
'maxlen' is the total size of the destination buffer. There is only one caller and this value is 256.
When we compute the size already used and what we would like to add in the buffer, the trailling NULL character is not taken into account. However, this trailling character will be added by the 'strcat' once we have checked that we have enough place.
So, there is a off-by-one issue and 1 byte of the stack could be erroneously overwridden.
Take into account the trailling NULL, when checking if there is enough place in the destination buffer.
While at it, also replace a 'sprintf' by a safer 'snprintf', check for output truncation and avoid a superfluous 'strlen'.
[ cel: very minor fix to documenting comment
--- net/sunrpc/svc_xprt.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
net/sunrpc/svc_xprt.c +14 -5
@@ -103,8 +103,17 @@ void svc_unreg_xprt_class(struct svc_xprt_class *xcl) }EXPORT_SYMBOL_GPL (svc_unreg_xprt_class); -/* -* Format the transport list for printing +/** +* svc_print_xprts - Format the transport list for printing +* @buf: target buffer for formatted address +* @maxlen: length of target buffer +* +* Fills in @buf with a string containing a list of transport names, each name +* terminated with '\n'. If the buffer is too small, some entries may be +* missing, but it is guaranteed that all lines in the output buffer are +* complete. +* +* Returns positive length of the filled-in string. */ int svc_print_xprts (char *buf,int maxlen) {
@@ -117,9 +126,9 @@ int svc_print_xprts(char *buf, int maxlen)list_for_each_entry (xcl, &svc_xprt_class_list, xcl_list) {int slen; -sprintf (tmpstr,"%s %d\n" , xcl->xcl_name, xcl->xcl_max_payload); - slen =strlen (tmpstr); -if (len + slen > maxlen) + slen =snprintf (tmpstr,sizeof (tmpstr),"%s %d\n" , + xcl->xcl_name, xcl->xcl_max_payload); +if (slen >=sizeof (tmpstr) || len + slen >= maxlen)break ; len += slen;strcat (buf, tmpstr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 129/245 RDMA/rxe: Set sys_image_guid to be aligned with HW IB devices
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit d0ca2c35dd15a3d989955caec02beea02f735ee6 ]
The RXE driver doesn't set sys_image_guid and user space applications see zeros. This causes to pyverbs tests to fail with the following traceback, because the IBTA spec requires to have valid sys_image_guid.
Traceback (most recent call last):
File "./tests/test_device.py", line 51, in test_query_device
self.verify_device_attr(attr)
File "./tests/test_device.py", line 74, in verify_device_attr
assert attr.sys_image_guid != 0
In order to fix it, set sys_image_guid to be equal to node_guid.
Before:
5: rxe0: ... node_guid 5054:00ff:feaa:5363 sys_image_guid 0000:0000:0000:0000
After:
5: rxe0: ... node_guid 5054:00ff:feaa:5363 sys_image_guid 5054:00ff:feaa:5363
--- drivers/infiniband/sw/rxe/rxe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/sw/rxe/rxe.c +2 -0
@@ -121,6 +121,8 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->attr.max_fast_reg_page_list_len =RXE_MAX_FMR_PAGE_LIST_LEN ; rxe->attr.max_pkeys =RXE_MAX_PKEYS ; rxe->attr.local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; +addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, + rxe->ndev->dev_addr); rxe->max_ucontext =RXE_MAX_UCONTEXT ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 127/245 nvme-multipath: do not reset on unknown status
In reply to Greg Kroah-HartmanFrom: John Meneghini <[email protected]>
[ Upstream commit 764e9332098c0e60251386a507fe46ac91276120 ]
The nvme multipath error handling defaults to controller reset if the error is unknown. There are, however, no existing nvme status codes that indicate a reset should be used, and resetting causes unnecessary disruption to the rest of IO.
Change nvme's error handling to first check if failover should happen. If not, let the normal error handling take over rather than reset the controller.
--- drivers/nvme/host/core.c | 5 +---- drivers/nvme/host/multipath.c | 21 +++++++++------------ drivers/nvme/host/nvme.h | 5 +++-- 3 files changed, 13 insertions(+), 18 deletions(-)
drivers/nvme/host/core.c +1 -4
@@ -255,11 +255,8 @@ void nvme_complete_rq(struct request *req)trace_nvme_complete_rq (req);if (unlikely (status !=BLK_STS_OK &&nvme_req_needs_retry (req))) { -if ((req->cmd_flags &REQ_NVME_MPATH ) && -blk_path_error (status)) { -nvme_failover_req (req); +if ((req->cmd_flags &REQ_NVME_MPATH ) &&nvme_failover_req (req))return ; - }if (!blk_queue_dying (req->q)) {nvme_req (req)->retries++;
drivers/nvme/host/multipath.c +9 -12
@@ -73,17 +73,12 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, } } -void nvme_failover_req (struct request *req) +bool nvme_failover_req (struct request *req) {struct nvme_ns *ns = req->q->queuedata;u16 status =nvme_req (req)->status;unsigned long flags; -spin_lock_irqsave (&ns->head->requeue_lock, flags); -blk_steal_bios (&ns->head->requeue_list, req); -spin_unlock_irqrestore (&ns->head->requeue_lock, flags); -blk_mq_end_request (req,0 ); -switch (status &0x7ff ) {case NVME_SC_ANA_TRANSITION :case NVME_SC_ANA_INACCESSIBLE :
@@ -111,15 +106,17 @@ void nvme_failover_req(struct request *req)nvme_mpath_clear_current_path (ns);break ;default : -/* -* Reset the controller for any non-ANA error as we don't know -* what caused the error. -*/ -nvme_reset_ctrl (ns->ctrl); -break ; +/* This was a non-ANA error so follow the normal error path. */ +return false; } +spin_lock_irqsave (&ns->head->requeue_lock, flags); +blk_steal_bios (&ns->head->requeue_list, req); +spin_unlock_irqrestore (&ns->head->requeue_lock, flags); +blk_mq_end_request (req,0 ); +kblockd_schedule_work (&ns->head->requeue_work); +return true; }void nvme_kick_requeue_lists (struct nvme_ctrl *ctrl)
drivers/nvme/host/nvme.h +3 -2
@@ -477,7 +477,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);void nvme_mpath_start_freeze (struct nvme_subsystem *subsys);void nvme_set_disk_name (char *disk_name,struct nvme_ns *ns,struct nvme_ctrl *ctrl,int *flags); -void nvme_failover_req (struct request *req); +bool nvme_failover_req (struct request *req);void nvme_kick_requeue_lists (struct nvme_ctrl *ctrl);int nvme_mpath_alloc_disk (struct nvme_ctrl *ctrl,struct nvme_ns_head *head);void nvme_mpath_add_disk (struct nvme_ns *ns,struct nvme_id_ns *id);
@@ -521,8 +521,9 @@ static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,sprintf (disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); } -static inline void nvme_failover_req (struct request *req) +static inline bool nvme_failover_req (struct request *req) { +return false; }static inline void nvme_kick_requeue_lists (struct nvme_ctrl *ctrl) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 128/245 nvme: Fix controller creation races with teardown flow
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit ce1518139e6976cf19c133b555083354fdb629b8 ]
Calling nvme_sysfs_delete() when the controller is in the middle of creation may cause several bugs. If the controller is in NEW state we remove delete_controller file and don't delete the controller. The user will not be able to use nvme disconnect command on that controller again, although the controller may be active. Other bugs may happen if the controller is in the middle of create_ctrl callback and nvme_do_delete_ctrl() starts. For example, freeing I/O tagset at nvme_do_delete_ctrl() before it was allocated at create_ctrl callback.
To fix all those races don't allow the user to delete the controller before it was fully created.
--- drivers/nvme/host/core.c | 5 +++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 6 insertions(+)
drivers/nvme/host/core.c +5 -0
@@ -2856,6 +2856,10 @@ static ssize_t nvme_sysfs_delete(struct device *dev, {struct nvme_ctrl *ctrl =dev_get_drvdata (dev); +/* Can't delete non-created controllers */ +if (!ctrl->created) +return -EBUSY ; +if (device_remove_file_self (dev, attr))nvme_delete_ctrl_sync (ctrl);return count;
@@ -3576,6 +3580,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)queue_work (nvme_wq, &ctrl->async_event_work);nvme_start_queues (ctrl); } + ctrl->created = true; }EXPORT_SYMBOL_GPL (nvme_start_ctrl);
drivers/nvme/host/nvme.h +1 -0
@@ -206,6 +206,7 @@ struct nvme_ctrl {struct nvme_command ka_cmd;struct work_struct fw_act_work;unsigned long events; +bool created;#ifdef CONFIG_NVME_MULTIPATH /* asymmetric namespace access: */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 107/245 xfs: dont ever return a stale pointer from __xfs_dir3_free_read
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 1cb5deb5bc095c070c09a4540c45f9c9ba24be43 ]
If we decide that a directory free block is corrupt, we must take care not to leak a buffer pointer to the caller. After xfs_trans_brelse returns, the buffer can be freed or reused, which means that we have to set *bpp back to NULL.
Callers are supposed to notice the nonzero return value and not use the buffer pointer, but we should code more defensively, even if all current callers handle this situation correctly.
--- fs/xfs/libxfs/xfs_dir2_node.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/libxfs/xfs_dir2_node.c +1 -0
@@ -214,6 +214,7 @@ __xfs_dir3_free_read(if (fa) {xfs_verifier_error (*bpp, -EFSCORRUPTED , fa);xfs_trans_brelse (tp, *bpp); + *bpp =NULL ;return -EFSCORRUPTED ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 125/245 cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
In reply to Greg Kroah-HartmanFrom: Pratik Rajesh Sampat <[email protected]>
[ Upstream commit d95fe371ecd28901f11256c610b988ed44e36ee2 ]
The patch avoids allocating cpufreq_policy on stack hence fixing frame size overflow in 'powernv_cpufreq_work_fn'
--- drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/cpufreq/powernv-cpufreq.c +8 -5
@@ -903,6 +903,7 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {void powernv_cpufreq_work_fn (struct work_struct *work) { struct chip *chip = container_of(work, struct chip, throttle); +struct cpufreq_policy *policy;unsigned int cpu;cpumask_t mask;
@@ -917,12 +918,14 @@ void powernv_cpufreq_work_fn(struct work_struct *work) chip->restore = false;for_each_cpu (cpu, &mask) {int index; -struct cpufreq_policy policy; -cpufreq_get_policy (&policy, cpu); - index =cpufreq_table_find_index_c (&policy, policy.cur); -powernv_cpufreq_target_index (&policy, index); -cpumask_andnot (&mask, &mask, policy.cpus); + policy =cpufreq_cpu_get (cpu); +if (!policy) +continue ; + index =cpufreq_table_find_index_c (policy, policy->cur); +powernv_cpufreq_target_index (policy, index); +cpumask_andnot (&mask, &mask, policy->cpus); +cpufreq_cpu_put (policy); } out:put_online_cpus ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 120/245 perf parse-events: Fix 3 use after frees found with clang ASAN
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit d4953f7ef1a2e87ef732823af35361404d13fea8 ]
Reproducible with a clang asan build and then running perf test in particular 'Parse event definition strings'.
--- tools/perf/util/evsel.c | 1 + tools/perf/util/parse-events.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -0
@@ -1290,6 +1290,7 @@ void perf_evsel__exit(struct perf_evsel *evsel)thread_map__put (evsel->threads);zfree (&evsel->group_name);zfree (&evsel->name); +zfree (&evsel->pmu_name); perf_evsel__object.fini (evsel); }
tools/perf/util/parse-events.c +2 -2
@@ -1261,7 +1261,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, attr.type = pmu->type; evsel =__add_event (list, &parse_state->idx, &attr,NULL , pmu,NULL , auto_merge_stats);if (evsel) { - evsel->pmu_name = name; + evsel->pmu_name = name ?strdup (name) :NULL ; evsel->use_uncore_alias = use_uncore_alias;return 0 ; }else {
@@ -1302,7 +1302,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, evsel->snapshot = info.snapshot; evsel->metric_expr = info.metric_expr; evsel->metric_name = info.metric_name; - evsel->pmu_name = name; + evsel->pmu_name = name ?strdup (name) :NULL ; evsel->use_uncore_alias = use_uncore_alias; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 123/245 serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit 7cf4df30a98175033e9849f7f16c46e96ba47f41 ]
Terminate and flush DMA internal buffers, before pushing RX data to higher layer. Otherwise, this will lead to data corruption, as driver would end up pushing stale buffer data to higher layer while actual data is still stuck inside DMA hardware and has yet not arrived at the memory.
While at that, replace deprecated dmaengine_terminate_all() with dmaengine_terminate_async().
--- drivers/tty/serial/8250/8250_omap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +4 -2
@@ -781,7 +781,10 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)dmaengine_tx_status (dma->rxchan, dma->rx_cookie, &state); count = dma->rx_size - state.residue; - +if (count < dma->rx_size) +dmaengine_terminate_async (dma->rxchan); +if (!count) + goto unlock; ret =tty_insert_flip_string (tty_port, dma->rx_buf, count); p->port.icount.rx += ret;
@@ -843,7 +846,6 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)spin_unlock_irqrestore (&priv->rx_dma_lock, flags);__dma_rx_do_complete (p); -dmaengine_terminate_all (dma->rxchan); }static int omap_8250_rx_dma (struct uart_8250_port *p)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 122/245 serial: 8250_omap: Fix sleeping function called from invalid context during probe
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 4ce35a3617c0ac758c61122b2218b6c8c9ac9398 ]
When booting j721e the following bug is printed:
[ 1.154821] BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
[ 1.154827] in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 12, name: kworker/0:1
[ 1.154832] 3 locks held by kworker/0:1/12:
[ 1.154836] #0: ffff000840030728 ((wq_completion)events){+.+.}, at: process_one_work+0x1d4/0x6e8
[ 1.154852] #1: ffff80001214fdd8 (deferred_probe_work){+.+.}, at: process_one_work+0x1d4/0x6e8
[ 1.154860] #2: ffff00084060b170 (&dev->mutex){....}, at: __device_attach+0x38/0x138
[ 1.154872] irq event stamp: 63096
[ 1.154881] hardirqs last enabled at (63095): [<ffff800010b74318>] _raw_spin_unlock_irqrestore+0x70/0x78
[ 1.154887] hardirqs last disabled at (63096): [<ffff800010b740d8>] _raw_spin_lock_irqsave+0x28/0x80
[ 1.154893] softirqs last enabled at (62254): [<ffff800010080c88>] _stext+0x488/0x564
[ 1.154899] softirqs last disabled at (62247): [<ffff8000100fdb3c>] irq_exit+0x114/0x140
[ 1.154906] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.6.0-rc6-next-20200318-00094-g45e4089b0bd3 #221
[ 1.154911] Hardware name: Texas Instruments K3 J721E SoC (DT)
[ 1.154917] Workqueue: events deferred_probe_work_func
[ 1.154923] Call trace:
[ 1.154928] dump_backtrace+0x0/0x190
[ 1.154933] show_stack+0x14/0x20
[ 1.154940] dump_stack+0xe0/0x148
[ 1.154946] ___might_sleep+0x150/0x1f0
[ 1.154952] __might_sleep+0x4c/0x80
[ 1.154957] wait_for_completion_timeout+0x40/0x140
[ 1.154964] ti_sci_set_device_state+0xa0/0x158
[ 1.154969] ti_sci_cmd_get_device_exclusive+0x14/0x20
[ 1.154977] ti_sci_dev_start+0x34/0x50
[ 1.154984] genpd_runtime_resume+0x78/0x1f8
[ 1.154991] __rpm_callback+0x3c/0x140
[ 1.154996] rpm_callback+0x20/0x80
[ 1.155001] rpm_resume+0x568/0x758
[ 1.155007] __pm_runtime_resume+0x44/0xb0
[ 1.155013] omap8250_probe+0x2b4/0x508
[ 1.155019] platform_drv_probe+0x50/0xa0
[ 1.155023] really_probe+0xd4/0x318
[ 1.155028] driver_probe_device+0x54/0xe8
[ 1.155033] __device_attach_driver+0x80/0xb8
[ 1.155039] bus_for_each_drv+0x74/0xc0
[ 1.155044] __device_attach+0xdc/0x138
[ 1.155049] device_initial_probe+0x10/0x18
[ 1.155053] bus_probe_device+0x98/0xa0
[ 1.155058] deferred_probe_work_func+0x74/0xb0
[ 1.155063] process_one_work+0x280/0x6e8
[ 1.155068] worker_thread+0x48/0x430
[ 1.155073] kthread+0x108/0x138
[ 1.155079] ret_from_fork+0x10/0x18To fix the bug we need to first call pm_runtime_enable() prior to any pm_runtime calls.
--- drivers/tty/serial/8250/8250_omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +1 -1
@@ -1227,11 +1227,11 @@ static int omap8250_probe(struct platform_device *pdev)spin_lock_init (&priv->rx_dma_lock);device_init_wakeup (&pdev->dev, true); +pm_runtime_enable (&pdev->dev);pm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,-1 );pm_runtime_irq_safe (&pdev->dev); -pm_runtime_enable (&pdev->dev);pm_runtime_get_sync (&pdev->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 121/245 serial: 8250_port: Dont service RX FIFO if throttled
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit f19c3f6c8109b8bab000afd35580929958e087a9 ]
When port's throttle callback is called, it should stop pushing any more data into TTY buffer to avoid buffer overflow. This means driver has to stop HW from receiving more data and assert the HW flow control. For UARTs with auto HW flow control (such as 8250_omap) manual assertion of flow control line is not possible and only way is to allow RX FIFO to fill up, thus trigger auto HW flow control logic.
Therefore make sure that 8250 generic IRQ handler does not drain data when port is stopped (i.e UART_LSR_DR is unset in read_status_mask). Not servicing, RX FIFO would trigger auto HW flow control when FIFO occupancy reaches preset threshold, thus halting RX.
Since, error conditions in UART_LSR register are cleared just by reading the register, data has to be drained in case there are FIFO errors, else error information will lost.
--- drivers/tty/serial/8250/8250_port.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +15 -1
@@ -1861,6 +1861,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)unsigned char status;unsigned long flags;struct uart_8250_port *up =up_to_u8250p (port); +bool skip_rx = false;if (iir &UART_IIR_NO_INT )return 0 ;
@@ -1869,7 +1870,20 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) status =serial_port_in (port,UART_LSR ); -if (status & (UART_LSR_DR |UART_LSR_BI )) { +/* +* If port is stopped and there are no error conditions in the +* FIFO, then don't drain the FIFO, as this may lead to TTY buffer +* overflow. Not servicing, RX FIFO would trigger auto HW flow +* control when FIFO occupancy reaches preset threshold, thus +* halting RX. This only works when auto HW flow control is +* available. +*/ +if (!(status & (UART_LSR_FIFOE |UART_LSR_BRK_ERROR_BITS )) && + (port->status & (UPSTAT_AUTOCTS |UPSTAT_AUTORTS )) && + !(port->read_status_mask &UART_LSR_DR )) + skip_rx = true; + +if (status & (UART_LSR_DR |UART_LSR_BI ) && !skip_rx) {if (!up->dma ||handle_rx_dma (up, iir)) status =serial8250_rx_chars (up, status); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 118/245 tracing: Use address-of operator on section symbols
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit bf2cbe044da275021b2de5917240411a19e5c50d ]
Clang warns:
../kernel/trace/trace.c:9335:33: warning: array comparison always evaluates to true [-Wtautological-compare]
if (__stop___trace_bprintk_fmt != __start___trace_bprintk_fmt)
^1 warning generated.
These are not true arrays, they are linker defined symbols, which are just addresses. Using the address of operator silences the warning and does not change the runtime result of the check (tested with some print statements compiled in with clang + ld.lld and gcc + ld.bfd in QEMU).
--- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
@@ -8529,7 +8529,7 @@ __init static int tracer_alloc_buffers(void) goto out_free_buffer_mask;/* Only allocate trace_printk buffers if a trace_printk exists */ -if (__stop___trace_bprintk_fmt != __start___trace_bprintk_fmt) +if (&__stop___trace_bprintk_fmt != &__start___trace_bprintk_fmt)/* Must be called before global_trace.buffer is allocated */ trace_printk_init_buffers ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 119/245 thermal: rcar_thermal: Handle probe error gracefully
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 39056e8a989ef52486e063e34b4822b341e47b0e ]
If the common register memory resource is not available the driver needs to fail gracefully to disable PM. Instead of returning the error directly store it in ret and use the already existing error path.
--- drivers/thermal/rcar_thermal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/thermal/rcar_thermal.c +4 -2
@@ -505,8 +505,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM , mres++); common->base =devm_ioremap_resource (dev, res); -if (IS_ERR (common->base)) -return PTR_ERR (common->base); +if (IS_ERR (common->base)) { + ret =PTR_ERR (common->base); + goto error_unregister; + } idle =0 ;/* polling delay is not needed */ }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 116/245 drm/msm: fix leaks if initialization fails
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ]
We should free resources in unlikely case of allocation failure.
--- drivers/gpu/drm/msm/msm_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +4 -2
@@ -495,8 +495,10 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)if (!dev->dma_parms) { dev->dma_parms =devm_kzalloc (dev,sizeof (*dev->dma_parms),GFP_KERNEL ); -if (!dev->dma_parms) -return -ENOMEM ; +if (!dev->dma_parms) { + ret = -ENOMEM ; + goto err_msm_uninit; + } }dma_set_max_seg_size (dev,DMA_BIT_MASK (32 ));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/245 drm/msm/a5xx: Always set an OPP supported hardware value
In reply to Greg Kroah-HartmanFrom: Jordan Crouse <[email protected]>
[ Upstream commit 0478b4fc5f37f4d494245fe7bcce3f531cf380e9 ]
If the opp table specifies opp-supported-hw as a property but the driver has not set a supported hardware value the OPP subsystem will reject all the table entries.
Set a "default" value that will match the default table entries but not conflict with any possible real bin values. Also fix a small memory leak and free the buffer allocated by nvmem_cell_read().
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +20 -7
@@ -1474,18 +1474,31 @@ static const struct adreno_gpu_funcs funcs = {static void check_speed_bin (struct device *dev) {struct nvmem_cell *cell; -u32 bin, val; +u32 val; + +/* +* If the OPP table specifies a opp-supported-hw property then we have +* to set something with dev_pm_opp_set_supported_hw() or the table +* doesn't get populated so pick an arbitrary value that should +* ensure the default frequencies are selected but not conflict with any +* actual bins +*/ + val =0x80 ; cell =nvmem_cell_get (dev,"speed_bin" ); -/* If a nvmem cell isn't defined, nothing to do */ -if (IS_ERR (cell)) -return ; +if (!IS_ERR (cell)) { +void *buf =nvmem_cell_read (cell,NULL ); + +if (!IS_ERR (buf)) { +u8 bin = *((u8 *) buf); - bin = *((u32 *)nvmem_cell_read (cell,NULL )); -nvmem_cell_put (cell); + val = (1 << bin); +kfree (buf); + } - val = (1 << bin); +nvmem_cell_put (cell); + }dev_pm_opp_set_supported_hw (dev, &val,1 ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 81/245 ALSA: usb-audio: Dont create a mixer element with bogus volume range
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit e9a0ef0b5ddcbc0d56c65aefc0f18d16e6f71207 ]
Some USB-audio descriptors provide a bogus volume range (e.g. volume min and max are identical), which confuses user-space. This patch makes the driver skipping such a control element.
--- sound/usb/mixer.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/mixer.c +10 -0
@@ -1699,6 +1699,16 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer,/* get min/max values */ get_min_max_with_quirks (cval,0 , kctl); +/* skip a bogus volume range */ +if (cval->max <= cval->min) { +usb_audio_dbg (mixer->chip, +"[%d] FU [%s] skipped due to invalid volume\n" , + cval->head.id, kctl->id.name); +snd_ctl_free_one (kctl); +return ; + } + +if (control ==UAC_FU_VOLUME ) {check_mapped_dB (map, cval);if (cval->dBmin < cval->dBmax || !cval->initialized) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 115/245 KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones
In reply to Greg Kroah-HartmanFrom: Gustavo Romero <[email protected]>
[ Upstream commit 1dff3064c764b5a51c367b949b341d2e38972bec ]
On P9 DD2.2 due to a CPU defect some TM instructions need to be emulated by KVM. This is handled at first by the hardware raising a softpatch interrupt when certain TM instructions that need KVM assistance are executed in the guest. Althought some TM instructions per Power ISA are invalid forms they can raise a softpatch interrupt too. For instance, 'tresume.' instruction as defined in the ISA must have bit 31 set (1), but an instruction that matches 'tresume.' PO and XO opcode fields but has bit 31 not set (0), like 0x7cfe9ddc, also raises a softpatch interrupt. Similarly for 'treclaim.' and 'trechkpt.' instructions with bit 31 = 0, i.e. 0x7c00075c and 0x7c0007dc, respectively. Hence, if a code like the following is executed in the guest it will raise a softpatch interrupt just like a 'tresume.' when the TM facility is enabled ('tabort. 0' in the example is used only to enable the TM facility):
int main() { asm("tabort. 0; .long 0x7cfe9ddc;"); }
Currently in such a case KVM throws a complete trace like:
[345523.705984] WARNING: CPU: 24 PID: 64413 at arch/powerpc/kvm/book3s_hv_tm.c:211 kvmhv_p9_tm_emulation+0x68/0x620 [kvm_hv] [345523.705985] Modules linked in: kvm_hv(E) xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_nat
iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bridge stp llc sch_fq_codel ipmi_powernv at24 vmx_crypto ipmi_devintf ipmi_msghandler ibmpowernv uio_pdrv_genirq kvm opal_prd uio leds_powernv ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx libcrc32c xor raid6_pq raid1 raid0 multipath linear tg3 crct10dif_vpmsum crc32c_vpmsum ipr [last unloaded: kvm_hv]
[345523.706030] CPU: 24 PID: 64413 Comm: CPU 0/KVM Tainted: G W E 5.5.0+ #1
[345523.706031] NIP: c0080000072cb9c0 LR: c0080000072b5e80 CTR: c0080000085c7850
[345523.706034] REGS: c000000399467680 TRAP: 0700 Tainted: G W E (5.5.0+)
[345523.706034] MSR: 900000010282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]> CR: 24022428 XER: 00000000
[345523.706042] CFAR: c0080000072b5e7c IRQMASK: 0
GPR00: c0080000072b5e80 c000000399467910 c0080000072db500 c000000375ccc720
GPR04: c000000375ccc720 00000003fbec0000 0000a10395dda5a6 0000000000000000
GPR08: 000000007cfe9ddc 7cfe9ddc000005dc 7cfe9ddc7c0005dc c0080000072cd530
GPR12: c0080000085c7850 c0000003fffeb800 0000000000000001 00007dfb737f0000
GPR16: c0002001edcca558 0000000000000000 0000000000000000 0000000000000001
GPR20: c000000001b21258 c0002001edcca558 0000000000000018 0000000000000000
GPR24: 0000000001000000 ffffffffffffffff 0000000000000001 0000000000001500
GPR28: c0002001edcc4278 c00000037dd80000 800000050280f033 c000000375ccc720
[345523.706062] NIP [c0080000072cb9c0] kvmhv_p9_tm_emulation+0x68/0x620 [kvm_hv]
[345523.706065] LR [c0080000072b5e80] kvmppc_handle_exit_hv.isra.53+0x3e8/0x798 [kvm_hv]
[345523.706066] Call Trace:
[345523.706069] [c000000399467910] [c000000399467940] 0xc000000399467940 (unreliable)
[345523.706071] [c000000399467950] [c000000399467980] 0xc000000399467980
[345523.706075] [c0000003994679f0] [c0080000072bd1c4] kvmhv_run_single_vcpu+0xa1c/0xb80 [kvm_hv]
[345523.706079] [c000000399467ac0] [c0080000072bd8e0] kvmppc_vcpu_run_hv+0x5b8/0xb00 [kvm_hv]
[345523.706087] [c000000399467b90] [c0080000085c93cc] kvmppc_vcpu_run+0x34/0x48 [kvm]
[345523.706095] [c000000399467bb0] [c0080000085c582c] kvm_arch_vcpu_ioctl_run+0x244/0x420 [kvm]
[345523.706101] [c000000399467c40] [c0080000085b7498] kvm_vcpu_ioctl+0x3d0/0x7b0 [kvm]
[345523.706105] [c000000399467db0] [c0000000004adf9c] ksys_ioctl+0x13c/0x170
[345523.706107] [c000000399467e00] [c0000000004adff8] sys_ioctl+0x28/0x80
[345523.706111] [c000000399467e20] [c00000000000b278] system_call+0x5c/0x68
[345523.706112] Instruction dump:
[345523.706114] 419e0390 7f8a4840 409d0048 6d497c00 2f89075d 419e021c 6d497c00 2f8907dd
[345523.706119] 419e01c0 6d497c00 2f8905dd 419e00a4 <0fe00000> 38210040 38600000 ebc1fff0and then treats the executed instruction as a 'nop'.
However the POWER9 User's Manual, in section "4.6.10 Book II Invalid Forms", informs that for TM instructions bit 31 is in fact ignored, thus for the TM-related invalid forms ignoring bit 31 and handling them like the valid forms is an acceptable way to handle them. POWER8 behaves the same way too.
This commit changes the handling of the cases here described by treating the TM-related invalid forms that can generate a softpatch interrupt just like their valid forms (w/ bit 31 = 1) instead of as a 'nop' and by gently reporting any other unrecognized case to the host and treating it as illegal instruction instead of throwing a trace and treating it as a 'nop'.
--- arch/powerpc/include/asm/kvm_asm.h | 3 +++ arch/powerpc/kvm/book3s_hv_tm.c | 28 ++++++++++++++++++++----- arch/powerpc/kvm/book3s_hv_tm_builtin.c | 16 ++++++++++++-- 3 files changed, 40 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/kvm_asm.h +3 -0
@@ -163,4 +163,7 @@#define KVM_INST_FETCH_FAILED -1 +/* Extract PO and XOP opcode fields */ +#define PO_XOP_OPCODE_MASK 0xfc0007fe +#endif /* __POWERPC_KVM_ASM_H__ */
arch/powerpc/kvm/book3s_hv_tm.c +23 -5
@@ -6,6 +6,8 @@* published by the Free Software Foundation. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kvm_host.h> #include <asm/kvm_ppc.h>
@@ -47,7 +49,18 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu)u64 newmsr, bescr;int ra, rs; -switch (instr &0xfc0007ff ) { +/* +* rfid, rfebb, and mtmsrd encode bit 31 = 0 since it's a reserved bit +* in these instructions, so masking bit 31 out doesn't change these +* instructions. For treclaim., tsr., and trechkpt. instructions if bit +* 31 = 0 then they are per ISA invalid forms, however P9 UM, in section +* 4.6.10 Book II Invalid Forms, informs specifically that ignoring bit +* 31 is an acceptable way to handle these invalid forms that have +* bit 31 = 0. Moreover, for emulation purposes both forms (w/ and wo/ +* bit 31 set) can generate a softpatch interrupt. Hence both forms +* are handled below for these instructions so they behave the same way. +*/ +switch (instr &PO_XOP_OPCODE_MASK ) {case PPC_INST_RFID :/* XXX do we need to check for PR=0 here? */ newmsr = vcpu->arch.shregs.srr1;
@@ -108,7 +121,8 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.shregs.msr = newmsr;return RESUME_GUEST ; -case PPC_INST_TSR : +/* ignore bit 31, see comment above */ +case (PPC_INST_TSR &PO_XOP_OPCODE_MASK ):/* check for PR=1 and arch 2.06 bit set in PCR */ if ((msr &MSR_PR ) && (vcpu->arch.vcore->pcr &PCR_ARCH_206 )) {/* generate an illegal instruction interrupt */
@@ -143,7 +157,8 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.shregs.msr = msr;return RESUME_GUEST ; -case PPC_INST_TRECLAIM : +/* ignore bit 31, see comment above */ +case (PPC_INST_TRECLAIM &PO_XOP_OPCODE_MASK ):/* check for TM disabled in the HFSCR or MSR */ if (!(vcpu->arch.hfscr &HFSCR_TM )) {/* generate an illegal instruction interrupt */
@@ -179,7 +194,8 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) vcpu->arch.shregs.msr &= ~MSR_TS_MASK ;return RESUME_GUEST ; -case PPC_INST_TRECHKPT : +/* ignore bit 31, see comment above */ +case (PPC_INST_TRECHKPT &PO_XOP_OPCODE_MASK ):/* XXX do we need to check for PR=0 here? */ /* check for TM disabled in the HFSCR or MSR */ if (!(vcpu->arch.hfscr &HFSCR_TM )) {
@@ -211,6 +227,8 @@ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu) }/* What should we do here? We didn't recognize the instruction */ -WARN_ON_ONCE (1 ); +kvmppc_core_queue_program (vcpu,SRR1_PROGILL ); +pr_warn_ratelimited ("Unrecognized TM-related instruction %#x for emulation" , instr); +return RESUME_GUEST ; }
arch/powerpc/kvm/book3s_hv_tm_builtin.c +14 -2
@@ -26,7 +26,18 @@ int kvmhv_p9_tm_emulation_early(struct kvm_vcpu *vcpu)u64 newmsr, msr, bescr;int rs; -switch (instr &0xfc0007ff ) { +/* +* rfid, rfebb, and mtmsrd encode bit 31 = 0 since it's a reserved bit +* in these instructions, so masking bit 31 out doesn't change these +* instructions. For the tsr. instruction if bit 31 = 0 then it is per +* ISA an invalid form, however P9 UM, in section 4.6.10 Book II Invalid +* Forms, informs specifically that ignoring bit 31 is an acceptable way +* to handle TM-related invalid forms that have bit 31 = 0. Moreover, +* for emulation purposes both forms (w/ and wo/ bit 31 set) can +* generate a softpatch interrupt. Hence both forms are handled below +* for tsr. to make them behave the same way. +*/ +switch (instr &PO_XOP_OPCODE_MASK ) {case PPC_INST_RFID :/* XXX do we need to check for PR=0 here? */ newmsr = vcpu->arch.shregs.srr1;
@@ -76,7 +87,8 @@ int kvmhv_p9_tm_emulation_early(struct kvm_vcpu *vcpu) vcpu->arch.shregs.msr = newmsr;return 1 ; -case PPC_INST_TSR : +/* ignore bit 31, see comment above */ +case (PPC_INST_TSR &PO_XOP_OPCODE_MASK ):/* we know the MSR has the TS field = S (0b01) here */ msr = vcpu->arch.shregs.msr;/* check for PR=1 and arch 2.06 bit set in PCR */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 79/245 crypto: chelsio - This fixes the kernel panic which occurs during a libkcapi test
In reply to Greg Kroah-HartmanFrom: Ayush Sawal <[email protected]>
[ Upstream commit 9195189e00a7db55e7d448cee973cae87c5a3c71 ]
The libkcapi test which causes kernel panic is
aead asynchronous vmsplice multiple test.
./bin/kcapi -v -d 4 -x 10 -c "ccm(aes)"
-q 4edb58e8d5eb6bc711c43a6f3693daebde2e5524f1b55297abb29f003236e43d -t a7877c99 -n 674742abd0f5ba -k 2861fd0253705d7875c95ba8a53171b4 -a fb7bc304a3909e66e2e0c5ef952712dd884ce3e7324171369f2c5db1adc48c7d
This patch avoids dma_mapping of a zero length sg which causes the panic, by using sg_nents_for_len which maps only upto a specific length
--- drivers/crypto/chelsio/chcr_algo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/chelsio/chcr_algo.c +3 -2
@@ -2418,8 +2418,9 @@ int chcr_aead_dma_map(struct device *dev,else reqctx->b0_dma =0 ;if (req->src == req->dst) { - error =dma_map_sg (dev, req->src,sg_nents (req->src), -DMA_BIDIRECTIONAL ); + error =dma_map_sg (dev, req->src, +sg_nents_for_len (req->src, dst_size), +DMA_BIDIRECTIONAL );if (!error) goto err; }else {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 106/245 media: tda10071: fix unsigned sign extension overflow
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit a7463e2dc698075132de9905b89f495df888bb79 ]
The shifting of buf[3] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an unsigned long. In the unlikely event that the the top bit of buf[3] is set then all then all the upper bits end up as also being set because of the sign-extension and this affect the ev->post_bit_error sum. Fix this by using the temporary u32 variable bit_error to avoid the sign-extension promotion. This also removes the need to do the computation twice.
Addresses-Coverity: ("Unintended sign extension")
--- drivers/media/dvb-frontends/tda10071.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/dvb-frontends/tda10071.c +5 -4
@@ -483,10 +483,11 @@ static int tda10071_read_status(struct dvb_frontend *fe, enum fe_status *status) goto error;if (dev->delivery_system ==SYS_DVBS ) { - dev->dvbv3_ber = buf[0 ] <<24 | buf[1 ] <<16 | - buf[2 ] <<8 | buf[3 ] <<0 ; - dev->post_bit_error += buf[0 ] <<24 | buf[1 ] <<16 | - buf[2 ] <<8 | buf[3 ] <<0 ; +u32 bit_error = buf[0 ] <<24 | buf[1 ] <<16 | + buf[2 ] <<8 | buf[3 ] <<0 ; + + dev->dvbv3_ber = bit_error; + dev->post_bit_error += bit_error; c->post_bit_error.stat[0 ].scale =FE_SCALE_COUNTER ; c->post_bit_error.stat[0 ].uvalue = dev->post_bit_error; dev->block_error += buf[4 ] <<8 | buf[5 ] <<0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 78/245 clk: stratix10: use do_div() for 64-bit calculation
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
[ Upstream commit cc26ed7be46c5f5fa45f3df8161ed7ca3c4d318c ]
do_div() macro to perform u64 division and guards against overflow if the result is too large for the unsigned long return type.
--- drivers/clk/socfpga/clk-pll-s10.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/socfpga/clk-pll-s10.c +3 -1
@@ -38,7 +38,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk,/* read VCO1 reg for numerator and denominator */ reg =readl (socfpgaclk->hw.reg); refdiv = (reg &SOCFPGA_PLL_REFDIV_MASK ) >>SOCFPGA_PLL_REFDIV_SHIFT ; - vco_freq = (unsigned long long )parent_rate / refdiv; + + vco_freq = parent_rate; +do_div (vco_freq, refdiv);/* Read mdiv and fdiv from the fdbck register */ reg =readl (socfpgaclk->hw.reg +0x4 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 103/245 ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 402f2992b4d62760cce7c689ff216ea3bf4d6e8a ]
When use command to read values, it crashed.
command:
dd if=/sys/kernel/debug/ieee80211/phy0/ath10k/mem_value count=1 bs=4 skip=$((0x100233))
It will call to ath10k_sdio_hif_diag_read with address = 0x4008cc and buf_len = 4.
Then system crash:
[ 1786.013258] Unable to handle kernel paging request at virtual address ffffffc00bd45000 [ 1786.013273] Mem abort info: [ 1786.013281] ESR = 0x96000045 [ 1786.013291] Exception class = DABT (current EL), IL = 32 bits [ 1786.013299] SET = 0, FnV = 0 [ 1786.013307] EA = 0, S1PTW = 0 [ 1786.013314] Data abort info: [ 1786.013322] ISV = 0, ISS = 0x00000045 [ 1786.013330] CM = 0, WnR = 1 [ 1786.013342] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 000000008542a60e [ 1786.013350] [ffffffc00bd45000] pgd=0000000000000000, pud=0000000000000000 [ 1786.013368] Internal error: Oops: 96000045 [#1] PREEMPT SMP [ 1786.013609] Process swapper/0 (pid: 0, stack limit = 0x0000000084b153c6) [ 1786.013623] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.86 #137 [ 1786.013631] Hardware name: MediaTek krane sku176 board (DT) [ 1786.013643] pstate: 80000085 (Nzcv daIf -PAN -UAO) [ 1786.013662] pc : __memcpy+0x94/0x180 [ 1786.013678] lr : swiotlb_tbl_unmap_single+0x84/0x150 [ 1786.013686] sp : ffffff8008003c60 [ 1786.013694] x29: ffffff8008003c90 x28: ffffffae96411f80 [ 1786.013708] x27: ffffffae960d2018 x26: ffffff8019a4b9a8 [ 1786.013721] x25: 0000000000000000 x24: 0000000000000001 [ 1786.013734] x23: ffffffae96567000 x22: 00000000000051d4 [ 1786.013747] x21: 0000000000000000 x20: 00000000fe6e9000 [ 1786.013760] x19: 0000000000000004 x18: 0000000000000020 [ 1786.013773] x17: 0000000000000001 x16: 0000000000000000 [ 1786.013787] x15: 00000000ffffffff x14: 00000000000044c0 [ 1786.013800] x13: 0000000000365ba4 x12: 0000000000000000 [ 1786.013813] x11: 0000000000000001 x10: 00000037be6e9000 [ 1786.013826] x9 : ffffffc940000000 x8 : 000000000bd45000 [ 1786.013839] x7 : 0000000000000000 x6 : ffffffc00bd45000 [ 1786.013852] x5 : 0000000000000000 x4 : 0000000000000000 [ 1786.013865] x3 : 0000000000000c00 x2 : 0000000000000004 [ 1786.013878] x1 : fffffff7be6e9004 x0 : ffffffc00bd45000 [ 1786.013891] Call trace: [ 1786.013903] __memcpy+0x94/0x180 [ 1786.013914] unmap_single+0x6c/0x84 [ 1786.013925] swiotlb_unmap_sg_attrs+0x54/0x80 [ 1786.013938] __swiotlb_unmap_sg_attrs+0x8c/0xa4 [ 1786.013952] msdc_unprepare_data+0x6c/0x84 [ 1786.013963] msdc_request_done+0x58/0x84 [ 1786.013974] msdc_data_xfer_done+0x1a0/0x1c8 [ 1786.013985] msdc_irq+0x12c/0x17c [ 1786.013996] __handle_irq_event_percpu+0xe4/0x250 [ 1786.014006] handle_irq_event_percpu+0x28/0x68 [ 1786.014015] handle_irq_event+0x48/0x78 [ 1786.014026] handle_fasteoi_irq+0xd0/0x1a0 [ 1786.014039] __handle_domain_irq+0x84/0xc4 [ 1786.014050] gic_handle_irq+0x124/0x1a4 [ 1786.014059] el1_irq+0xb0/0x128 [ 1786.014072] cpuidle_enter_state+0x298/0x328 [ 1786.014082] cpuidle_enter+0x30/0x40 [ 1786.014094] do_idle+0x190/0x268 [ 1786.014104] cpu_startup_entry+0x24/0x28 [ 1786.014116] rest_init+0xd4/0xe0 [ 1786.014126] start_kernel+0x30c/0x38c [ 1786.014139] Code: f8408423 f80084c3 36100062 b8404423 (b80044c3) [ 1786.014150] ---[ end trace 3b02ddb698ea69ee ]--- [ 1786.015415] Kernel panic - not syncing: Fatal exception in interrupt [ 1786.015433] SMP: stopping secondary CPUs [ 1786.015447] Kernel Offset: 0x2e8d200000 from 0xffffff8008000000 [ 1786.015458] CPU features: 0x0,2188200c [ 1786.015466] Memory Limit: none
For sdio chip, it need the memory which is kmalloc, if it is vmalloc from ath10k_mem_value_read, then it have a memory error. kzalloc of ath10k_sdio_hif_diag_read32 is the correct type, so add kzalloc in ath10k_sdio_hif_diag_read to replace the buffer which is vmalloc from ath10k_mem_value_read.
This patch only effect sdio chip.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
--- drivers/net/wireless/ath/ath10k/sdio.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/sdio.c +14 -4
@@ -1567,23 +1567,33 @@ static int ath10k_sdio_hif_diag_read(struct ath10k *ar, u32 address, void *buf, size_t buf_len) {int ret; +void *mem; + + mem =kzalloc (buf_len,GFP_KERNEL ); +if (!mem) +return -ENOMEM ;/* set window register to start read cycle */ ret =ath10k_sdio_write32 (ar,MBOX_WINDOW_READ_ADDR_ADDRESS , address);if (ret) {ath10k_warn (ar,"failed to set mbox window read address: %d" , ret); -return ret; + goto out; }/* read the data */ - ret =ath10k_sdio_read (ar,MBOX_WINDOW_DATA_ADDRESS , buf, buf_len); + ret =ath10k_sdio_read (ar,MBOX_WINDOW_DATA_ADDRESS , mem, buf_len);if (ret) {ath10k_warn (ar,"failed to read from mbox window data address: %d\n" , ret); -return ret; + goto out; } -return 0 ; +memcpy (buf, mem, buf_len); + +out: +kfree (mem); + +return ret; } static int ath10k_sdio_hif_diag_read32(struct ath10k *ar, u32 address,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 80/245 mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 9379df2fd9234e3b67a23101c2370c99f6af6d77 ]
During the cleanup of the aggregation session, a rx handler (or release timer) on another CPU might still hold a pointer to the reorder buffer and could attempt to release some packets.
Clearing pointers during cleanup avoids a theoretical use-after-free bug here.
--- drivers/net/wireless/mediatek/mt76/agg-rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/agg-rx.c +1 -0
@@ -278,6 +278,7 @@ static void mt76_rx_aggr_shutdown(struct mt76_dev *dev, struct mt76_rx_tid *tid)if (!skb)continue ; + tid->reorder_buf[i] =NULL ; tid->nframes--;dev_kfree_skb (skb); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 104/245 scsi: aacraid: Disabling TM path and only processing IOP reset
In reply to Greg Kroah-HartmanFrom: Sagar Biradar <[email protected]>
[ Upstream commit bef18d308a2215eff8c3411a23d7f34604ce56c3 ]
Fixes the occasional adapter panic when sg_reset is issued with -d, -t, -b and -H flags. Removal of command type HBA_IU_TYPE_SCSI_TM_REQ in aac_hba_send since iu_type, request_id and fib_flags are not populated. Device and target reset handlers are made to send TMF commands only when reset_state is 0.
--- drivers/scsi/aacraid/commsup.c | 2 +- drivers/scsi/aacraid/linit.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-)
drivers/scsi/aacraid/commsup.c +1 -1
@@ -743,7 +743,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, hbacmd->request_id =cpu_to_le32 ((((u32)(fibptr - dev->fibs)) <<2 ) +1 ); fibptr->flags |=FIB_CONTEXT_FLAG_SCSI_CMD ; - }else if (command !=HBA_IU_TYPE_SCSI_TM_REQ ) + }else return -EINVAL ;
drivers/scsi/aacraid/linit.c +25 -9
@@ -736,7 +736,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) status =aac_hba_send (HBA_IU_TYPE_SCSI_TM_REQ , fib, (fib_callback ) aac_hba_callback, (void *) cmd); - +if (status != -EINPROGRESS ) { +aac_fib_complete (fib); +aac_fib_free (fib); +return ret; + }/* Wait up to 15 secs for completion */ for (count =0 ; count <15 ; ++count) {if (cmd->SCp.sent_command) {
@@ -915,11 +919,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) info = &aac->hba_map[bus][cid]; -if (info->devtype !=AAC_DEVTYPE_NATIVE_RAW && - info->reset_state >0 ) +if (!(info->devtype ==AAC_DEVTYPE_NATIVE_RAW && + !(info->reset_state >0 )))return FAILED ; -pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +pr_err ("%s: Host device reset request. SCSI hang ?\n" ,AAC_DRIVERNAME ); fib =aac_fib_alloc (aac);
@@ -934,7 +938,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) status =aac_hba_send (command, fib, (fib_callback ) aac_tmf_callback, (void *) info); - +if (status != -EINPROGRESS ) { + info->reset_state =0 ; +aac_fib_complete (fib); +aac_fib_free (fib); +return ret; + }/* Wait up to 15 seconds for completion */ for (count =0 ; count <15 ; ++count) {if (info->reset_state ==0 ) {
@@ -973,11 +982,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) info = &aac->hba_map[bus][cid]; -if (info->devtype !=AAC_DEVTYPE_NATIVE_RAW && - info->reset_state >0 ) +if (!(info->devtype ==AAC_DEVTYPE_NATIVE_RAW && + !(info->reset_state >0 )))return FAILED ; -pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +pr_err ("%s: Host target reset request. SCSI hang ?\n" ,AAC_DRIVERNAME ); fib =aac_fib_alloc (aac);
@@ -994,6 +1003,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) (fib_callback ) aac_tmf_callback, (void *) info); +if (status != -EINPROGRESS ) { + info->reset_state =0 ; +aac_fib_complete (fib); +aac_fib_free (fib); +return ret; + } +/* Wait up to 15 seconds for completion */ for (count =0 ; count <15 ; ++count) {if (info->reset_state <=0 ) {
@@ -1046,7 +1062,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd) } } -pr_err ("%s: Host adapter reset request. SCSI hang ?\n" ,AAC_DRIVERNAME ); +pr_err ("%s: Host bus reset request. SCSI hang ?\n" ,AAC_DRIVERNAME );/* * Check the health of the controller
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/245 perf jevents: Fix leak of mapfile memory
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 3f5777fbaf04c58d940526a22a2e0c813c837936 ]
The memory for global pointer is never freed during normal program execution, so let's do that in the main function exit as a good programming practice.
A stray blank line is also removed.
--- tools/perf/pmu-events/jevents.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/perf/pmu-events/jevents.c +9 -6
@@ -1064,10 +1064,9 @@ static int process_one_file(const char *fpath, const struct stat *sb,*/ int main (int argc,char *argv[]) { -int rc; +int rc, ret =0 ;int maxfds;char ldirname[PATH_MAX ]; -const char *arch;const char *output_file;const char *start_dirname;
@@ -1138,7 +1137,8 @@ int main(int argc, char *argv[])/* Make build fail */ fclose (eventsfp);free_arch_std_events (); -return 1 ; + ret =1 ; + goto out_free_mapfile; }else if (rc) { goto empty_map; }
@@ -1156,14 +1156,17 @@ int main(int argc, char *argv[])/* Make build fail */ fclose (eventsfp);free_arch_std_events (); -return 1 ; + ret =1 ; } -return 0 ; + + goto out_free_mapfile; empty_map:fclose (eventsfp);create_empty_mapping (output_file);free_arch_std_events (); -return 0 ; +out_free_mapfile: +free (mapfile); +return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 76/245 scsi: lpfc: Fix coverity errors in fmdi attribute handling
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 4cb9e1ddaa145be9ed67b6a7de98ca705a43f998 ]
Coverity reported a memory corruption error for the fdmi attributes routines:
CID 15768 [Memory Corruption] Out-of-bounds access on FDMI
Sloppy coding of the fmdi structures. In both the lpfc_fdmi_attr_def and lpfc_fdmi_reg_port_list structures, a field was placed at the start of payload that may have variable content. The field was given an arbitrary type (uint32_t). The code then uses the field name to derive an address, which it used in things such as memset and memcpy. The memset sizes or memcpy lengths were larger than the arbitrary type, thus coverity reported an error.
Fix by replacing the arbitrary fields with the real field structures describing the payload.
--- drivers/scsi/lpfc/lpfc_ct.c | 137 ++++++++++++++++++------------------ drivers/scsi/lpfc/lpfc_hw.h | 36 +++++----- 2 files changed, 85 insertions(+), 88 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +69 -68
@@ -1737,8 +1737,8 @@ lpfc_fdmi_hba_attr_wwnn(struct lpfc_vport *vport, struct lpfc_fdmi_attr_def *ad)struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,sizeof (struct lpfc_name )); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrWWN, &vport->fc_sparam.nodeName,sizeof (struct lpfc_name ));
@@ -1754,8 +1754,8 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));/* This string MUST be consistent with other FC platforms * supported by Broadcom.
@@ -1779,8 +1779,8 @@ lpfc_fdmi_hba_attr_sn(struct lpfc_vport *vport, struct lpfc_fdmi_attr_def *ad)struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString, phba->SerialNumber,sizeof (ae->un.AttrString));
@@ -1801,8 +1801,8 @@ lpfc_fdmi_hba_attr_model(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString, phba->ModelName,sizeof (ae->un.AttrString));
@@ -1822,8 +1822,8 @@ lpfc_fdmi_hba_attr_description(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString, phba->ModelDesc,sizeof (ae->un.AttrString));
@@ -1845,8 +1845,8 @@ lpfc_fdmi_hba_attr_hdw_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t i, j, incr, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));/* Convert JEDEC ID to ascii for hardware version */ incr = vp->rev.biuRev;
@@ -1875,8 +1875,8 @@ lpfc_fdmi_hba_attr_drvr_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString, lpfc_release_version,sizeof (ae->un.AttrString));
@@ -1897,8 +1897,8 @@ lpfc_fdmi_hba_attr_rom_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));if (phba->sli_rev ==LPFC_SLI_REV4 )lpfc_decode_firmware_rev (phba, ae->un.AttrString,1 );
@@ -1922,8 +1922,8 @@ lpfc_fdmi_hba_attr_fmw_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));lpfc_decode_firmware_rev (phba, ae->un.AttrString,1 ); len = strnlen(ae->un.AttrString,
@@ -1942,8 +1942,8 @@ lpfc_fdmi_hba_attr_os_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae)); snprintf(ae->un.AttrString, sizeof(ae->un.AttrString), "%s %s %s", init_utsname()->sysname,
@@ -1965,7 +1965,7 @@ lpfc_fdmi_hba_attr_ct_len(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =cpu_to_be32 (LPFC_MAX_CT_SIZE ); size =FOURBYTES +sizeof (uint32_t );
@@ -1981,8 +1981,8 @@ lpfc_fdmi_hba_attr_symbolic_name(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae)); len =lpfc_vport_symbolic_node_name (vport, ae->un.AttrString,256 );
@@ -2000,7 +2000,7 @@ lpfc_fdmi_hba_attr_vendor_info(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;/* Nothing is defined for this currently */ ae->un.AttrInt =cpu_to_be32 (0 );
@@ -2017,7 +2017,7 @@ lpfc_fdmi_hba_attr_num_ports(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;/* Each driver instance corresponds to a single port */ ae->un.AttrInt =cpu_to_be32 (1 );
@@ -2034,8 +2034,8 @@ lpfc_fdmi_hba_attr_fabric_wwnn(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,sizeof (struct lpfc_name )); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrWWN, &vport->fabric_nodename,sizeof (struct lpfc_name ));
@@ -2053,8 +2053,8 @@ lpfc_fdmi_hba_attr_bios_ver(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));lpfc_decode_firmware_rev (phba, ae->un.AttrString,1 ); len = strnlen(ae->un.AttrString,
@@ -2073,7 +2073,7 @@ lpfc_fdmi_hba_attr_bios_state(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;/* Driver doesn't have access to this information */ ae->un.AttrInt =cpu_to_be32 (0 );
@@ -2090,8 +2090,8 @@ lpfc_fdmi_hba_attr_vendor_id(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString,"EMULEX" ,sizeof (ae->un.AttrString));
@@ -2112,8 +2112,8 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,32 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae)); ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */
@@ -2134,7 +2134,7 @@ lpfc_fdmi_port_attr_support_speed(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =0 ;if (!(phba->hba_flag &HBA_FCOE_MODE )) {
@@ -2186,7 +2186,7 @@ lpfc_fdmi_port_attr_speed(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;if (!(phba->hba_flag &HBA_FCOE_MODE )) {switch (phba->fc_linkspeed) {
@@ -2253,7 +2253,7 @@ lpfc_fdmi_port_attr_max_frame(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; hsp = (struct serv_parm *)&vport->fc_sparam; ae->un.AttrInt = (((uint32_t) hsp->cmn.bbRcvSizeMsb) << 8) |
@@ -2273,8 +2273,8 @@ lpfc_fdmi_port_attr_os_devname(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));snprintf (ae->un.AttrString,sizeof (ae->un.AttrString),"/sys/class/scsi_host/host%d" , shost->host_no);
@@ -2294,8 +2294,8 @@ lpfc_fdmi_port_attr_host_name(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));snprintf (ae->un.AttrString,sizeof (ae->un.AttrString),"%s" ,init_utsname ()->nodename);
@@ -2315,8 +2315,8 @@ lpfc_fdmi_port_attr_wwnn(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,sizeof (struct lpfc_name )); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrWWN, &vport->fc_sparam.nodeName,sizeof (struct lpfc_name ));
@@ -2333,8 +2333,8 @@ lpfc_fdmi_port_attr_wwpn(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,sizeof (struct lpfc_name )); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrWWN, &vport->fc_sparam.portName,sizeof (struct lpfc_name ));
@@ -2351,8 +2351,8 @@ lpfc_fdmi_port_attr_symbolic_name(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae)); len =lpfc_vport_symbolic_port_name (vport, ae->un.AttrString,256 ); len += (len &3 ) ? (4 - (len &3 )) :4 ;
@@ -2370,7 +2370,7 @@ lpfc_fdmi_port_attr_port_type(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;if (phba->fc_topology ==LPFC_TOPOLOGY_LOOP ) ae->un.AttrInt =cpu_to_be32 (LPFC_FDMI_PORTTYPE_NLPORT );else
@@ -2388,7 +2388,7 @@ lpfc_fdmi_port_attr_class(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =cpu_to_be32 (FC_COS_CLASS2 |FC_COS_CLASS3 ); size =FOURBYTES +sizeof (uint32_t ); ad->AttrLen =cpu_to_be16 (size);
@@ -2403,8 +2403,8 @@ lpfc_fdmi_port_attr_fabric_wwpn(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,sizeof (struct lpfc_name )); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrWWN, &vport->fabric_portname,sizeof (struct lpfc_name ));
@@ -2421,8 +2421,8 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,32 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae)); ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */
@@ -2442,7 +2442,7 @@ lpfc_fdmi_port_attr_port_state(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;/* Link Up - operational */ ae->un.AttrInt =cpu_to_be32 (LPFC_FDMI_PORTSTATE_ONLINE ); size =FOURBYTES +sizeof (uint32_t );
@@ -2458,7 +2458,7 @@ lpfc_fdmi_port_attr_num_disc(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; vport->fdmi_num_disc =lpfc_find_map_node (vport); ae->un.AttrInt =cpu_to_be32 (vport->fdmi_num_disc); size =FOURBYTES +sizeof (uint32_t );
@@ -2474,7 +2474,7 @@ lpfc_fdmi_port_attr_nportid(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =cpu_to_be32 (vport->fc_myDID); size =FOURBYTES +sizeof (uint32_t ); ad->AttrLen =cpu_to_be16 (size);
@@ -2489,8 +2489,8 @@ lpfc_fdmi_smart_attr_service(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString,"Smart SAN Initiator" ,sizeof (ae->un.AttrString));
@@ -2510,8 +2510,8 @@ lpfc_fdmi_smart_attr_guid(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));memcpy (&ae->un.AttrString, &vport->fc_sparam.nodeName,sizeof (struct lpfc_name ));
@@ -2531,8 +2531,8 @@ lpfc_fdmi_smart_attr_version(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString,"Smart SAN Version 2.0" ,sizeof (ae->un.AttrString));
@@ -2553,8 +2553,8 @@ lpfc_fdmi_smart_attr_model(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t len, size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; -memset (ae,0 ,256 ); + ae = &ad->AttrValue; +memset (ae,0 ,sizeof (*ae));strncpy (ae->un.AttrString, phba->ModelName,sizeof (ae->un.AttrString));
@@ -2573,7 +2573,7 @@ lpfc_fdmi_smart_attr_port_info(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue;/* SRIOV (type 3) is not supported */ if (vport->vpi)
@@ -2593,7 +2593,7 @@ lpfc_fdmi_smart_attr_qos(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =cpu_to_be32 (0 ); size =FOURBYTES +sizeof (uint32_t ); ad->AttrLen =cpu_to_be16 (size);
@@ -2608,7 +2608,7 @@ lpfc_fdmi_smart_attr_security(struct lpfc_vport *vport,struct lpfc_fdmi_attr_entry *ae;uint32_t size; - ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; + ae = &ad->AttrValue; ae->un.AttrInt =cpu_to_be32 (1 ); size =FOURBYTES +sizeof (uint32_t ); ad->AttrLen =cpu_to_be16 (size);
@@ -2756,7 +2756,8 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* Registered Port List */ /* One entry (port) per adapter */ rh->rpl.EntryCnt =cpu_to_be32 (1 ); -memcpy (&rh->rpl.pe, &phba->pport->fc_sparam.portName, +memcpy (&rh->rpl.pe.PortName, + &phba->pport->fc_sparam.portName,sizeof (struct lpfc_name ));/* point to the HBA attribute block */
drivers/scsi/lpfc/lpfc_hw.h +16 -20
@@ -1333,25 +1333,8 @@ struct fc_rdp_res_frame {/* lpfc_sli_ct_request defines the CT_IU preamble for FDMI commands */ #define SLI_CT_FDMI_Subtypes 0x10/* Management Service Subtype */ -/* -* Registered Port List Format -*/ -struct lpfc_fdmi_reg_port_list { -uint32_t EntryCnt; -uint32_t pe;/* Variable-length array */ -}; - -/* Definitions for HBA / Port attribute entries */ -struct lpfc_fdmi_attr_def {/* Defined in TLV format */ -/* Structure is in Big Endian format */ -uint32_t AttrType:16 ; -uint32_t AttrLen:16 ; -uint32_t AttrValue;/* Marks start of Value (ATTRIBUTE_ENTRY) */ -}; - -/* Attribute Entry */ struct lpfc_fdmi_attr_entry { union {
@@ -1362,7 +1345,13 @@ struct lpfc_fdmi_attr_entry { } un; }; -#define LPFC_FDMI_MAX_AE_SIZE sizeof(struct lpfc_fdmi_attr_entry) +struct lpfc_fdmi_attr_def {/* Defined in TLV format */ +/* Structure is in Big Endian format */ +uint32_t AttrType:16 ; +uint32_t AttrLen:16 ; +/* Marks start of Value (ATTRIBUTE_ENTRY) */ +struct lpfc_fdmi_attr_entry AttrValue; +} __packed;/* * HBA Attribute Block
@@ -1386,13 +1375,20 @@ struct lpfc_fdmi_hba_ident {struct lpfc_name PortName; }; +/* +* Registered Port List Format +*/ +struct lpfc_fdmi_reg_port_list { +uint32_t EntryCnt; +struct lpfc_fdmi_port_entry pe; +} __packed; +/* * Register HBA(RHBA) */ struct lpfc_fdmi_reg_hba {struct lpfc_fdmi_hba_ident hi; -struct lpfc_fdmi_reg_port_list rpl;/* variable-length array */ -/* struct lpfc_fdmi_attr_block ab; */ +struct lpfc_fdmi_reg_port_list rpl; };/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 100/245 mm: avoid data corruption on CoW fault into PFN-mapped VMA
In reply to Greg Kroah-HartmanFrom: Kirill A. Shutemov <[email protected]>
[ Upstream commit c3e5ea6ee574ae5e845a40ac8198de1fb63bb3ab ]
Jeff Moyer has reported that one of xfstests triggers a warning when run on DAX-enabled filesystem:
WARNING: CPU: 76 PID: 51024 at mm/memory.c:2317 wp_page_copy+0xc40/0xd50 ... wp_page_copy+0x98c/0xd50 (unreliable) do_wp_page+0xd8/0xad0 __handle_mm_fault+0x748/0x1b90 handle_mm_fault+0x120/0x1f0 __do_page_fault+0x240/0xd70 do_page_fault+0x38/0xd0 handle_page_fault+0x10/0x30
The warning happens on failed __copy_from_user_inatomic() which tries to copy data into a CoW page.
This happens because of race between MADV_DONTNEED and CoW page fault:
CPU0 CPU1
handle_mm_fault()
do_wp_page()
wp_page_copy()
do_wp_page()
madvise(MADV_DONTNEED)
zap_page_range()
zap_pte_range()
ptep_get_and_clear_full()
<TLB flush>
__copy_from_user_inatomic()
sees empty PTE and fails
WARN_ON_ONCE(1)
clear_page()The solution is to re-try __copy_from_user_inatomic() under PTL after checking that PTE is matches the orig_pte.
The second copy attempt can still fail, like due to non-readable PTE, but there's nothing reasonable we can do about, except clearing the CoW page.
--- mm/memory.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)
mm/memory.c +27 -8
@@ -2353,7 +2353,7 @@ static inline bool cow_user_page(struct page *dst, struct page *src,bool ret;void *kaddr;void __user *uaddr; -bool force_mkyoung; +bool locked = false;struct vm_area_struct *vma = vmf->vma;struct mm_struct *mm = vma->vm_mm;unsigned long addr = vmf->address;
@@ -2378,11 +2378,11 @@ static inline bool cow_user_page(struct page *dst, struct page *src,* On architectures with software "accessed" bits, we would * take a double page fault, so mark it accessed here. */ - force_mkyoung =arch_faults_on_old_pte () && !pte_young (vmf->orig_pte); -if (force_mkyoung) { +if (arch_faults_on_old_pte () && !pte_young (vmf->orig_pte)) {pte_t entry; vmf->pte =pte_offset_map_lock (mm, vmf->pmd, addr, &vmf->ptl); + locked = true;if (!likely (pte_same (*vmf->pte, vmf->orig_pte))) {/* * Other thread has already handled the fault
@@ -2406,18 +2406,37 @@ static inline bool cow_user_page(struct page *dst, struct page *src,* zeroes. */ if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) { +if (locked) + goto warn; + +/* Re-validate under PTL if the page is still mapped */ + vmf->pte =pte_offset_map_lock (mm, vmf->pmd, addr, &vmf->ptl); + locked = true; +if (!likely (pte_same (*vmf->pte, vmf->orig_pte))) { +/* The PTE changed under us. Retry page fault. */ + ret = false; + goto pte_unlock; + } +/* -* Give a warn in case there can be some obscure -* use-case +* The same page can be mapped back since last copy attampt. +* Try to copy again under PTL. */ -WARN_ON_ONCE (1 ); -clear_page (kaddr); +if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) { +/* +* Give a warn in case there can be some obscure +* use-case +*/ +warn: +WARN_ON_ONCE (1 ); +clear_page (kaddr); + } } ret = true; pte_unlock: -if (force_mkyoung) +if (locked)pte_unmap_unlock (vmf->pte, vmf->ptl);kunmap_atomic (kaddr);flush_dcache_page (dst);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 101/245 drm/amdgpu: increase atombios cmd timeout
In reply to Greg Kroah-HartmanFrom: John Clements <[email protected]>
[ Upstream commit 1b3460a8b19688ad3033b75237d40fa580a5a953 ]
mitigates race condition on BACO reset between GPU bootcode and driver reload
--- drivers/gpu/drm/amd/amdgpu/atom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/atom.c +2 -2
@@ -742,8 +742,8 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) cjiffies = jiffies;if (time_after (cjiffies, ctx->last_jump_jiffies)) { cjiffies -= ctx->last_jump_jiffies; -if ((jiffies_to_msecs (cjiffies) >5000 )) { -DRM_ERROR ("atombios stuck in loop for more than 5secs aborting\n" ); +if ((jiffies_to_msecs (cjiffies) >10000 )) { +DRM_ERROR ("atombios stuck in loop for more than 10secs aborting\n" ); ctx->abort = true; } }else {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 97/245 timekeeping: Prevent 32bit truncation in scale64_check_overflow()
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
[ Upstream commit 4cbbc3a0eeed675449b1a4d080008927121f3da3 ]
While unlikely the divisor in scale64_check_overflow() could be >= 32bit in scale64_check_overflow(). do_div() truncates the divisor to 32bit at least on 32bit platforms.
Use div64_u64() instead to avoid the truncation to 32-bit.
[ tglx: Massaged changelog ]
--- kernel/time/timekeeping.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/time/timekeeping.c +1 -2
@@ -1004,9 +1004,8 @@ static int scale64_check_overflow(u64 mult, u64 div, u64 *base) ((int)sizeof(u64)*8 - fls64(mult) < fls64(rem))) return -EOVERFLOW; tmp *= mult; - rem *= mult; -do_div (rem, div); + rem =div64_u64 (rem * mult, div); *base = tmp + rem;return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 95/245 media: go7007: Fix URB type for interrupt handling
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit a3ea410cac41b19a5490aad7fe6d9a9a772e646e ]
Josef reported that his old-and-good Plextor ConvertX M402U video converter spews lots of WARNINGs on the recent kernels, and it turned out that the device uses a bulk endpoint for interrupt handling just like 2250 board.
For fixing it, generalize the check with the proper verification of the endpoint instead of hard-coded board type check.
--- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/go7007/go7007-usb.c +3 -1
@@ -1052,6 +1052,7 @@ static int go7007_usb_probe(struct usb_interface *intf,struct go7007_usb *usb;const struct go7007_usb_board *board;struct usb_device *usbdev =interface_to_usbdev (intf); +struct usb_host_endpoint *ep;unsigned num_i2c_devs;char *name;int video_pipe, i, v_urb_len;
@@ -1148,7 +1149,8 @@ static int go7007_usb_probe(struct usb_interface *intf,if (usb->intr_urb->transfer_buffer ==NULL ) goto allocfail; -if (go->board_id ==GO7007_BOARDID_SENSORAY_2250 ) + ep = usb->usbdev->ep_in[4 ]; +if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) usb_fill_bulk_urb(usb->intr_urb, usb->usbdev, usb_rcvbulkpipe(usb->usbdev, 4), usb->intr_urb->transfer_buffer, 2*sizeof(u16),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 98/245 ext4: fix a data race at inode->i_disksize
In reply to Greg Kroah-HartmanFrom: Qiujun Huang <[email protected]>
[ Upstream commit dce8e237100f60c28cc66effb526ba65a01d8cb3 ]
KCSAN find inode->i_disksize could be accessed concurrently.
BUG: KCSAN: data-race in ext4_mark_iloc_dirty / ext4_write_end
write (marked) to 0xffff8b8932f40090 of 8 bytes by task 66792 on cpu 0:
ext4_write_end+0x53f/0x5b0 ext4_da_write_end+0x237/0x510 generic_perform_write+0x1c4/0x2a0 ext4_buffered_write_iter+0x13a/0x210 ext4_file_write_iter+0xe2/0x9b0 new_sync_write+0x29c/0x3a0 __vfs_write+0x92/0xa0 vfs_write+0xfc/0x2a0 ksys_write+0xe8/0x140 __x64_sys_write+0x4c/0x60 do_syscall_64+0x8a/0x2a0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff8b8932f40090 of 8 bytes by task 14414 on cpu 1:
ext4_mark_iloc_dirty+0x716/0x1190 ext4_mark_inode_dirty+0xc9/0x360 ext4_convert_unwritten_extents+0x1bc/0x2a0 ext4_convert_unwritten_io_end_vec+0xc5/0x150 ext4_put_io_end+0x82/0x130 ext4_writepages+0xae7/0x16f0 do_writepages+0x64/0x120 __writeback_single_inode+0x7d/0x650 writeback_sb_inodes+0x3a4/0x860 __writeback_inodes_wb+0xc4/0x150 wb_writeback+0x43f/0x510 wb_workfn+0x3b2/0x8a0 process_one_work+0x39b/0x7e0 worker_thread+0x88/0x650 kthread+0x1d4/0x1f0 ret_from_fork+0x35/0x40
The plain read is outside of inode->i_data_sem critical section which results in a data race. Fix it by adding READ_ONCE().
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -5315,7 +5315,7 @@ static int ext4_do_update_inode(handle_t *handle, raw_inode->i_file_acl_high =cpu_to_le16 (ei->i_file_acl >>32 ); raw_inode->i_file_acl_lo =cpu_to_le32 (ei->i_file_acl); -if (ei->i_disksize !=ext4_isize (inode->i_sb, raw_inode)) { +if (READ_ONCE (ei->i_disksize) !=ext4_isize (inode->i_sb, raw_inode)) {ext4_isize_set (raw_inode, ei->i_disksize); need_datasync =1 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 96/245 Bluetooth: guard against controllers sending zerod events
In reply to Greg Kroah-HartmanFrom: Alain Michaud <[email protected]>
[ Upstream commit 08bb4da90150e2a225f35e0f642cdc463958d696 ]
Some controllers have been observed to send zero'd events under some conditions. This change guards against this condition as well as adding a trace to facilitate diagnosability of this condition.
--- net/bluetooth/hci_event.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bluetooth/hci_event.c +6 -0
@@ -5738,6 +5738,11 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)u8 status =0 , event = hdr->evt, req_evt =0 ;u16 opcode =HCI_OP_NOP ; +if (!event) { +bt_dev_warn (hdev,"Received unexpected HCI Event 00000000" ); + goto done; + } +if (hdev->sent_cmd &&bt_cb (hdev->sent_cmd)->hci.req_event == event) {struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data; opcode =__le16_to_cpu (cmd_hdr->opcode);
@@ -5949,6 +5954,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)req_complete_skb (hdev, status, opcode, orig_skb); } +done:kfree_skb (orig_skb);kfree_skb (skb); hdev->stat.evt_rx++;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 94/245 bus: hisi_lpc: Fixup IO ports addresses to avoid use-after-free in host removal
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit a6dd255bdd7d00bbdbf78ba00bde9fc64f86c3a7 ]
Some released ACPI FW for Huawei boards describes incorrect the port IO address range for child devices, in that it tells us the IO port max range is 0x3fff for each child device, which is not correct. The address range should be [e4:e8) or similar. With this incorrect upper range, the child device IO port resources overlap.
As such, the kernel thinks that the LPC host serial device is a child of the IPMI device:
root@(none)$ more /proc/ioports
[...]
00ffc0e3-00ffffff : hisi-lpc-ipmi.0.auto
00ffc0e3-00ffc0e3 : ipmi_si
00ffc0e4-00ffc0e4 : ipmi_si
00ffc0e5-00ffc0e5 : ipmi_si
00ffc2f7-00ffffff : serial8250.1.auto
00ffc2f7-00ffc2fe : serial
root@(none)$They should both be siblings. Note that these are logical PIO addresses, which have a direct mapping from the FW IO port ranges.
This shows up as a real issue when we enable CONFIG_KASAN and CONFIG_DEBUG_TEST_DRIVER_REMOVE - we see use-after-free warnings in the host removal path:
==================================================================
BUG: KASAN: use-after-free in release_resource+0x38/0xc8 Read of size 8 at addr ffff0026accdbc38 by task swapper/0/1 CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc6-00001-g68e186e77b5c-dirty #1593 Hardware name: Huawei Taishan 2180 /D03, BIOS Hisilicon D03 IT20 Nemo 2.0 RC0 03/30/2018 Call trace: dump_backtrace+0x0/0x290 show_stack+0x14/0x20 dump_stack+0xf0/0x14c print_address_description.isra.9+0x6c/0x3b8 __kasan_report+0x12c/0x23c kasan_report+0xc/0x18 __asan_load8+0x94/0xb8 release_resource+0x38/0xc8 platform_device_del.part.10+0x80/0xe0 platform_device_unregister+0x20/0x38 hisi_lpc_acpi_remove_subdev+0x10/0x20 device_for_each_child+0xc8/0x128 hisi_lpc_acpi_remove+0x4c/0xa8 hisi_lpc_remove+0xbc/0xc0 platform_drv_remove+0x3c/0x68 really_probe+0x174/0x548 driver_probe_device+0x7c/0x148 device_driver_attach+0x94/0xa0 __driver_attach+0xa4/0x110 bus_for_each_dev+0xe8/0x158 driver_attach+0x30/0x40 bus_add_driver+0x234/0x2f0 driver_register+0xbc/0x1d0 __platform_driver_register+0x7c/0x88 hisi_lpc_driver_init+0x18/0x20 do_one_initcall+0xb4/0x258 kernel_init_freeable+0x248/0x2c0 kernel_init+0x10/0x118 ret_from_fork+0x10/0x1c
...
The issue here is that the kernel created an incorrect parent-child resource dependency between two devices, and references the false parent node when deleting the second child device, when it had been deleted already.
Fix up the child device resources from FW to create proper IO port resource relationships for broken FW.
With this, the IO port layout looks more healthy:
root@(none)$ more /proc/ioports [...] 00ffc0e3-00ffc0e7 : hisi-lpc-ipmi.0.auto 00ffc0e3-00ffc0e3 : ipmi_si 00ffc0e4-00ffc0e4 : ipmi_si 00ffc0e5-00ffc0e5 : ipmi_si 00ffc2f7-00ffc2ff : serial8250.1.auto 00ffc2f7-00ffc2fe : serial
--- drivers/bus/hisi_lpc.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/bus/hisi_lpc.c +25 -2
@@ -358,6 +358,26 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,return 0 ; } +/* +* Released firmware describes the IO port max address as 0x3fff, which is +* the max host bus address. Fixup to a proper range. This will probably +* never be fixed in firmware. +*/ +static void hisi_lpc_acpi_fixup_child_resource (struct device *hostdev, +struct resource *r) +{ +if (r->end !=0x3fff ) +return ; + +if (r->start ==0xe4 ) + r->end =0xe4 +0x04 -1 ; +else if (r->start ==0x2f8 ) + r->end =0x2f8 +0x08 -1 ; +else +dev_warn (hostdev,"unrecognised resource %pR to fixup, ignoring\n" , + r); +} +/* * hisi_lpc_acpi_set_io_res - set the resources for a child * @child: the device node to be updated the I/O resource
@@ -419,8 +439,11 @@ static int hisi_lpc_acpi_set_io_res(struct device *child,return -ENOMEM ; } count =0 ; -list_for_each_entry (rentry, &resource_list, node) - resources[count++] = *rentry->res; +list_for_each_entry (rentry, &resource_list, node) { + resources[count] = *rentry->res; +hisi_lpc_acpi_fixup_child_resource (hostdev, &resources[count]); + count++; + }acpi_dev_free_resource_list (&resource_list);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 92/245 firmware: arm_sdei: Use cpus_read_lock() to avoid races with cpuhp
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
[ Upstream commit 54f529a6806c9710947a4f2cdc15d6ea54121ccd ]
SDEI has private events that need registering and enabling on each CPU. CPUs can come and go while we are trying to do this. SDEI tries to avoid these problems by setting the reregister flag before the register call, so any CPUs that come online register the event too. Sticking plaster like this doesn't work, as if the register call fails, a CPU that subsequently comes online will register the event before reregister is cleared.
Take cpus_read_lock() around the register and enable calls. We don't want surprise CPUs to do the wrong thing if they race with these calls failing.
--- drivers/firmware/arm_sdei.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/firmware/arm_sdei.c +14 -12
@@ -410,14 +410,19 @@ int sdei_event_enable(u32 event_num)return -ENOENT ; } -spin_lock (&sdei_list_lock); - event->reenable = true; -spin_unlock (&sdei_list_lock); +cpus_read_lock ();if (event->type ==SDEI_EVENT_TYPE_SHARED ) err =sdei_api_event_enable (event->event_num);else err =sdei_do_cross_call (_local_event_enable, event); + +if (!err) { +spin_lock (&sdei_list_lock); + event->reenable = true; +spin_unlock (&sdei_list_lock); + } +cpus_read_unlock ();mutex_unlock (&sdei_events_lock);return err;
@@ -619,21 +624,18 @@ int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg)break ; } -spin_lock (&sdei_list_lock); - event->reregister = true; -spin_unlock (&sdei_list_lock); - +cpus_read_lock (); err =_sdei_event_register (event);if (err) { -spin_lock (&sdei_list_lock); - event->reregister = false; - event->reenable = false; -spin_unlock (&sdei_list_lock); -sdei_event_destroy (event);pr_warn ("Failed to register event %u: %d\n" , event_num, err); + }else { +spin_lock (&sdei_list_lock); + event->reregister = true; +spin_unlock (&sdei_list_lock); } +cpus_read_unlock (); }while (0 );mutex_unlock (&sdei_events_lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 75/245 scsi: lpfc: Fix RQ buffer leakage when no IOCBs available
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 39c4f1a965a9244c3ba60695e8ff8da065ec6ac4 ]
The driver is occasionally seeing the following SLI Port error, requiring reset and reinit:
Port Status Event: ... error 1=0x52004a01, error 2=0x218
The failure means an RQ timeout. That is, the adapter had received asynchronous receive frames, ran out of buffer slots to place the frames, and the driver did not replenish the buffer slots before a timeout occurred. The driver should not be so slow in replenishing buffers that a timeout can occur.
When the driver received all the frames of a sequence, it allocates an IOCB to put the frames in. In a situation where there was no IOCB available for the frame of a sequence, the RQ buffer corresponding to the first frame of the sequence was not returned to the FW. Eventually, with enough traffic encountering the situation, the timeout occurred.
Fix by releasing the buffer back to firmware whenever there is no IOCB for the first frame.
[mkp: typo]
--- drivers/scsi/lpfc/lpfc_sli.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +4 -0
@@ -17413,6 +17413,10 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)list_add_tail (&iocbq->list, &first_iocbq->list); } } +/* Free the sequence's header buffer */ +if (!first_iocbq) +lpfc_in_buf_free (vport->phba, &seq_dmabuf->dbuf); +return first_iocbq; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 87/245 x86/pkeys: Add check for pkey "overflow"
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit 16171bffc829272d5e6014bad48f680cb50943d9 ]
Alex Shi reported the pkey macros above arch_set_user_pkey_access() to be unused. They are unused, and even refer to a nonexistent CONFIG option.
But, they might have served a good use, which was to ensure that the code does not try to set values that would not fit in the PKRU register. As it stands, a too-large 'pkey' value would be likely to silently overflow the u32 new_pkru_bits.
Add a check to look for overflows. Also add a comment to remind any future developer to closely examine the types used to store pkey values if arch_max_pkey() ever changes.
This boots and passes the x86 pkey selftests.
--- arch/x86/include/asm/pkeys.h | 5 +++++ arch/x86/kernel/fpu/xstate.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
arch/x86/include/asm/pkeys.h +5 -0
@@ -4,6 +4,11 @@#define ARCH_DEFAULT_PKEY 0 +/* +* If more than 16 keys are ever supported, a thorough audit +* will be necessary to ensure that the types that store key +* numbers and masks have sufficient capacity. +*/ #define arch_max_pkey () (boot_cpu_has(X86_FEATURE_OSPKE) ? 16 : 1) extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
arch/x86/kernel/fpu/xstate.c +7 -2
@@ -907,8 +907,6 @@ const void *get_xsave_field_ptr(int xsave_state)#ifdef CONFIG_ARCH_HAS_PKEYS -#define NR_VALID_PKRU_BITS (CONFIG_NR_PROTECTION_KEYS * 2) -#define PKRU_VALID_MASK (NR_VALID_PKRU_BITS - 1)/* * This will go out and modify PKRU register to set the access * rights for @pkey to @init_val.
@@ -927,6 +925,13 @@ int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,if (!boot_cpu_has (X86_FEATURE_OSPKE ))return -EINVAL ; +/* +* This code should only be called with valid 'pkey' +* values originating from in-kernel users. Complain +* if a bad value is observed. +*/ +WARN_ON_ONCE (pkey >=arch_max_pkey ()); +/* Set the bits we need in PKRU: */ if (init_val &PKEY_DISABLE_ACCESS ) new_pkru_bits |=PKRU_AD_BIT ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 88/245 bpf: Remove recursion prevention from rcu free callback
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 8a37963c7ac9ecb7f86f8ebda020e3f8d6d7b8a0 ]
If an element is freed via RCU then recursion into BPF instrumentation functions is not a concern. The element is already detached from the map and the RCU callback does not hold any locks on which a kprobe, perf event or tracepoint attached BPF program could deadlock.
--- kernel/bpf/hashtab.c | 8 -------- 1 file changed, 8 deletions(-)
kernel/bpf/hashtab.c +0 -8
@@ -667,15 +667,7 @@ static void htab_elem_free_rcu(struct rcu_head *head) struct htab_elem *l = container_of(head, struct htab_elem, rcu);struct bpf_htab *htab = l->htab; -/* must increment bpf_prog_active to avoid kprobe+bpf triggering while -* we're calling kfree, otherwise deadlock is possible if kprobes -* are placed somewhere inside of slub -*/ -preempt_disable (); -__this_cpu_inc (bpf_prog_active);htab_elem_free (htab, l); -__this_cpu_dec (bpf_prog_active); -preempt_enable (); }static void htab_put_fd_value (struct bpf_htab *htab,struct htab_elem *l)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 90/245 dmaengine: tegra-apb: Prevent race conditions on channels freeing
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 8e84172e372bdca20c305d92d51d33640d2da431 ]
It's incorrect to check the channel's "busy" state without taking a lock. That shouldn't cause any real troubles, nevertheless it's always better not to have any race conditions in the code.
--- drivers/dma/tegra20-apb-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/tegra20-apb-dma.c +1 -2
@@ -1225,8 +1225,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)dev_dbg (tdc2dev (tdc),"Freeing channel %d\n" , tdc->id); -if (tdc->busy) -tegra_dma_terminate_all (dc); +tegra_dma_terminate_all (dc);spin_lock_irqsave (&tdc->lock, flags);list_splice_init (&tdc->pending_sg_req, &sg_req_list);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 91/245 drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
[ Upstream commit 6a6c4a4d459ecacc9013c45dcbf2bc9747fdbdbd ]
[Why]
Since the i2c payload allocation can fail need to check return codes
[How]
Clean up i2c payload allocations and check for errors
--- .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +25 -27
@@ -127,22 +127,16 @@ struct aux_payloads {struct vector payloads; }; -static struct i2c_payloads *dal_ddc_i2c_payloads_create (struct dc_context *ctx,uint32_t count) +static bool dal_ddc_i2c_payloads_create ( +struct dc_context *ctx, +struct i2c_payloads *payloads, +uint32_t count) { -struct i2c_payloads *payloads; - - payloads =kzalloc (sizeof (struct i2c_payloads ),GFP_KERNEL ); - -if (!payloads) -return NULL ; -if (dal_vector_construct ( &payloads->payloads, ctx, count,sizeof (struct i2c_payload ))) -return payloads; - -kfree (payloads); -return NULL ; +return true; +return false; }static struct i2c_payload *dal_ddc_i2c_payloads_get (struct i2c_payloads *p)
@@ -155,14 +149,12 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)return p->payloads.count; } -static void dal_ddc_i2c_payloads_destroy (struct i2c_payloads **p) +static void dal_ddc_i2c_payloads_destroy (struct i2c_payloads *p) { -if (!p || !*p) +if (!p)return ; -dal_vector_destruct (&(*p)->payloads); -kfree (*p); - *p =NULL ; +dal_vector_destruct (&p->payloads); }static struct aux_payloads *dal_ddc_aux_payloads_create (struct dc_context *ctx,uint32_t count)
@@ -580,9 +572,13 @@ bool dal_ddc_service_query_ddc_data(uint32_t payloads_num = write_payloads + read_payloads; +if (write_size >EDID_SEGMENT_SIZE || read_size >EDID_SEGMENT_SIZE )return false; +if (!payloads_num) +return false; +/*TODO: len of payload data for i2c and aux is uint8!!!!, * but we want to read 256 over i2c!!!!*/ if (dal_ddc_service_is_in_aux_transaction_mode (ddc)) {
@@ -613,23 +609,25 @@ bool dal_ddc_service_query_ddc_data(dal_ddc_aux_payloads_destroy (&payloads); }else { -struct i2c_payloads *payloads = -dal_ddc_i2c_payloads_create (ddc->ctx, payloads_num); +struct i2c_command command = {0 }; +struct i2c_payloads payloads; -struct i2c_command command = { - .payloads =dal_ddc_i2c_payloads_get (payloads), - .number_of_payloads =0 , - .engine =DDC_I2C_COMMAND_ENGINE , - .speed = ddc->ctx->dc->caps.i2c_speed_in_khz }; +if (!dal_ddc_i2c_payloads_create (ddc->ctx, &payloads, payloads_num)) +return false; + + command.payloads =dal_ddc_i2c_payloads_get (&payloads); + command.number_of_payloads =0 ; + command.engine =DDC_I2C_COMMAND_ENGINE ; + command.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;dal_ddc_i2c_payloads_add ( - payloads, address, write_size, write_buf, true); + &payloads, address, write_size, write_buf, true);dal_ddc_i2c_payloads_add ( - payloads, address, read_size, read_buf, false); + &payloads, address, read_size, read_buf, false); command.number_of_payloads = -dal_ddc_i2c_payloads_get_count (payloads); +dal_ddc_i2c_payloads_get_count (&payloads); ret = dm_helpers_submit_i2c( ddc->ctx,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 89/245 dmaengine: stm32-dma: use vchan_terminate_vdesc() in .terminate_all
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
[ Upstream commit d80cbef35bf89b763f06e03bb4ff8f933bf012c5 ]
To avoid race with vchan_complete, use the race free way to terminate running transfer.
Move vdesc->node list_del in stm32_dma_start_transfer instead of in stm32_mdma_chan_complete to avoid another race in vchan_dma_desc_free_list.
--- drivers/dma/stm32-dma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/dma/stm32-dma.c +6 -3
@@ -494,8 +494,10 @@ static int stm32_dma_terminate_all(struct dma_chan *c)spin_lock_irqsave (&chan->vchan.lock, flags); -if (chan->busy) { -stm32_dma_stop (chan); +if (chan->desc) { +vchan_terminate_vdesc (&chan->desc->vdesc); +if (chan->busy) +stm32_dma_stop (chan); chan->desc =NULL ; }
@@ -551,6 +553,8 @@ static void stm32_dma_start_transfer(struct stm32_dma_chan *chan)if (!vdesc)return ; +list_del (&vdesc->node); + chan->desc =to_stm32_dma_desc (vdesc); chan->next_sg =0 ; }
@@ -628,7 +632,6 @@ static void stm32_dma_handle_chan_done(struct stm32_dma_chan *chan) }else { chan->busy = false;if (chan->next_sg == chan->desc->num_sgs) { -list_del (&chan->desc->vdesc.node);vchan_cookie_complete (&chan->desc->vdesc); chan->desc =NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainercover 4.19.149-rc1 review
This is the start of the stable review cycle for the 4.19.149 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 01 Oct 2020 10:59:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.149-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.149-rc1
Marc Zyngier <[email protected]>
KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch
Jiri Slaby <[email protected]>
ata: sata_mv, avoid trigerrable BUG_ON
Jiri Slaby <[email protected]>
ata: make qc_prep return ata_completion_errors
Jiri Slaby <[email protected]>
ata: define AC_ERR_OK
Muchun Song <[email protected]>
kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
Christian Borntraeger <[email protected]>
s390/zcrypt: Fix ZCRYPT_PERDEV_REQCNT ioctl
Gao Xiang <[email protected]>
mm, THP, swap: fix allocating cluster for swapfile by mistake
Masami Hiramatsu <[email protected]>
kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()
Jan Höppner <[email protected]>
s390/dasd: Fix zero write for FBA devices
Tom Rix <[email protected]>
tracing: fix double free
Tom Lendacky <[email protected]>
KVM: SVM: Add a dedicated INVD intercept routine
Sean Christopherson <[email protected]>
KVM: x86: Reset MMU context if guest toggles CR4.SMAP or CR4.PKE
Wei Li <[email protected]>
MIPS: Add the missing 'CPU_1074K' into __get_cpu_type()
Dmitry Baryshkov <[email protected]>
regmap: fix page selection for noinc reads
Tom Rix <[email protected]>
ALSA: asihpi: fix iounmap in error handler
Yonghong Song <[email protected]>
bpf: Fix a rcu warning for bpffs map pretty-print
Linus Lüssing <[email protected]>
batman-adv: mcast: fix duplicate mcast packets from BLA backbone to mesh
Linus Lüssing <[email protected]>
batman-adv: mcast: fix duplicate mcast packets in BLA backbone from mesh
Sven Eckelmann <[email protected]>
batman-adv: Add missing include for in_interrupt()
Martin Cerveny <[email protected]>
drm/sun4i: sun8i-csc: Secondary CSC register correction
Dmitry Bogdanov <[email protected]>
net: qed: RDMA personality shouldn't fail VF load
Marek Szyprowski <[email protected]>
drm/vc4/vc4_hdmi: fill ASoC card owner
Daniel Borkmann <[email protected]>
bpf: Fix clobbering of r2 in bpf_gen_ld_abs
Eric Dumazet <[email protected]>
mac802154: tx: fix use-after-free
Linus Lüssing <[email protected]>
batman-adv: mcast/TT: fix wrongly dropped or rerouted packets
Jing Xiangfeng <[email protected]>
atm: eni: fix the missed pci_disable_device() for eni_init_one()
Linus Lüssing <[email protected]>
batman-adv: bla: fix type misuse for backbone_gw hash indexing
Maximilian Luz <[email protected]>
mwifiex: Increase AES key storage size to 256 bits
Tianjia Zhang <[email protected]>
clocksource/drivers/h8300_timer8: Fix wrong return value in h8300_8timer_init()
Tom Rix <[email protected]>
ieee802154/adf7242: check status of adf7242_read_reg
Liu Jian <[email protected]>
ieee802154: fix one possible memleak in ca8210_dev_com_init
Josh Poimboeuf <[email protected]>
objtool: Fix noreturn detection for ignored functions
Hans de Goede <[email protected]>
i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()
Dennis Li <[email protected]>
drm/amdkfd: fix a memory leak issue
Sven Schnelle <[email protected]>
lockdep: fix order in trace_hardirqs_off_caller()
Ilya Leoshkevich <[email protected]>
s390/init: add missing __init annotations
Palmer Dabbelt <[email protected]>
RISC-V: Take text_mutex in ftrace_init_nop()
Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN Converter9 2-in-1
Sylwester Nawrocki <[email protected]>
ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions
Sylwester Nawrocki <[email protected]>
ASoC: wm8994: Skip setting of the WM8994_MICBIAS register for WM1811
Anthony Iliopoulos <[email protected]>
nvme: explicitly update mpath disk capacity on revalidation
Tonghao Zhang <[email protected]>
net: openvswitch: use div_u64() for 64-by-32 divisions
Jin Yao <[email protected]>
perf parse-events: Use strcmp() to compare the PMU name
Hou Tao <[email protected]>
ubi: fastmap: Free unused fastmap anchor peb during detach
Qu Wenruo <[email protected]>
btrfs: qgroup: fix data leak caused by race between writeback and truncate
Zeng Tao <[email protected]>
vfio/pci: fix racy on error and request eventfd ctx
Andy Lutomirski <[email protected]>
selftests/x86/syscall_nt: Clear weird flags after each test
Javed Hasan <[email protected]>
scsi: libfc: Skip additional kref updating work event
Javed Hasan <[email protected]>
scsi: libfc: Handling of extra kref
Sagi Grimberg <[email protected]>
nvme: fix possible deadlock when I/O is blocked
Zhang Xiaoxu <[email protected]>
cifs: Fix double add page to memcg when cifs_readpages
Alex Williamson <[email protected]>
vfio/pci: Clear error and request eventfd ctx after releasing
Thomas Gleixner <[email protected]>
x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline
Boris Brezillon <[email protected]>
mtd: parser: cmdline: Support MTD names containing one or more colons
Madhuparna Bhowmik <[email protected]>
rapidio: avoid data race between file operation callbacks and mport_cdev_add().
Qian Cai <[email protected]>
mm/swap_state: fix a data race in swapin_nr_pages
Jeff Layton <[email protected]>
ceph: fix potential race in ceph_check_caps
Dinghao Liu <[email protected]>
PCI: tegra: Fix runtime PM imbalance on error
Dinghao Liu <[email protected]>
mtd: rawnand: omap_elm: Fix runtime PM imbalance on error
Dinghao Liu <[email protected]>
wlcore: fix runtime pm imbalance in wlcore_regdomain_config
Dinghao Liu <[email protected]>
wlcore: fix runtime pm imbalance in wl1271_tx_work
Dinghao Liu <[email protected]>
ASoC: img-i2s-out: Fix runtime PM imbalance on error
Adrian Hunter <[email protected]>
perf kcore_copy: Fix module map when there are no modules loaded
Ian Rogers <[email protected]>
perf metricgroup: Free metric_events on error
Xie XiuQi <[email protected]>
perf util: Fix memory leak of prefix_if_not_in
Jiri Olsa <[email protected]>
perf stat: Fix duration_time value for higher intervals
Ian Rogers <[email protected]>
perf trace: Fix the selection for architectures to generate the errno name tables
Ian Rogers <[email protected]>
perf evsel: Fix 2 memory leaks
Qian Cai <[email protected]>
vfio/pci: fix memory leaks of eventfd ctx
David Sterba <[email protected]>
btrfs: don't force read-only after error in drop snapshot
Yu Chen <[email protected]>
usb: dwc3: Increase timeout for CmdAct cleared by device controller
Shreyas Joshi <[email protected]>
printk: handle blank console arguments passed in.
Dinghao Liu <[email protected]>
drm/nouveau/dispnv50: fix runtime pm imbalance on error
Dinghao Liu <[email protected]>
drm/nouveau: fix runtime pm imbalance on error
Dinghao Liu <[email protected]>
drm/nouveau/debugfs: fix runtime pm imbalance on error
Alexander Duyck <[email protected]>
e1000: Do not perform reset in reset_task if we are already down
Anshuman Khandual <[email protected]>
arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
Wei Yongjun <[email protected]>
scsi: cxlflash: Fix error return code in cxlflash_probe()
Colin Ian King <[email protected]>
USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
Miklos Szeredi <[email protected]>
fuse: don't check refcount after stealing page
Nicholas Piggin <[email protected]>
powerpc/traps: Make unrecoverable NMIs die instead of panic
Takashi Iwai <[email protected]>
ALSA: hda: Fix potential race in unsol event handler
Jonathan Bakker <[email protected]>
tty: serial: samsung: Correct clock selection logic
Tuong Lien <[email protected]>
tipc: fix memory leak in service subscripting
Tang Bin <[email protected]>
USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()
Sonny Sasaka <[email protected]>
Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
Jonathan Bakker <[email protected]>
phy: samsung: s5pv210-usb2: Add delay after reset
Jonathan Bakker <[email protected]>
power: supply: max17040: Correct voltage reading
Ian Rogers <[email protected]>
perf mem2node: Avoid double free related to realloc
Cong Wang <[email protected]>
atm: fix a memory leak of vcc->user_back
Krzysztof Kozlowski <[email protected]>
dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
Will Deacon <[email protected]>
arm64: cpufeature: Relax checks for AArch32 support at EL[0-2]
Wei Yongjun <[email protected]>
sparc64: vcc: Fix error return code in vcc_probe()
Ivan Safonov <[email protected]>
staging:r8188eu: avoid skb_clone for amsdu to msdu conversion
Christophe JAILLET <[email protected]>
scsi: aacraid: Fix error handling paths in aac_probe_one()
Tonghao Zhang <[email protected]>
net: openvswitch: use u64 for meter bucket
Zenghui Yu <[email protected]>
KVM: arm64: vgic-its: Fix memory leak on the error path of vgic_add_lpi()
Madhuparna Bhowmik <[email protected]>
drivers: char: tlclk.c: Avoid data race between init and interrupt handler
Douglas Anderson <[email protected]>
bdev: Reduce time holding bd_mutex in sync in blkdev_close()
Stephane Eranian <[email protected]>
perf stat: Force error in fallback on :k events
Steve Rutherford <[email protected]>
KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
Raviteja Narayanam <[email protected]>
serial: uartps: Wait for tx_empty in console setup
Nilesh Javali <[email protected]>
scsi: qedi: Fix termination timeouts in session logout
Jaewon Kim <[email protected]>
mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
Israel Rukshin <[email protected]>
nvmet-rdma: fix double free of rdma queue
Qian Cai <[email protected]>
mm/vmscan.c: fix data races using kswapd_classzone_idx
Xianting Tian <[email protected]>
mm/filemap.c: clear page error before actual read
Nathan Chancellor <[email protected]>
mm/kmemleak.c: use address-of operator on section symbols
Trond Myklebust <[email protected]>
NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests()
Stuart Hayes <[email protected]>
PCI: pciehp: Fix MSI interrupt race
Andreas Steinmetz <[email protected]>
ALSA: usb-audio: Fix case when USB MIDI interface has more than one extra endpoint descriptor
Liu Song <[email protected]>
ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len
Mikel Rychliski <[email protected]>
PCI: Use ioremap(), not phys_to_virt() for platform ROM
Chuck Lever <[email protected]>
svcrdma: Fix leak of transport addresses
Christophe JAILLET <[email protected]>
SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()'
Don Brace <[email protected]>
scsi: hpsa: correct race condition in offload enabled
Zhu Yanjun <[email protected]>
RDMA/rxe: Set sys_image_guid to be aligned with HW IB devices
Israel Rukshin <[email protected]>
nvme: Fix controller creation races with teardown flow
John Meneghini <[email protected]>
nvme-multipath: do not reset on unknown status
Gabriel Ravier <[email protected]>
tools: gpio-hammer: Avoid potential overflow in main
Pratik Rajesh Sampat <[email protected]>
cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
Christophe JAILLET <[email protected]>
perf cpumap: Fix snprintf overflow check
Vignesh Raghavendra <[email protected]>
serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout
Peter Ujfalusi <[email protected]>
serial: 8250_omap: Fix sleeping function called from invalid context during probe
Vignesh Raghavendra <[email protected]>
serial: 8250_port: Don't service RX FIFO if throttled
Ian Rogers <[email protected]>
perf parse-events: Fix 3 use after frees found with clang ASAN
Niklas Söderlund <[email protected]>
thermal: rcar_thermal: Handle probe error gracefully
Nathan Chancellor <[email protected]>
tracing: Use address-of operator on section symbols
Jordan Crouse <[email protected]>
drm/msm/a5xx: Always set an OPP supported hardware value
Pavel Machek <[email protected]>
drm/msm: fix leaks if initialization fails
Gustavo Romero <[email protected]>
KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones
Jason Gunthorpe <[email protected]>
RDMA/cm: Remove a race freeing timewait_info
Trond Myklebust <[email protected]>
nfsd: Don't add locks to closed or closing open stateids
Alexandre Belloni <[email protected]>
rtc: ds1374: fix possible race condition
Alexandre Belloni <[email protected]>
rtc: sa1100: fix possible race condition
Stefan Berger <[email protected]>
tpm: ibmvtpm: Wait for buffer to be set before proceeding
Dmitry Monakhov <[email protected]>
ext4: mark block bitmap corrupted when found instead of BUGON
Darrick J. Wong <[email protected]>
xfs: mark dir corrupt when lookup-by-hash fails
Darrick J. Wong <[email protected]>
xfs: don't ever return a stale pointer from __xfs_dir3_free_read
Colin Ian King <[email protected]>
media: tda10071: fix unsigned sign extension overflow
Howard Chung <[email protected]>
Bluetooth: L2CAP: handle l2cap config request during open state
Sagar Biradar <[email protected]>
scsi: aacraid: Disabling TM path and only processing IOP reset
Wen Gong <[email protected]>
ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read
Rodrigo Siqueira <[email protected]>
drm/amd/display: Stop if retimer is not available
John Clements <[email protected]>
drm/amdgpu: increase atombios cmd timeout
Kirill A. Shutemov <[email protected]>
mm: avoid data corruption on CoW fault into PFN-mapped VMA
John Garry <[email protected]>
perf jevents: Fix leak of mapfile memory
Qiujun Huang <[email protected]>
ext4: fix a data race at inode->i_disksize
Wen Yang <[email protected]>
timekeeping: Prevent 32bit truncation in scale64_check_overflow()
Alain Michaud <[email protected]>
Bluetooth: guard against controllers sending zero'd events
Takashi Iwai <[email protected]>
media: go7007: Fix URB type for interrupt handling
John Garry <[email protected]>
bus: hisi_lpc: Fixup IO ports addresses to avoid use-after-free in host removal
Qian Cai <[email protected]>
random: fix data races at timer_rand_state
James Morse <[email protected]>
firmware: arm_sdei: Use cpus_read_lock() to avoid races with cpuhp
Aric Cyr <[email protected]>
drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic
Dmitry Osipenko <[email protected]>
dmaengine: tegra-apb: Prevent race conditions on channel's freeing
Amelie Delaunay <[email protected]>
dmaengine: stm32-dma: use vchan_terminate_vdesc() in .terminate_all
Thomas Gleixner <[email protected]>
bpf: Remove recursion prevention from rcu free callback
Dave Hansen <[email protected]>
x86/pkeys: Add check for pkey "overflow"
Dan Carpenter <[email protected]>
media: staging/imx: Missing assignment in imx_media_capture_device_register()
Amelie Delaunay <[email protected]>
dmaengine: stm32-mdma: use vchan_terminate_vdesc() in .terminate_all
Paolo Bonzini <[email protected]>
KVM: x86: fix incorrect comparison in trace event
Bart Van Assche <[email protected]>
RDMA/rxe: Fix configuration of atomic queue pair attributes
Thomas Richter <[email protected]>
perf test: Fix test trace+probe_vfs_getname.sh on s390
Takashi Iwai <[email protected]>
ALSA: usb-audio: Don't create a mixer element with bogus volume range
Felix Fietkau <[email protected]>
mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
Ayush Sawal <[email protected]>
crypto: chelsio - This fixes the kernel panic which occurs during a libkcapi test
Dinh Nguyen <[email protected]>
clk: stratix10: use do_div() for 64-bit calculation
Wen Yang <[email protected]>
drm/omap: fix possible object reference leak
James Smart <[email protected]>
scsi: lpfc: Fix coverity errors in fmdi attribute handling
James Smart <[email protected]>
scsi: lpfc: Fix RQ buffer leakage when no IOCBs available
Vasily Averin <[email protected]>
selinux: sel_avc_get_stat_idx should increase position index
Steve Grubb <[email protected]>
audit: CONFIG_CHANGE don't log internal bookkeeping as an event
Qian Cai <[email protected]>
skbuff: fix a data race in skb_queue_len()
Mohan Kumar <[email protected]>
ALSA: hda: Clear RIRB status before reading WP
Zhuang Yanying <[email protected]>
KVM: fix overflow of zero page refcount with ksm running
Hillf Danton <[email protected]>
Bluetooth: prefetch channel before killing sock
Steven Price <[email protected]>
mm: pagewalk: fix termination condition in walk_pte_range()
Vasily Averin <[email protected]>
mm/swapfile.c: swap_next should increase position index
Manish Mandlik <[email protected]>
Bluetooth: Fix refcount use-after-free issue
Doug Smythies <[email protected]>
tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
Sven Schnelle <[email protected]>
selftests/ftrace: fix glob selftest
Jeff Layton <[email protected]>
ceph: ensure we have a new cap before continuing in fill_inode
Mert Dirik <[email protected]>
ar5523: Add USB ID of SMCWUSBT-G2 wireless adapter
Vincent Whitchurch <[email protected]>
ARM: 8948/1: Prevent OOB access in stacktrace
Josef Bacik <[email protected]>
tracing: Set kernel_stack's caller size properly
Maxim Mikityanskiy <[email protected]>
Bluetooth: btrtl: Use kvmalloc for FW allocations
Oliver O'Halloran <[email protected]>
powerpc/eeh: Only dump stack once if an MMIO loop is detected
Thomas Richter <[email protected]>
s390/cpum_sf: Use kzalloc and minor changes
Matthias Fend <[email protected]>
dmaengine: zynqmp_dma: fix burst length configuration
Bart Van Assche <[email protected]>
scsi: ufs: Fix a race condition in the tracing code
Bart Van Assche <[email protected]>
scsi: ufs: Make ufshcd_add_command_trace() easier to read
Rafael J. Wysocki <[email protected]>
ACPI: EC: Reference count query handlers under lock
Kevin Kou <[email protected]>
sctp: move trace_sctp_probe_path into sctp_outq_sack
Nikhil Devshatwar <[email protected]>
media: ti-vpe: cal: Restrict DMA to avoid memory corruption
Marco Elver <[email protected]>
seqlock: Require WRITE_ONCE surrounding raw_seqcount_barrier
Vasily Averin <[email protected]>
ipv6_route_seq_next should increase position index
Vasily Averin <[email protected]>
rt_cpu_seq_next should increase position index
Vasily Averin <[email protected]>
neigh_stat_seq_next() should increase position index
Darrick J. Wong <[email protected]>
xfs: fix log reservation overflows when allocating large rt extents
Miaohe Lin <[email protected]>
KVM: arm/arm64: vgic: Fix potential double free dist->spis in __kvm_vgic_destroy()
Joe Perches <[email protected]>
kernel/sys.c: avoid copying possible padding bytes in copy_to_user
Tzung-Bi Shih <[email protected]>
ASoC: max98090: remove msleep in PLL unlocked workaround
Pavel Shilovsky <[email protected]>
CIFS: Properly process SMB3 lease breaks
Kusanagi Kouichi <[email protected]>
debugfs: Fix !DEBUG_FS debugfs_create_automount
peter chang <[email protected]>
scsi: pm80xx: Cleanup command when a reset times out
Bob Peterson <[email protected]>
gfs2: clean up iopen glock mess in gfs2_create_inode
Bradley Bolen <[email protected]>
mmc: core: Fix size overflow for mmc partitions
Sascha Hauer <[email protected]>
ubi: Fix producing anchor PEBs
Christophe JAILLET <[email protected]>
RDMA/iw_cgxb4: Fix an error handling path in 'c4iw_connect()'
Brian Foster <[email protected]>
xfs: fix attr leaf header freemap.size underflow
Al Viro <[email protected]>
fix dget_parent() fastpath race
Pan Bian <[email protected]>
RDMA/i40iw: Fix potential use after free
Pan Bian <[email protected]>
RDMA/qedr: Fix potential use after free
Satendra Singh Thakur <[email protected]>
dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails
Guoju Fang <[email protected]>
bcache: fix a lost wake-up problem caused by mca_cannibalize_lock
Divya Indi <[email protected]>
tracing: Adding NULL checks for trace_array descriptor pointer
Ivan Lazeev <[email protected]>
tpm_crb: fix fTPM on AMD Zen+ CPUs
Alex Deucher <[email protected]>
drm/amdgpu/powerplay/smu7: fix AVFS handling with custom powerplay table
Lee Jones <[email protected]>
mfd: mfd-core: Protect against NULL call-back function pointer
Hou Tao <[email protected]>
mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup()
Alex Deucher <[email protected]>
drm/amdgpu/powerplay: fix AVFS handling with custom powerplay table
Stephen Kitt <[email protected]>
clk/ti/adpll: allocate room for terminating null
Eric Dumazet <[email protected]>
net: silence data-races on sk_backlog.tail
James Smart <[email protected]>
scsi: lpfc: Fix kernel crash at lpfc_nvme_info_show during remote port bounce
Pan Bian <[email protected]>
scsi: fnic: fix use after free
Dmitry Osipenko <[email protected]>
PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out
Oleh Kravchenko <[email protected]>
leds: mlxreg: Fix possible buffer overflow
Nick Desaulniers <[email protected]>
lib/string.c: implement stpcpy
Kai-Heng Feng <[email protected]>
ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520
Hui Wang <[email protected]>
ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged
Joakim Tjernlund <[email protected]>
ALSA: usb-audio: Add delay quirk for H570e USB headsets
Thomas Gleixner <[email protected]>
x86/ioapic: Unbreak check_timer()
Mikulas Patocka <[email protected]>
arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
Sakari Ailus <[email protected]>
media: smiapp: Fix error handling at NVM reading
Russell King <[email protected]>
ASoC: kirkwood: fix IRQ error handling
Kangjie Lu <[email protected]>
gma/gma500: fix a memory disclosure bug due to uninitialized bytes
Fuqian Huang <[email protected]>
m68k: q40: Fix info-leak in rtc_ioctl
Balsundar P <[email protected]>
scsi: aacraid: fix illegal IO beyond last LBA
Jia He <[email protected]>
mm: fix double page fault on arm64 if PTE_AF is cleared
Miaoqing Pan <[email protected]>
ath10k: fix memory leak for tpc_stats_final
Miaoqing Pan <[email protected]>
ath10k: fix array out-of-bounds access
Chris Wilson <[email protected]>
dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling)
zhengbin <[email protected]>
media: mc-device.c: fix memleak in media_device_register_entity
Jonathan Lebon <[email protected]>
selinux: allow labeling before policy is loaded
-------------
Diffstat:
Documentation/devicetree/bindings/sound/wm8994.txt | 18 ++- Documentation/driver-api/libata.rst | 2 +- Makefile | 4 +- arch/arm/include/asm/kvm_emulate.h | 11 +- arch/arm/kernel/stacktrace.c | 2 + arch/arm/kernel/traps.c | 6 +- arch/arm64/include/asm/kvm_emulate.h | 9 +- arch/arm64/kernel/cpufeature.c | 12 +- arch/arm64/kvm/hyp/switch.c | 2 +- arch/m68k/q40/config.c | 1 + arch/mips/include/asm/cpu-type.h | 1 + arch/powerpc/include/asm/kvm_asm.h | 3 + arch/powerpc/kernel/eeh.c | 2 +- arch/powerpc/kernel/traps.c | 6 +- arch/powerpc/kvm/book3s_hv_tm.c | 28 +++- arch/powerpc/kvm/book3s_hv_tm_builtin.c | 16 ++- arch/riscv/include/asm/ftrace.h | 7 + arch/riscv/kernel/ftrace.c | 19 +++ arch/s390/kernel/perf_cpum_sf.c | 9 +- arch/s390/kernel/setup.c | 6 +- arch/x86/include/asm/nospec-branch.h | 4 +- arch/x86/include/asm/pkeys.h | 5 + arch/x86/kernel/apic/io_apic.c | 1 + arch/x86/kernel/fpu/xstate.c | 9 +- arch/x86/kvm/mmutrace.h | 2 +- arch/x86/kvm/svm.c | 8 +- arch/x86/kvm/x86.c | 13 +- arch/x86/lib/usercopy_64.c | 2 +- drivers/acpi/ec.c | 16 +-- drivers/ata/acard-ahci.c | 6 +- drivers/ata/libahci.c | 6 +- drivers/ata/libata-core.c | 9 +- drivers/ata/libata-sff.c | 12 +- drivers/ata/pata_macio.c | 6 +- drivers/ata/pata_pxa.c | 8 +- drivers/ata/pdc_adma.c | 7 +- drivers/ata/sata_fsl.c | 4 +- drivers/ata/sata_inic162x.c | 4 +- drivers/ata/sata_mv.c | 34 ++--- drivers/ata/sata_nv.c | 18 ++- drivers/ata/sata_promise.c | 6 +- drivers/ata/sata_qstor.c | 8 +- drivers/ata/sata_rcar.c | 6 +- drivers/ata/sata_sil.c | 8 +- drivers/ata/sata_sil24.c | 6 +- drivers/ata/sata_sx4.c | 6 +- drivers/atm/eni.c | 2 +- drivers/base/regmap/regmap.c | 12 +- drivers/bluetooth/btrtl.c | 20 +-- drivers/bus/hisi_lpc.c | 27 +++- drivers/char/random.c | 12 +- drivers/char/tlclk.c | 17 ++- drivers/char/tpm/tpm_crb.c | 123 ++++++++++++----- drivers/char/tpm/tpm_ibmvtpm.c | 9 ++ drivers/char/tpm/tpm_ibmvtpm.h | 1 + drivers/clk/socfpga/clk-pll-s10.c | 4 +- drivers/clk/ti/adpll.c | 11 +- drivers/clocksource/h8300_timer8.c | 2 +- drivers/cpufreq/powernv-cpufreq.c | 13 +- drivers/crypto/chelsio/chcr_algo.c | 5 +- drivers/crypto/chelsio/chtls/chtls_io.c | 10 +- drivers/devfreq/tegra-devfreq.c | 4 +- drivers/dma-buf/dma-fence.c | 78 +++++------ drivers/dma/mediatek/mtk-hsdma.c | 4 +- drivers/dma/stm32-dma.c | 9 +- drivers/dma/stm32-mdma.c | 9 +- drivers/dma/tegra20-apb-dma.c | 3 +- drivers/dma/xilinx/zynqmp_dma.c | 24 ++-- drivers/firmware/arm_sdei.c | 26 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 31 +++-- drivers/gpu/drm/amd/amdgpu/atom.c | 4 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 67 +++++----- drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 ++++---- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 7 + drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 7 + drivers/gpu/drm/gma500/cdv_intel_display.c | 2 + drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 +++- drivers/gpu/drm/msm/msm_drv.c | 6 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 +- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 5 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +- .../gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 17 ++- drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +- drivers/gpu/drm/radeon/radeon_bios.c | 30 +++-- drivers/gpu/drm/sun4i/sun8i_csc.h | 2 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 1 + drivers/i2c/i2c-core-base.c | 2 +- drivers/infiniband/core/cm.c | 25 ++-- drivers/infiniband/hw/cxgb4/cm.c | 4 +- drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 +- drivers/infiniband/sw/rxe/rxe.c | 2 + drivers/infiniband/sw/rxe/rxe_qp.c | 7 +- drivers/leds/leds-mlxreg.c | 4 +- drivers/md/bcache/bcache.h | 1 + drivers/md/bcache/btree.c | 12 +- drivers/md/bcache/super.c | 1 + drivers/media/dvb-frontends/tda10071.c | 9 +- drivers/media/i2c/smiapp/smiapp-core.c | 3 +- drivers/media/media-device.c | 65 ++++----- drivers/media/platform/ti-vpe/cal.c | 6 +- drivers/media/usb/go7007/go7007-usb.c | 4 +- drivers/mfd/mfd-core.c | 10 ++ drivers/mmc/core/mmc.c | 9 +- drivers/mtd/chips/cfi_cmdset_0002.c | 1 - drivers/mtd/cmdlinepart.c | 23 +++- drivers/mtd/nand/raw/omap_elm.c | 1 + drivers/mtd/ubi/fastmap-wl.c | 46 ++++--- drivers/mtd/ubi/fastmap.c | 14 +- drivers/mtd/ubi/ubi.h | 6 +- drivers/mtd/ubi/wl.c | 32 ++--- drivers/mtd/ubi/wl.h | 1 - drivers/net/ethernet/intel/e1000/e1000_main.c | 18 ++- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 1 + drivers/net/ieee802154/adf7242.c | 4 +- drivers/net/ieee802154/ca8210.c | 1 + drivers/net/wireless/ath/ar5523/ar5523.c | 2 + drivers/net/wireless/ath/ath10k/debug.c | 3 +- drivers/net/wireless/ath/ath10k/sdio.c | 18 ++- drivers/net/wireless/ath/ath10k/wmi.c | 49 ++++--- drivers/net/wireless/marvell/mwifiex/fw.h | 2 +- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 4 +- drivers/net/wireless/mediatek/mt76/agg-rx.c | 1 + drivers/net/wireless/ti/wlcore/main.c | 4 +- drivers/net/wireless/ti/wlcore/tx.c | 1 + drivers/nvme/host/core.c | 12 +- drivers/nvme/host/multipath.c | 21 ++- drivers/nvme/host/nvme.h | 19 ++- drivers/nvme/target/rdma.c | 30 +++-- drivers/pci/controller/pci-tegra.c | 3 +- drivers/pci/hotplug/pciehp_hpc.c | 26 +++- drivers/pci/rom.c | 17 --- drivers/phy/samsung/phy-s5pv210-usb2.c | 4 + drivers/power/supply/max17040_battery.c | 2 +- drivers/rapidio/devices/rio_mport_cdev.c | 14 +- drivers/rtc/rtc-ds1374.c | 15 ++- drivers/rtc/rtc-sa1100.c | 18 +-- drivers/s390/block/dasd_fba.c | 9 +- drivers/s390/crypto/zcrypt_api.c | 3 +- drivers/scsi/aacraid/aachba.c | 8 +- drivers/scsi/aacraid/commsup.c | 2 +- drivers/scsi/aacraid/linit.c | 46 +++++-- drivers/scsi/cxlflash/main.c | 1 + drivers/scsi/fnic/fnic_scsi.c | 3 +- drivers/scsi/hpsa.c | 80 ++++++++---- drivers/scsi/libfc/fc_rport.c | 13 +- drivers/scsi/lpfc/lpfc_attr.c | 35 ++--- drivers/scsi/lpfc/lpfc_ct.c | 137 +++++++++---------- drivers/scsi/lpfc/lpfc_hw.h | 36 +++-- drivers/scsi/lpfc/lpfc_sli.c | 4 + drivers/scsi/pm8001/pm8001_sas.c | 50 +++++-- drivers/scsi/qedi/qedi_iscsi.c | 3 + drivers/scsi/ufs/ufshcd.c | 14 +- drivers/staging/media/imx/imx-media-capture.c | 2 +- drivers/staging/rtl8188eu/core/rtw_recv.c | 19 +-- drivers/thermal/rcar_thermal.c | 6 +- drivers/tty/serial/8250/8250_omap.c | 8 +- drivers/tty/serial/8250/8250_port.c | 16 ++- drivers/tty/serial/samsung.c | 8 +- drivers/tty/serial/xilinx_uartps.c | 8 ++ drivers/tty/vcc.c | 1 + drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/host/ehci-mv.c | 8 +- drivers/vfio/pci/vfio_pci.c | 13 ++ fs/block_dev.c | 10 ++ fs/btrfs/extent-tree.c | 2 - fs/btrfs/inode.c | 23 ++-- fs/ceph/caps.c | 14 +- fs/ceph/inode.c | 5 +- fs/cifs/cifsglob.h | 9 +- fs/cifs/file.c | 21 ++- fs/cifs/misc.c | 17 +-- fs/cifs/smb1ops.c | 8 +- fs/cifs/smb2misc.c | 32 +---- fs/cifs/smb2ops.c | 44 +++++-- fs/cifs/smb2pdu.h | 2 +- fs/dcache.c | 4 +- fs/ext4/inode.c | 2 +- fs/ext4/mballoc.c | 11 +- fs/fuse/dev.c | 1 - fs/gfs2/inode.c | 13 +- fs/nfs/pagelist.c | 67 ++++++---- fs/nfs/write.c | 10 +- fs/nfsd/nfs4state.c | 73 ++++++----- fs/ubifs/io.c | 16 ++- fs/xfs/libxfs/xfs_attr_leaf.c | 4 +- fs/xfs/libxfs/xfs_dir2_node.c | 1 + fs/xfs/libxfs/xfs_trans_resv.c | 96 +++++++++++--- fs/xfs/scrub/dir.c | 3 + include/linux/debugfs.h | 5 +- include/linux/libata.h | 13 +- include/linux/mmc/card.h | 2 +- include/linux/nfs_page.h | 2 + include/linux/pci.h | 1 - include/linux/seqlock.h | 11 +- include/linux/skbuff.h | 14 +- include/net/sock.h | 4 +- include/trace/events/sctp.h | 9 -- kernel/audit_watch.c | 2 - kernel/bpf/hashtab.c | 8 -- kernel/bpf/inode.c | 4 +- kernel/kprobes.c | 22 +++- kernel/printk/printk.c | 3 + kernel/sys.c | 4 +- kernel/time/timekeeping.c | 3 +- kernel/trace/trace.c | 5 +- kernel/trace/trace_entries.h | 2 +- kernel/trace/trace_events.c | 2 + kernel/trace/trace_events_hist.c | 1 - kernel/trace/trace_preemptirq.c | 4 +- lib/string.c | 24 ++++ mm/filemap.c | 8 ++ mm/kmemleak.c | 2 +- mm/memory.c | 121 +++++++++++++++-- mm/mmap.c | 2 + mm/pagewalk.c | 4 +- mm/swap_state.c | 5 +- mm/swapfile.c | 4 +- mm/vmscan.c | 45 ++++--- net/atm/lec.c | 6 + net/batman-adv/bridge_loop_avoidance.c | 145 +++++++++++++++++---- net/batman-adv/bridge_loop_avoidance.h | 4 +- net/batman-adv/routing.c | 4 + net/batman-adv/soft-interface.c | 6 +- net/bluetooth/hci_event.c | 25 +++- net/bluetooth/l2cap_core.c | 29 +++-- net/bluetooth/l2cap_sock.c | 18 ++- net/core/filter.c | 4 +- net/core/neighbour.c | 1 + net/ipv4/route.c | 1 + net/ipv4/tcp.c | 2 +- net/ipv6/ip6_fib.c | 7 +- net/llc/af_llc.c | 2 +- net/mac802154/tx.c | 8 +- net/openvswitch/meter.c | 4 +- net/openvswitch/meter.h | 2 +- net/sctp/outqueue.c | 6 + net/sunrpc/svc_xprt.c | 19 ++- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 1 + net/tipc/topsrv.c | 4 +- net/unix/af_unix.c | 11 +- security/selinux/hooks.c | 12 ++ security/selinux/selinuxfs.c | 1 + sound/hda/hdac_bus.c | 4 + sound/pci/asihpi/hpioctl.c | 4 +- sound/pci/hda/hda_controller.c | 11 +- sound/pci/hda/patch_realtek.c | 13 +- sound/soc/codecs/max98090.c | 8 +- sound/soc/codecs/wm8994.c | 10 ++ sound/soc/codecs/wm_hubs.c | 3 + sound/soc/codecs/wm_hubs.h | 1 + sound/soc/img/img-i2s-out.c | 8 +- sound/soc/intel/boards/bytcr_rt5640.c | 10 ++ sound/soc/kirkwood/kirkwood-dma.c | 2 +- sound/usb/midi.c | 29 ++++- sound/usb/mixer.c | 10 ++ sound/usb/quirks.c | 7 +- tools/gpio/gpio-hammer.c | 17 ++- tools/objtool/check.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/pmu-events/jevents.c | 15 ++- tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +- tools/perf/trace/beauty/arch_errno_names.sh | 2 +- tools/perf/util/cpumap.c | 10 +- tools/perf/util/evsel.c | 7 + tools/perf/util/mem2node.c | 3 +- tools/perf/util/metricgroup.c | 3 + tools/perf/util/parse-events.c | 9 +- tools/perf/util/sort.c | 2 +- tools/perf/util/symbol-elf.c | 7 + .../x86/intel_pstate_tracer/intel_pstate_tracer.py | 22 ++-- .../ftrace/test.d/ftrace/func-filter-glob.tc | 2 +- tools/testing/selftests/x86/syscall_nt.c | 1 + virt/kvm/arm/mmio.c | 2 +- virt/kvm/arm/mmu.c | 5 +- virt/kvm/arm/vgic/vgic-init.c | 1 + virt/kvm/arm/vgic/vgic-its.c | 11 +- virt/kvm/kvm_main.c | 1 + 279 files changed, 2370 insertions(+), 1213 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 26/245 mfd: mfd-core: Protect against NULL call-back function pointer
From: Lee Jones <[email protected]>
[ Upstream commit b195e101580db390f50b0d587b7f66f241d2bc88 ]
If a child device calls mfd_cell_{en,dis}able() without an appropriate call-back being set, we are likely to encounter a panic. Avoid this by adding suitable checking.
--- drivers/mfd/mfd-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mfd/mfd-core.c +10 -0
@@ -32,6 +32,11 @@ int mfd_cell_enable(struct platform_device *pdev)const struct mfd_cell *cell =mfd_get_cell (pdev);int err =0 ; +if (!cell->enable) { +dev_dbg (&pdev->dev,"No .enable() call-back registered\n" ); +return 0 ; + } +/* only call enable hook if the cell wasn't previously enabled */ if (atomic_inc_return (cell->usage_count) ==1 ) err = cell->enable (pdev);
@@ -49,6 +54,11 @@ int mfd_cell_disable(struct platform_device *pdev)const struct mfd_cell *cell =mfd_get_cell (pdev);int err =0 ; +if (!cell->disable) { +dev_dbg (&pdev->dev,"No .disable() call-back registered\n" ); +return 0 ; + } +/* only disable if no other clients are using it */ if (atomic_dec_return (cell->usage_count) ==0 ) err = cell->disable (pdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/245 net: silence data-races on sk_backlog.tail
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 9ed498c6280a2f2b51d02df96df53037272ede49 ]
sk->sk_backlog.tail might be read without holding the socket spinlock, we need to add proper READ_ONCE()/WRITE_ONCE() to silence the warnings.
KCSAN reported :
BUG: KCSAN: data-race in tcp_add_backlog / tcp_recvmsg
write to 0xffff8881265109f8 of 8 bytes by interrupt on cpu 1:
__sk_add_backlog include/net/sock.h:907 [inline] sk_add_backlog include/net/sock.h:938 [inline] tcp_add_backlog+0x476/0xce0 net/ipv4/tcp_ipv4.c:1759 tcp_v4_rcv+0x1a70/0x1bd0 net/ipv4/tcp_ipv4.c:1947 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:4929 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5043 netif_receive_skb_internal+0x59/0x190 net/core/dev.c:5133 napi_skb_finish net/core/dev.c:5596 [inline] napi_gro_receive+0x28f/0x330 net/core/dev.c:5629 receive_buf+0x284/0x30b0 drivers/net/virtio_net.c:1061 virtnet_receive drivers/net/virtio_net.c:1323 [inline] virtnet_poll+0x436/0x7d0 drivers/net/virtio_net.c:1428 napi_poll net/core/dev.c:6311 [inline] net_rx_action+0x3ae/0xa90 net/core/dev.c:6379 __do_softirq+0x115/0x33f kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0xbb/0xe0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] do_IRQ+0xa6/0x180 arch/x86/kernel/irq.c:263 ret_from_intr+0x0/0x19 native_safe_halt+0xe/0x10 arch/x86/kernel/paravirt.c:71 arch_cpu_idle+0x1f/0x30 arch/x86/kernel/process.c:571 default_idle_call+0x1e/0x40 kernel/sched/idle.c:94 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x1af/0x280 kernel/sched/idle.c:263 cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355 start_secondary+0x208/0x260 arch/x86/kernel/smpboot.c:264 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
read to 0xffff8881265109f8 of 8 bytes by task 8057 on cpu 0:
tcp_recvmsg+0x46e/0x1b40 net/ipv4/tcp.c:2050 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838 sock_recvmsg_nosec net/socket.c:871 [inline] sock_recvmsg net/socket.c:889 [inline] sock_recvmsg+0x92/0xb0 net/socket.c:885 sock_read_iter+0x15f/0x1e0 net/socket.c:967 call_read_iter include/linux/fs.h:1889 [inline] new_sync_read+0x389/0x4f0 fs/read_write.c:414 __vfs_read+0xb1/0xc0 fs/read_write.c:427 vfs_read fs/read_write.c:461 [inline] vfs_read+0x143/0x2c0 fs/read_write.c:446 ksys_read+0xd5/0x1b0 fs/read_write.c:587 __do_sys_read fs/read_write.c:597 [inline] __se_sys_read fs/read_write.c:595 [inline] __x64_sys_read+0x4c/0x60 fs/read_write.c:595 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 8057 Comm: syz-fuzzer Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- drivers/crypto/chelsio/chtls/chtls_io.c | 10 +++++----- include/net/sock.h | 4 ++-- net/ipv4/tcp.c | 2 +- net/llc/af_llc.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/crypto/chelsio/chtls/chtls_io.c +5 -5
@@ -1449,7 +1449,7 @@ static int chtls_pt_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, csk->wr_max_credits)) sk->sk_write_space (sk); -if (copied >= target && !sk->sk_backlog.tail) +if (copied >= target && !READ_ONCE (sk->sk_backlog.tail))break ;if (copied) {
@@ -1482,7 +1482,7 @@ static int chtls_pt_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,break ; } } -if (sk->sk_backlog.tail) { +if (READ_ONCE (sk->sk_backlog.tail)) {release_sock (sk);lock_sock (sk);chtls_cleanup_rbuf (sk, copied);
@@ -1627,7 +1627,7 @@ static int peekmsg(struct sock *sk, struct msghdr *msg,break ; } -if (sk->sk_backlog.tail) { +if (READ_ONCE (sk->sk_backlog.tail)) {/* Do not sleep, just process backlog. */ release_sock (sk);lock_sock (sk);
@@ -1759,7 +1759,7 @@ int chtls_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, csk->wr_max_credits)) sk->sk_write_space (sk); -if (copied >= target && !sk->sk_backlog.tail) +if (copied >= target && !READ_ONCE (sk->sk_backlog.tail))break ;if (copied) {
@@ -1790,7 +1790,7 @@ int chtls_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, } } -if (sk->sk_backlog.tail) { +if (READ_ONCE (sk->sk_backlog.tail)) {release_sock (sk);lock_sock (sk);chtls_cleanup_rbuf (sk, copied);
include/net/sock.h +2 -2
@@ -900,11 +900,11 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)skb_dst_force (skb);if (!sk->sk_backlog.tail) - sk->sk_backlog.head = skb; +WRITE_ONCE (sk->sk_backlog.head, skb);else sk->sk_backlog.tail->next = skb; - sk->sk_backlog.tail = skb; +WRITE_ONCE (sk->sk_backlog.tail, skb); skb->next =NULL ; }
net/ipv4/tcp.c +1 -1
@@ -2038,7 +2038,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,/* Well, if we have backlog, try to process it now yet. */ -if (copied >= target && !sk->sk_backlog.tail) +if (copied >= target && !READ_ONCE (sk->sk_backlog.tail))break ;if (copied) {
net/llc/af_llc.c +1 -1
@@ -785,7 +785,7 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, }/* Well, if we have backlog, try to process it now yet. */ -if (copied >= target && !sk->sk_backlog.tail) +if (copied >= target && !READ_ONCE (sk->sk_backlog.tail))break ;if (copied) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 23/245 clk/ti/adpll: allocate room for terminating null
In reply to Greg Kroah-HartmanFrom: Stephen Kitt <[email protected]>
[ Upstream commit 7f6ac72946b88b89ee44c1c527aa8591ac5ffcbe ]
The buffer allocated in ti_adpll_clk_get_name doesn't account for the terminating null. This patch switches to devm_kasprintf to avoid overflowing.
--- drivers/clk/ti/adpll.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/clk/ti/adpll.c +2 -9
@@ -193,15 +193,8 @@ static const char *ti_adpll_clk_get_name(struct ti_adpll_data *d,if (err)return NULL ; }else { -const char *base_name ="adpll" ; -char *buf; - - buf =devm_kzalloc (d->dev,8 +1 +strlen (base_name) +1 + -strlen (postfix),GFP_KERNEL ); -if (!buf) -return NULL ; -sprintf (buf,"%08lx.%s.%s" , d->pa, base_name, postfix); - name = buf; + name =devm_kasprintf (d->dev,GFP_KERNEL ,"%08lx.adpll.%s" , + d->pa, postfix); }return name;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 24/245 drm/amdgpu/powerplay: fix AVFS handling with custom powerplay table
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 53dbc27ad5a93932ff1892a8e4ef266827d74a0f ]
When a custom powerplay table is provided, we need to update the OD VDDC flag to avoid AVFS being enabled when it shouldn't be.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +7 -0
@@ -3591,6 +3591,13 @@ static int vega10_set_power_state_tasks(struct pp_hwmgr *hwmgr,PP_ASSERT_WITH_CODE (!result, "Failed to upload PPtable!", return result); +/* +* If a custom pp table is loaded, set DPMTABLE_OD_UPDATE_VDDC flag. +* That effectively disables AVFS feature. +*/ +if (hwmgr->hardcode_pp_table !=NULL ) + data->need_update_dpm_table |=DPMTABLE_OD_UPDATE_VDDC ; +vega10_update_avfs (hwmgr); data->need_update_dpm_table &=DPMTABLE_OD_UPDATE_VDDC ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 25/245 mtd: cfi_cmdset_0002: dont free cfi->cfiq in error path of cfi_amdstd_setup()
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 03976af89e3bd9489d542582a325892e6a8cacc0 ]
Else there may be a double-free problem, because cfi->cfiq will be freed by mtd_do_chip_probe() if both the two invocations of check_cmd_set() return failure.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/chips/cfi_cmdset_0002.c +0 -1
@@ -727,7 +727,6 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)kfree (mtd->eraseregions);kfree (mtd);kfree (cfi->cmdset_priv); -kfree (cfi->cfiq);return NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/245 gma/gma500: fix a memory disclosure bug due to uninitialized bytes
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit 57a25a5f754ce27da2cfa6f413cfd366f878db76 ]
best_clock is an object that may be sent out. Object clock contains uninitialized bytes that are copied to best_clock, which leads to memory disclosure and information leak.
--- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/cdv_intel_display.c +2 -0
@@ -415,6 +415,8 @@ static bool cdv_intel_find_dp_pll(const struct gma_limit_t *limit,struct gma_crtc *gma_crtc =to_gma_crtc (crtc);struct gma_clock_t clock; +memset (&clock,0 ,sizeof (clock)); +switch (refclk) {case 27000 :if (target <200000 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 21/245 scsi: lpfc: Fix kernel crash at lpfc_nvme_info_show during remote port bounce
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 6c1e803eac846f886cd35131e6516fc51a8414b9 ]
When reading sysfs nvme_info file while a remote port leaves and comes back, a NULL pointer is encountered. The issue is due to ndlp list corruption as the the nvme_info_show does not use the same lock as the rest of the code.
Correct by removing the rcu_xxx_lock calls and replace by the host_lock and phba->hbaLock spinlocks that are used by the rest of the driver. Given we're called from sysfs, we are safe to use _irq rather than _irqsave.
--- drivers/scsi/lpfc/lpfc_attr.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +18 -17
@@ -332,7 +332,6 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,if (strlcat (buf,"\nNVME Initiator Enabled\n" ,PAGE_SIZE ) >=PAGE_SIZE ) goto buffer_done; -rcu_read_lock (); scnprintf(tmp, sizeof(tmp), "XRI Dist lpfc%d Total %d NVME %d SCSI %d ELS %d\n", phba->brd_no,
@@ -341,7 +340,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, phba->sli4_hba.scsi_xri_max, lpfc_sli4_get_els_iocb_cnt(phba));if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto buffer_done;/* Port state is only one of two values for now. */ if (localport->port_id)
@@ -357,7 +356,9 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,wwn_to_u64 (vport->fc_nodename.u.wwn), localport->port_id, statep);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto buffer_done; + +spin_lock_irq (shost->host_lock);list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { nrport =NULL ;
@@ -384,39 +385,39 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,/* Tab in to show lport ownership. */ if (strlcat (buf,"NVME RPORT " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done;if (phba->brd_no >=10 ) {if (strlcat (buf," " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; }scnprintf (tmp,sizeof (tmp),"WWPN x%llx " , nrport->port_name);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done;scnprintf (tmp,sizeof (tmp),"WWNN x%llx " , nrport->node_name);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done;scnprintf (tmp,sizeof (tmp),"DID x%06x " , nrport->port_id);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done;/* An NVME rport can have multiple roles. */ if (nrport->port_role &FC_PORT_ROLE_NVME_INITIATOR ) {if (strlcat (buf,"INITIATOR " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; }if (nrport->port_role &FC_PORT_ROLE_NVME_TARGET ) {if (strlcat (buf,"TARGET " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; }if (nrport->port_role &FC_PORT_ROLE_NVME_DISCOVERY ) {if (strlcat (buf,"DISCSRVC " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; } if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | FC_PORT_ROLE_NVME_TARGET |
@@ -424,14 +425,14 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,scnprintf (tmp,sizeof (tmp),"UNKNOWN ROLE x%x" , nrport->port_role);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; }scnprintf (tmp,sizeof (tmp),"%s\n" , statep);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto rcu_unlock_buf_done; + goto unlock_buf_done; } -rcu_read_unlock (); +spin_unlock_irq (shost->host_lock);if (!lport) goto buffer_done;
@@ -491,11 +492,11 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, atomic_read(&lport->cmpl_fcp_err));strlcat (buf, tmp,PAGE_SIZE ); -/* RCU is already unlocked. */ +/* host_lock is already unlocked. */ goto buffer_done; - rcu_unlock_buf_done: -rcu_read_unlock (); + unlock_buf_done: +spin_unlock_irq (shost->host_lock); buffer_done: len =strnlen (buf,PAGE_SIZE );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/245 scsi: fnic: fix use after free
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit ec990306f77fd4c58c3b27cc3b3c53032d6e6670 ]
The memory chunk io_req is released by mempool_free. Accessing io_req->start_time will result in a use after free bug. The variable start_time is a backup of the timestamp. So, use start_time here to avoid use after free.
--- drivers/scsi/fnic/fnic_scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/fnic/fnic_scsi.c +2 -1
@@ -1034,7 +1034,8 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,atomic64_inc (&fnic_stats->io_stats.io_completions); - io_duration_time =jiffies_to_msecs (jiffies) -jiffies_to_msecs (io_req->start_time); + io_duration_time =jiffies_to_msecs (jiffies) - +jiffies_to_msecs (start_time);if (io_duration_time <=10 )atomic64_inc (&fnic_stats->io_stats.io_btw_0_to_10_msec);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/245 scsi: aacraid: fix illegal IO beyond last LBA
In reply to Greg Kroah-HartmanFrom: Balsundar P <[email protected]>
[ Upstream commit c86fbe484c10b2cd1e770770db2d6b2c88801c1d ]
The driver fails to handle data when read or written beyond device reported LBA, which triggers kernel panic
--- drivers/scsi/aacraid/aachba.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/aachba.c +4 -4
@@ -2481,13 +2481,13 @@ static int aac_read(struct scsi_cmnd * scsicmd) scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data, -HARDWARE_ERROR ,SENCODE_INTERNAL_TARGET_FAILURE , +ILLEGAL_REQUEST ,SENCODE_LBA_OUT_OF_RANGE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );memcpy (scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,min_t (size_t,sizeof (dev->fsa_dev[cid].sense_data),SCSI_SENSE_BUFFERSIZE )); scsicmd->scsi_done (scsicmd); -return 1 ; +return 0 ; } dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n",
@@ -2573,13 +2573,13 @@ static int aac_write(struct scsi_cmnd * scsicmd) scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data, -HARDWARE_ERROR ,SENCODE_INTERNAL_TARGET_FAILURE , +ILLEGAL_REQUEST ,SENCODE_LBA_OUT_OF_RANGE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );memcpy (scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,min_t (size_t,sizeof (dev->fsa_dev[cid].sense_data),SCSI_SENSE_BUFFERSIZE )); scsicmd->scsi_done (scsicmd); -return 1 ; +return 0 ; } dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 18/245 leds: mlxreg: Fix possible buffer overflow
In reply to Greg Kroah-HartmanFrom: Oleh Kravchenko <[email protected]>
[ Upstream commit 7c6082b903ac28dc3f383fba57c6f9e7e2594178 ]
Error was detected by PVS-Studio:
V512 A call of the 'sprintf' function will lead to overflow of the buffer 'led_data->led_cdev_name'.
--- drivers/leds/leds-mlxreg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-mlxreg.c +2 -2
@@ -209,8 +209,8 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) brightness =LED_OFF ; led_data->base_color =MLXREG_LED_GREEN_SOLID ; } -sprintf (led_data->led_cdev_name,"%s:%s" ,"mlxreg" , - data->label); +snprintf (led_data->led_cdev_name,sizeof (led_data->led_cdev_name), +"mlxreg:%s" , data->label); led_cdev->name = led_data->led_cdev_name; led_cdev->brightness = brightness; led_cdev->max_brightness =LED_ON ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/245 PM / devfreq: tegra30: Fix integer overflow on CPUs freq max out
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 53b4b2aeee26f42cde5ff2a16dd0d8590c51a55a ]
There is another kHz-conversion bug in the code, resulting in integer overflow. Although, this time the resulting value is 4294966296 and it's close to ULONG_MAX, which is okay in this case.
--- drivers/devfreq/tegra-devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/devfreq/tegra-devfreq.c +3 -1
@@ -80,6 +80,8 @@#define KHZ 1000 +#define KHZ_MAX (ULONG_MAX / KHZ) +/* Assume that the bus is saturated if the utilization is 25% */ #define BUS_SATURATION_RATIO 25
@@ -180,7 +182,7 @@ struct tegra_actmon_emc_ratio { };static struct tegra_actmon_emc_ratio actmon_emc_ratios[] = { - {1400000 ,ULONG_MAX }, + {1400000 ,KHZ_MAX }, {1200000 ,750000 }, {1100000 ,600000 }, {1000000 ,500000 },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 4/245 ath10k: fix array out-of-bounds access
In reply to Greg Kroah-HartmanFrom: Miaoqing Pan <[email protected]>
[ Upstream commit c5329b2d5b8b4e41be14d31ee8505b4f5607bf9b ]
If firmware reports rate_max > WMI_TPC_RATE_MAX(WMI_TPC_FINAL_RATE_MAX) or num_tx_chain > WMI_TPC_TX_N_CHAIN, it will cause array out-of-bounds access, so print a warning and reset to avoid memory corruption.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/debug.c | 2 +- drivers/net/wireless/ath/ath10k/wmi.c | 49 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath10k/debug.c +1 -1
@@ -1521,7 +1521,7 @@ static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats, *len +=scnprintf (buf + *len, buf_len - *len,"No. Preamble Rate_code " ); -for (i =0 ; i <WMI_TPC_TX_N_CHAIN ; i++) +for (i =0 ; i < tpc_stats->num_tx_chain; i++) *len +=scnprintf (buf + *len, buf_len - *len,"tpc_value%d " , i);
drivers/net/wireless/ath/ath10k/wmi.c +31 -18
111 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 6/245 mm: fix double page fault on arm64 if PTE_AF is cleared
In reply to Greg Kroah-HartmanFrom: Jia He <[email protected]>
[ Upstream commit 83d116c53058d505ddef051e90ab27f57015b025 ]
When we tested pmdk unit test [1] vmmalloc_fork TEST3 on arm64 guest, there will be a double page fault in __copy_from_user_inatomic of cow_user_page.
To reproduce the bug, the cmd is as follows after you deployed everything:
make -C src/test/vmmalloc_fork/ TEST_TIME=60m check
Below call trace is from arm64 do_page_fault for debugging purpose:
[ 110.016195] Call trace: [ 110.016826] do_page_fault+0x5a4/0x690 [ 110.017812] do_mem_abort+0x50/0xb0 [ 110.018726] el1_da+0x20/0xc4 [ 110.019492] __arch_copy_from_user+0x180/0x280 [ 110.020646] do_wp_page+0xb0/0x860 [ 110.021517] __handle_mm_fault+0x994/0x1338 [ 110.022606] handle_mm_fault+0xe8/0x180 [ 110.023584] do_page_fault+0x240/0x690 [ 110.024535] do_mem_abort+0x50/0xb0 [ 110.025423] el0_da+0x20/0x24
The pte info before __copy_from_user_inatomic is (PTE_AF is cleared):
[ffff9b007000] pgd=000000023d4f8003, pud=000000023da9b003,
pmd=000000023d4b3003, pte=360000298607bd3
As told by Catalin: "On arm64 without hardware Access Flag, copying from user will fail because the pte is old and cannot be marked young. So we always end up with zeroed page after fork() + CoW for pfn mappings. we don't always have a hardware-managed access flag on arm64."
This patch fixes it by calling pte_mkyoung. Also, the parameter is changed because vmf should be passed to cow_user_page()
Add a WARN_ON_ONCE when __copy_from_user_inatomic() returns error in case there can be some obscure use-case (by Kirill).
[1] https://github.com/pmem/pmdk/tree/master/src/test/vmmalloc_fork
--- mm/memory.c | 104 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 15 deletions(-)
mm/memory.c +89 -15
@@ -116,6 +116,18 @@ int randomize_va_space __read_mostly =2 ;#endif +#ifndef arch_faults_on_old_pte +static inline bool arch_faults_on_old_pte (void ) +{ +/* +* Those arches which don't have hw access flag feature need to +* implement their own helper. By default, "true" means pagefault +* will be hit on old pte. +*/ +return true; +} +#endif +static int __init disable_randmaps (char *s) { randomize_va_space =0 ;
@@ -2335,32 +2347,82 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd,return same; } -static inline void cow_user_page (struct page *dst,struct page *src,unsigned long va,struct vm_area_struct *vma) +static inline bool cow_user_page (struct page *dst,struct page *src, +struct vm_fault *vmf) { +bool ret; +void *kaddr; +void __user *uaddr; +bool force_mkyoung; +struct vm_area_struct *vma = vmf->vma; +struct mm_struct *mm = vma->vm_mm; +unsigned long addr = vmf->address; +debug_dma_assert_idle (src); +if (likely (src)) { +copy_user_highpage (dst, src, addr, vma); +return true; + } +/* * If the source page was a PFN mapping, we don't have * a "struct page" for it. We do a best-effort copy by * just copying from the original user address. If that * fails, we just zero-fill it. Live with it. */ -if (unlikely (!src)) { -void *kaddr =kmap_atomic (dst); -void __user *uaddr = (void __user *)(va &PAGE_MASK ); + kaddr =kmap_atomic (dst); + uaddr = (void __user *)(addr &PAGE_MASK ); + +/* +* On architectures with software "accessed" bits, we would +* take a double page fault, so mark it accessed here. +*/ + force_mkyoung =arch_faults_on_old_pte () && !pte_young (vmf->orig_pte); +if (force_mkyoung) { +pte_t entry; + + vmf->pte =pte_offset_map_lock (mm, vmf->pmd, addr, &vmf->ptl); +if (!likely (pte_same (*vmf->pte, vmf->orig_pte))) { +/* +* Other thread has already handled the fault +* and we don't need to do anything. If it's +* not the case, the fault will be triggered +* again on the same address. +*/ + ret = false; + goto pte_unlock; + } + entry =pte_mkyoung (vmf->orig_pte); +if (ptep_set_access_flags (vma, addr, vmf->pte, entry,0 )) +update_mmu_cache (vma, addr, vmf->pte); + } + +/* +* This really shouldn't fail, because the page is there +* in the page tables. But it might just be unreadable, +* in which case we just give up and fill the result with +* zeroes. +*/ +if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) {/* -* This really shouldn't fail, because the page is there -* in the page tables. But it might just be unreadable, -* in which case we just give up and fill the result with -* zeroes. +* Give a warn in case there can be some obscure +* use-case */ -if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) -clear_page (kaddr); -kunmap_atomic (kaddr); -flush_dcache_page (dst); - }else -copy_user_highpage (dst, src, va, vma); +WARN_ON_ONCE (1 ); +clear_page (kaddr); + } + + ret = true; + +pte_unlock: +if (force_mkyoung) +pte_unmap_unlock (vmf->pte, vmf->ptl); +kunmap_atomic (kaddr); +flush_dcache_page (dst); + +return ret; }static gfp_t __get_fault_gfp_mask (struct vm_area_struct *vma)
@@ -2514,7 +2576,19 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) vmf->address);if (!new_page) goto oom; -cow_user_page (new_page, old_page, vmf->address, vma); + +if (!cow_user_page (new_page, old_page, vmf)) { +/* +* COW failed, if the fault was solved by other, +* it's fine. If not, userspace would re-fault on +* the same address and we will handle the fault +* from the second attempt. +*/ +put_page (new_page); +if (old_page) +put_page (old_page); +return 0 ; + } }if (mem_cgroup_try_charge_delay (new_page, mm,GFP_KERNEL , &memcg, false))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 3/245 dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling)
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
[ Upstream commit 9c98f021e4e717ffd9948fa65340ea3ef12b7935 ]
Make dma_fence_enable_sw_signaling() behave like its dma_fence_add_callback() and dma_fence_default_wait() counterparts and perform the test to enable signaling under the fence->lock, along with the action to do so. This ensure that should an implementation be trying to flush the cb_list (by signaling) on retirement before freeing the fence, it can do so in a race-free manner.
See also 0fc89b6802ba ("dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal").
v2: Refactor all 3 enable_signaling paths to use a common function.
v3: Don't argue, just keep the tracepoint in the existing spot.
--- drivers/dma-buf/dma-fence.c | 78 +++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 43 deletions(-)
drivers/dma-buf/dma-fence.c +35 -43
@@ -244,6 +244,30 @@ void dma_fence_free(struct dma_fence *fence) }EXPORT_SYMBOL (dma_fence_free); +static bool __dma_fence_enable_signaling (struct dma_fence *fence) +{ +bool was_set; + +lockdep_assert_held (fence->lock); + + was_set =test_and_set_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , + &fence->flags); + +if (test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags)) +return false; + +if (!was_set && fence->ops->enable_signaling) { +trace_dma_fence_enable_signal (fence); + +if (!fence->ops->enable_signaling (fence)) { +dma_fence_signal_locked (fence); +return false; + } + } + +return true; +} +/** * dma_fence_enable_sw_signaling - enable signaling on fence * @fence: the fence to enable
@@ -256,19 +280,12 @@ void dma_fence_enable_sw_signaling(struct dma_fence *fence) {unsigned long flags; -if (!test_and_set_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , - &fence->flags) && - !test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags) && - fence->ops->enable_signaling) { -trace_dma_fence_enable_signal (fence); - -spin_lock_irqsave (fence->lock, flags); - -if (!fence->ops->enable_signaling (fence)) -dma_fence_signal_locked (fence); +if (test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags)) +return ; -spin_unlock_irqrestore (fence->lock, flags); - } +spin_lock_irqsave (fence->lock, flags); +__dma_fence_enable_signaling (fence); +spin_unlock_irqrestore (fence->lock, flags); }EXPORT_SYMBOL (dma_fence_enable_sw_signaling);
@@ -302,7 +319,6 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb, {unsigned long flags;int ret =0 ; -bool was_set;if (WARN_ON (!fence || !func))return -EINVAL ;
@@ -314,25 +330,14 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,spin_lock_irqsave (fence->lock, flags); - was_set =test_and_set_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , - &fence->flags); - -if (test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags)) - ret = -ENOENT ; -else if (!was_set && fence->ops->enable_signaling) { -trace_dma_fence_enable_signal (fence); - -if (!fence->ops->enable_signaling (fence)) { -dma_fence_signal_locked (fence); - ret = -ENOENT ; - } - } - -if (!ret) { +if (__dma_fence_enable_signaling (fence)) { cb->func = func;list_add_tail (&cb->node, &fence->cb_list); - }else + }else {INIT_LIST_HEAD (&cb->node); + ret = -ENOENT ; + } +spin_unlock_irqrestore (fence->lock, flags);return ret;
@@ -432,7 +437,6 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)struct default_wait_cb cb;unsigned long flags;signed long ret = timeout ? timeout :1 ; -bool was_set;if (test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags))return ret;
@@ -444,21 +448,9 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout) goto out; } - was_set =test_and_set_bit (DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT , - &fence->flags); - -if (test_bit (DMA_FENCE_FLAG_SIGNALED_BIT , &fence->flags)) +if (!__dma_fence_enable_signaling (fence)) goto out; -if (!was_set && fence->ops->enable_signaling) { -trace_dma_fence_enable_signal (fence); - -if (!fence->ops->enable_signaling (fence)) { -dma_fence_signal_locked (fence); - goto out; - } - } -if (!timeout) { ret =0 ; goto out;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 2/245 media: mc-device.c: fix memleak in media_device_register_entity
In reply to Greg Kroah-HartmanFrom: zhengbin <[email protected]>
[ Upstream commit 713f871b30a66dc4daff4d17b760c9916aaaf2e1 ]
In media_device_register_entity, if media_graph_walk_init fails, need to free the previously memory.
--- drivers/media/media-device.c | 65 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 32 deletions(-)
drivers/media/media-device.c +33 -32
@@ -568,6 +568,38 @@ static void media_device_release(struct media_devnode *devnode)dev_dbg (devnode->parent,"Media device released\n" ); } +static void __media_device_unregister_entity (struct media_entity *entity) +{ +struct media_device *mdev = entity->graph_obj.mdev; +struct media_link *link, *tmp; +struct media_interface *intf; +unsigned int i; + +ida_free (&mdev->entity_internal_idx, entity->internal_idx); + +/* Remove all interface links pointing to this entity */ +list_for_each_entry (intf, &mdev->interfaces, graph_obj.list) { +list_for_each_entry_safe (link, tmp, &intf->links, list) { +if (link->entity == entity) +__media_remove_intf_link (link); + } + } + +/* Remove all data links that belong to this entity */ +__media_entity_remove_links (entity); + +/* Remove all pads that belong to this entity */ +for (i =0 ; i < entity->num_pads; i++) +media_gobj_destroy (&entity->pads[i].graph_obj); + +/* Remove the entity */ +media_gobj_destroy (&entity->graph_obj); + +/* invoke entity_notify callbacks to handle entity removal?? */ + + entity->graph_obj.mdev =NULL ; +} +/** * media_device_register_entity - Register an entity with a media device * @mdev: The media device
@@ -625,6 +657,7 @@ int __must_check media_device_register_entity(struct media_device *mdev,*/ ret =media_graph_walk_init (&new, mdev);if (ret) { +__media_device_unregister_entity (entity);mutex_unlock (&mdev->graph_mutex);return ret; }
@@ -637,38 +670,6 @@ int __must_check media_device_register_entity(struct media_device *mdev, }EXPORT_SYMBOL_GPL (media_device_register_entity); -static void __media_device_unregister_entity (struct media_entity *entity) -{ -struct media_device *mdev = entity->graph_obj.mdev; -struct media_link *link, *tmp; -struct media_interface *intf; -unsigned int i; - -ida_free (&mdev->entity_internal_idx, entity->internal_idx); - -/* Remove all interface links pointing to this entity */ -list_for_each_entry (intf, &mdev->interfaces, graph_obj.list) { -list_for_each_entry_safe (link, tmp, &intf->links, list) { -if (link->entity == entity) -__media_remove_intf_link (link); - } - } - -/* Remove all data links that belong to this entity */ -__media_entity_remove_links (entity); - -/* Remove all pads that belong to this entity */ -for (i =0 ; i < entity->num_pads; i++) -media_gobj_destroy (&entity->pads[i].graph_obj); - -/* Remove the entity */ -media_gobj_destroy (&entity->graph_obj); - -/* invoke entity_notify callbacks to handle entity removal?? */ - - entity->graph_obj.mdev =NULL ; -} -void media_device_unregister_entity (struct media_entity *entity) {struct media_device *mdev = entity->graph_obj.mdev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 1/245 selinux: allow labeling before policy is loaded
In reply to Greg Kroah-HartmanFrom: Jonathan Lebon <[email protected]>
[ Upstream commit 3e3e24b42043eceb97ed834102c2d094dfd7aaa6 ]
Currently, the SELinux LSM prevents one from setting the security.selinux xattr on an inode without a policy first being loaded. However, this restriction is problematic: it makes it impossible to have newly created files with the correct label before actually loading the policy.
This is relevant in distributions like Fedora, where the policy is loaded by systemd shortly after pivoting out of the initrd. In such instances, all files created prior to pivoting will be unlabeled. One then has to relabel them after pivoting, an operation which inherently races with other processes trying to access those same files.
Going further, there are use cases for creating the entire root filesystem on first boot from the initrd (e.g. Container Linux supports this today[1], and we'd like to support it in Fedora CoreOS as well[2]). One can imagine doing this in two ways: at the block device level (e.g. laying down a disk image), or at the filesystem level. In the former, labeling can simply be part of the image. But even in the latter scenario, one still really wants to be able to set the right labels when populating the new filesystem.
This patch enables this by changing behaviour in the following two ways:
1. allow setxattr if we're not initialized
2. don't try to set the in-core inode SID if we're not initialized; instead leave it as LABEL_INVALID so that revalidation may be attempted at a later time
Note the first hunk of this patch is mostly the same as a previously discussed one[3], though it was part of a larger series which wasn't accepted.
[1] https://coreos.com/os/docs/latest/root-filesystem-placement.html
[2] https://github.com/coreos/fedora-coreos-tracker/issues/94
[3] https://www.spinics.net/lists/linux-initramfs/msg04593.html
--- security/selinux/hooks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
security/selinux/hooks.c +12 -0
@@ -3304,6 +3304,9 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name,return dentry_has_perm (current_cred (), dentry,FILE__SETATTR ); } +if (!selinux_state.initialized) +return (inode_owner_or_capable (inode) ?0 : -EPERM ); + sbsec = inode->i_sb->s_security;if (!(sbsec->flags &SBLABEL_MNT ))return -EOPNOTSUPP ;
@@ -3387,6 +3390,15 @@ static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name,return ; } +if (!selinux_state.initialized) { +/* If we haven't even been initialized, then we can't validate +* against a policy, so leave the label as invalid. It may +* resolve to a valid label on the next revalidation try if +* we've since initialized. +*/ +return ; + } + rc =security_context_to_sid_force (&selinux_state, value, size, &newsid);if (rc) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 5/245 ath10k: fix memory leak for tpc_stats_final
In reply to Greg Kroah-HartmanFrom: Miaoqing Pan <[email protected]>
[ Upstream commit 486a8849843455298d49e694cca9968336ce2327 ]
The memory of ar->debug.tpc_stats_final is reallocated every debugfs reading, it should be freed in ath10k_debug_destroy() for the last allocation.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/debug.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/debug.c +1 -0
@@ -2365,6 +2365,7 @@ void ath10k_debug_destroy(struct ath10k *ar)ath10k_debug_fw_stats_reset (ar);kfree (ar->debug.tpc_stats); +kfree (ar->debug.tpc_stats_final); }int ath10k_debug_register (struct ath10k *ar)
Signature · 1 line
2.25.1
Re: [PATCH 4.19 146/245] perf stat: Force error in fallback on :k events
In reply to Greg Kroah-HartmanQuoted 81 lines · Greg Kroah-Hartman
From: 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= 1The fallback code would add:
attr->exclude_kernel= 1In 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 1Performance 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 (withoutCAP_PERFMONorCAP_SYS_ADMIN).The current value is 2:
-1: Allow use of (almost) all events by all users
Ignore mlock limit afterperf_event_mlock_kbwithoutCAP_IPC_LOCKQuoted 1 line
= 0: Disallow ftrace function tracepoint by users without
CAP_PERFMONorCAP_SYS_ADMINDisallow raw tracepoint access by users without
CAP_SYS_PERFMONorCAP_SYS_ADMINQuoted 2 lines
= 1: Disallow CPU event access by users without
CAP_PERFMONorCAP_SYS_ADMIN= 2: Disallow kernel profiling by users withoutCAP_PERFMONorCAP_SYS_ADMINTo make this setting permanent, edit
/etc/sysctl.conftoo, e.g.:kernel.perf_event_paranoid = -1
v2 of this patch addresses the review feedback from [email protected].
Quoted 12 lines
Signed-off-by Stephane Eranian <[email protected]>Reviewed-by Ian Rogers <[email protected]>Acked-by Jiri Olsa <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Jiri Olsa <[email protected]>Cc Mark Rutland <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Sasha Levin <[email protected]>
perf failed on stable rc branch 4.19 on all devices.
build warning and errors,
-----------------------------------
In file included from util/evlist.h:15:0,
from util/evsel.c:30:
util/evsel.c: In function 'perf_evsel__exit':
util/util.h:25:28: warning: passing argument 1 of 'free' discards
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
^util/evsel.c:1293:2: note: in expansion of macro 'zfree'
zfree(&evsel->pmu_name);
^~~~~
In file included from /srv/oe/build/tmp-lkft-glibc/work/intel_corei7_64-linaro-linux/perf/1.0-r9/perf-1.0/tools/perf/arch/x86/include/perf_regs.h:5:0,
from util/perf_regs.h:27,
from util/event.h:11,
from util/callchain.h:8,
from util/evsel.c:26:
perf/1.0-r9/recipe-sysroot/usr/include/stdlib.h:563:13: note: expected
'void *' but argument is of type 'const char *'
extern void free (void *__ptr) __THROW;
^~~~util/evsel.c: In function 'perf_evsel__fallback':util/evsel.c:2802:14: error: 'struct perf_evsel' has no member named 'core'; did you mean 'node'?
if (evsel->core.attr.exclude_user)
^~~~
nodeQuoted 24 lines
--- tools/perf/util/evsel.c | 4 ++++ 1 file changed, 4 insertions(+)tools/perf/util/evsel.c +4
-1@@ -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,':' )) --2.25.1
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.149 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 01 Oct 2020 10:59:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.149-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
<trim>
Quoted 3 lines
Stephane Eranian <[email protected]>
perf stat: Force error in fallback on :k events
perf failed on stable rc branch 4.19 on all devices.
In file included from util/evlist.h:15:0,
from util/evsel.c:30:
util/evsel.c: In function 'perf_evsel__exit':
util/util.h:25:28: warning: passing argument 1 of 'free' discards
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
^util/evsel.c:1293:2: note: in expansion of macro 'zfree'
zfree(&evsel->pmu_name);
^~~~~
In file included from /srv/oe/build/tmp-lkft-glibc/work/intel_corei7_64-linaro-linux/perf/1.0-r9/perf-1.0/tools/perf/arch/x86/include/perf_regs.h:5:0,
from util/perf_regs.h:27,
from util/event.h:11,
from util/callchain.h:8,
from util/evsel.c:26:
perf/1.0-r9/recipe-sysroot/usr/include/stdlib.h:563:13: note: expected
'void *' but argument is of type 'const char *'
extern void free (void *__ptr) __THROW;
^~~~util/evsel.c: In function 'perf_evsel__fallback':util/evsel.c:2802:14: error: 'struct perf_evsel' has no member named 'core'; did you mean 'node'?
if (evsel->core.attr.exclude_user)
^~~~
nodeSignature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 146/245] perf stat: Force error in fallback on :k events
In reply to Naresh KambojuQuoted 122 lines · Naresh Kamboju
Quoted 81 lines · Greg Kroah-Hartman
From: 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= 1The fallback code would add:
attr->exclude_kernel= 1In 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 1Performance 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 (withoutCAP_PERFMONorCAP_SYS_ADMIN).The current value is 2:
-1: Allow use of (almost) all events by all users
Ignore mlock limit afterperf_event_mlock_kbwithoutCAP_IPC_LOCKQuoted 1 line
= 0: Disallow ftrace function tracepoint by users without
CAP_PERFMONorCAP_SYS_ADMINDisallow raw tracepoint access by users without
CAP_SYS_PERFMONorCAP_SYS_ADMINQuoted 2 lines
= 1: Disallow CPU event access by users without
CAP_PERFMONorCAP_SYS_ADMIN= 2: Disallow kernel profiling by users withoutCAP_PERFMONorCAP_SYS_ADMINTo make this setting permanent, edit
/etc/sysctl.conftoo, e.g.:kernel.perf_event_paranoid = -1
v2 of this patch addresses the review feedback from [email protected].
Quoted 12 lines
Signed-off-by Stephane Eranian <[email protected]>Reviewed-by Ian Rogers <[email protected]>Acked-by Jiri Olsa <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Jiri Olsa <[email protected]>Cc Mark Rutland <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Sasha Levin <[email protected]>perf failed on stable rc branch 4.19 on all devices.
Reported-by Naresh Kamboju <[email protected]>build warning and errors,
-----------------------------------
In file included fromutil/evlist.h:15:0,from util/evsel.c:30: util/evsel.c: In function 'perf_evsel__exit': util/util.h:25:28: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] #define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) ^
util/evsel.c:1293:2: note: in expansion of macro 'zfree'
zfree(&evsel->pmu_name);
^~~~~
In file included from/srv/oe/build/tmp-lkft-glibc/work/intel_corei7_64-linaro-linux/perf/1.0-r9/perf-1.0/tools/perf/arch/x86/include/perf_regs.h:5:0,from util/perf_regs.h:27, from util/event.h:11, from util/callchain.h:8, from util/evsel.c:26: perf/1.0-r9/recipe-sysroot/usr/include/stdlib.h:563:13: note: expected 'void *' but argument is of type 'const char *' extern void free (void *__ptr) __THROW; ^~~~
Quoted 6 lines
util/evsel.c: In function 'perf_evsel__fallback':util/evsel.c:2802:14: error: 'structperf_evsel' has no member named 'core'; did you mean 'node'?
if (evsel->core.attr.exclude_user)^~~~ node
I thought Sasha had dropped all of the offending patches. I'll go drop this one and push out a new 4.19-rc release.
But note, the latest 4.19.y tree doesn't even build perf for me, so I can't really check this locally :(
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.149 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 01 Oct 2020 10:59:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.149-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
14 builds: 14 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 4.19.149-rc1-gf0a043791d0e
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Sasha Levin
maintainerRe: [PATCH 4.19 146/245] perf stat: Force error in fallback on :k events
In reply to Greg Kroah-HartmanQuoted 130 lines · Greg Kroah-Hartman
Quoted 122 lines · Naresh Kamboju
Quoted 81 lines · Greg Kroah-Hartman
From: 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= 1The fallback code would add:
attr->exclude_kernel= 1In 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 1Performance 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 (withoutCAP_PERFMONorCAP_SYS_ADMIN).The current value is 2:
-1: Allow use of (almost) all events by all users
Ignore mlock limit afterperf_event_mlock_kbwithoutCAP_IPC_LOCKQuoted 1 line
= 0: Disallow ftrace function tracepoint by users without
CAP_PERFMONorCAP_SYS_ADMINDisallow raw tracepoint access by users without
CAP_SYS_PERFMONorCAP_SYS_ADMINQuoted 2 lines
= 1: Disallow CPU event access by users without
CAP_PERFMONorCAP_SYS_ADMIN= 2: Disallow kernel profiling by users withoutCAP_PERFMONorCAP_SYS_ADMINTo make this setting permanent, edit
/etc/sysctl.conftoo, e.g.:kernel.perf_event_paranoid = -1
v2 of this patch addresses the review feedback from [email protected].
Quoted 12 lines
Signed-off-by Stephane Eranian <[email protected]>Reviewed-by Ian Rogers <[email protected]>Acked-by Jiri Olsa <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Jiri Olsa <[email protected]>Cc Mark Rutland <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Sasha Levin <[email protected]>perf failed on stable rc branch 4.19 on all devices.
Reported-by Naresh Kamboju <[email protected]>build warning and errors,
-----------------------------------
In file included fromutil/evlist.h:15:0,from util/evsel.c:30: util/evsel.c: In function 'perf_evsel__exit': util/util.h:25:28: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] #define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) ^
util/evsel.c:1293:2: note: in expansion of macro 'zfree'
zfree(&evsel->pmu_name);
^~~~~
In file included from/srv/oe/build/tmp-lkft-glibc/work/intel_corei7_64-linaro-linux/perf/1.0-r9/perf-1.0/tools/perf/arch/x86/include/perf_regs.h:5:0,from util/perf_regs.h:27, from util/event.h:11, from util/callchain.h:8, from util/evsel.c:26: perf/1.0-r9/recipe-sysroot/usr/include/stdlib.h:563:13: note: expected 'void *' but argument is of type 'const char *' extern void free (void *__ptr) __THROW; ^~~~Quoted 6 lines
util/evsel.c: In function 'perf_evsel__fallback':util/evsel.c:2802:14: error: 'structperf_evsel' has no member named 'core'; did you mean 'node'?
if (evsel->core.attr.exclude_user)^~~~ node
Quoted 2 lines
I thought Sasha had dropped all of the offending patches. I'll go drop this one and push out a new 4.19-rc release.
I did, looks like this a new report.
Quoted 2 lines
But note, the latest 4.19.y tree doesn't even build perf for me, so I can't really check this locally :(
Same here. Naresh, does perf builds "out of the box" for you, or do you carry any patches on top?
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 4.19 054/245] scsi: ufs: Make ufshcd_add_command_trace() easier to read
In reply to Greg Kroah-HartmanHi!
Quoted 7 lines
From: Bart Van Assche <[email protected]>
[ Upstream commit
e4d2add7fd5bc64ee3e388eabe6b9e081cb42e11]Since the
lrbp->cmdexpression occurs multiple times, introduce a new local variable to hold that pointer. This patch does not change any functionality.
This is just a cleanup, AFAICT, and there's no patch that depends on it in 4.19-stable.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 196/245] nvme: fix possible deadlock when I/O is blocked
In reply to Greg Kroah-HartmanHi!
Quoted 14 lines
[ Upstream commit
3b4b19721ec652ad2c4fe51dfbe5124212b5f581]Revert
fab7772bfbcf("nvme-multipath: revalidatenvme_ns_headgendisk innvme_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 thescan_workwhich holds thescan_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 diskbd_mutexas both partition scan I/O takes it, and head disk revalidation takes it to check for resize (also triggered fromscan_workon a different path). See trace [1].
Quoted 5 lines
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 useset_capacity_revalidate_and_notify") which already updates resize info without unnecessarily revalidating the disk (the mpath disk doesn't even implement .revalidate_disk fop).
Commit cb224c3af4df ("nvme: Convert to use set_capacity_revalidate_and_notify") is not in 4.19-stable.
Does that mean we'll no longer detect disk size changes after this?
Best regards,
Pavel
Quoted 11 lines
index
faa7feebb6095..84fcfcdb8ba5f100644drivers/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 · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 144/245] serial: uartps: Wait for tx_empty in console setup
In reply to Greg Kroah-HartmanHi!
Quoted 12 lines
From: Raviteja Narayanam <[email protected]>
[ Upstream commit
42e11948ddf68b9f799cad8c0ddeab0a39da33e8]On some platforms, the log is corrupted while console is being registered. It is observed that when
set_termiosis called, there are still some bytes in the FIFO to be transmitted.So, wait for
tx_emptyinsidecdns_uart_console_setupbefore callingset_termios.
drivers/tty/serial/xilinx_uartps.c static int cdns_uart_console_setup(struct console *co, char *options) · line 1256
Quoted 10 lines
drivers/tty/serial/xilinx_uartps.c +7
-0@@ -1246,6 +1247,13 @@ static int cdns_uart_console_setup(struct console *co, char *options)if (options)uart_parse_options (options, &baud, &parity, &bits, &flow); +/* Wait for tx_empty before setting up the console */ + time_out = jiffies +usecs_to_jiffies (TX_TIMEOUT ); + +while (time_before (jiffies, time_out) && +cdns_uart_tx_empty (port) !=TIOCSER_TEMT ) +cpu_relax (); +
So this is spinning for half a second. Could we use msleep(1) instead of cpu_relax or something like that?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerQuoted 16 lines · Pavel Machek
Hi!
Quoted 5 lines
This is the start of the stable review cycle for the 4.19.149 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 01 Oct 2020 10:59:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.149-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.
Quoted 6 lines
No problems detected by CIP testing:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/195833156
The failures are caused by boards being offline; they are not caused by kernel problems.
Thanks for testing two of these and letting me know.
greg k-h