4.4.134-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 168/268 mm: fix races between address_space dereference and free in page_evicatable
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
[ Upstream commit e92bb4dd9673945179b1fc738c9817dd91bfb629 ]
When page_mapping() is called and the mapping is dereferenced in page_evicatable() through shrink_active_list(), it is possible for the inode to be truncated and the embedded address space to be freed at the same time. This may lead to the following race.
CPU1 CPU2
truncate(inode) shrink_active_list()
... page_evictable(page)
truncate_inode_page(mapping, page);
delete_from_page_cache(page)
spin_lock_irqsave(&mapping->tree_lock, flags);
__delete_from_page_cache(page, NULL)
page_cache_tree_delete(..)
... mapping = page_mapping(page);
page->mapping = NULL;
...
spin_unlock_irqrestore(&mapping->tree_lock, flags);
page_cache_free_page(mapping, page)
put_page(page)
if (put_page_testzero(page)) -> false- inode now has no pages and can be freed including embedded address_space
mapping_unevictable(mapping) test_bit(AS_UNEVICTABLE, &mapping->flags);
- we've dereferenced mapping which is potentially already free.
Similar race exists between swap cache freeing and page_evicatable() too.
The address_space in inode and swap cache will be freed after a RCU grace period. So the races are fixed via enclosing the page_mapping() and address_space usage in rcu_read_lock/unlock(). Some comments are added in code to make it clear what is protected by the RCU read lock.
--- mm/vmscan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
mm/vmscan.c +7 -1
@@ -3841,7 +3841,13 @@ int zone_reclaim(struct zone *zone, gfp_*/ int page_evictable (struct page *page) { -return !mapping_unevictable (page_mapping (page)) && !PageMlocked (page); +int ret; + +/* Prevent address_space of inode and swap cache from being freed */ +rcu_read_lock (); + ret = !mapping_unevictable (page_mapping (page)) && !PageMlocked (page); +rcu_read_unlock (); +return ret; }#ifdef CONFIG_SHMEM
Greg Kroah-Hartman
maintainerPATCH 169/268 Btrfs: bail out on error during replay_dir_deletes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 ]
If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs to bail out, otherwise @ret would be forced to be 0 after 'break;' and the caller won't be aware of it.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -2223,8 +2223,10 @@ again: nritems =btrfs_header_nritems (path->nodes[0 ]);if (path->slots[0 ] >= nritems) { ret =btrfs_next_leaf (root, path); -if (ret) +if (ret ==1 )break ; +else if (ret <0 ) + goto out; }btrfs_item_key_to_cpu (path->nodes[0 ], &found_key, path->slots[0 ]);
Greg Kroah-Hartman
maintainerPATCH 170/268 Btrfs: fix NULL pointer dereference in log_dir_items
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit 80c0b4210a963e31529e15bf90519708ec947596 ]
0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is returned, path->nodes[0] could be NULL, log_dir_items lacks such a check for <0 and we may run into a null pointer dereference panic.
--- fs/btrfs/tree-log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +5 -2
@@ -3380,8 +3380,11 @@ static noinline int log_dir_items(struct* from this directory and from this transaction */ ret =btrfs_next_leaf (root, path); -if (ret ==1 ) { - last_offset = (u64)-1 ; +if (ret) { +if (ret ==1 ) + last_offset = (u64)-1 ; +else + err = ret; goto done; }btrfs_item_key_to_cpu (path->nodes[0 ], &tmp, path->slots[0 ]);
Greg Kroah-Hartman
maintainerPATCH 171/268 btrfs: Fix possible softlock on single core machines
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
[ Upstream commit 1e1c50a929bc9e49bc3f9935b92450d9e69f8158 ]
do_chunk_alloc implements a loop checking whether there is a pending chunk allocation and if so causes the caller do loop. Generally this loop is executed only once, however testing with btrfs/072 on a single core vm machines uncovered an extreme case where the system could loop indefinitely. This is due to a missing cond_resched when loop which doesn't give a chance to the previous chunk allocator finish its job.
The fix is to simply add the missing cond_resched.
--- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
@@ -4392,6 +4392,7 @@ again:if (wait_for_alloc) {mutex_unlock (&fs_info->chunk_mutex); wait_for_alloc =0 ; +cond_resched (); goto again; }
Greg Kroah-Hartman
maintainerPATCH 172/268 ocfs2/dlm: dont handle migrate lockres if already in shutdown
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun Piao <[email protected]>
[ Upstream commit bb34f24c7d2c98d0c81838a7700e6068325b17a0 ]
We should not handle migrate lockres if we are already in 'DLM_CTXT_IN_SHUTDOWN', as that will cause lockres remains after leaving dlm domain. At last other nodes will get stuck into infinite loop when requsting lock from us.
The problem is caused by concurrency umount between nodes. Before receiveing N1's DLM_BEGIN_EXIT_DOMAIN_MSG, N2 has picked up N1 as the migrate target. So N2 will continue sending lockres to N1 even though N1 has left domain.
N1 N2 (owner)
touch file
access the file,
and get pr lock
begin leave domain and pick up N1 as new owner
begin leave domain and
migrate all lockres done
begin migrate lockres to N1
end leave domain, but
the lockres left
unexpectedly, because
migrate task has passed
--- fs/ocfs2/dlm/dlmdomain.c | 14 -------------- fs/ocfs2/dlm/dlmdomain.h | 25 ++++++++++++++++++++++++- fs/ocfs2/dlm/dlmrecovery.c | 9 +++++++++ 3 files changed, 33 insertions(+), 15 deletions(-)
fs/ocfs2/dlm/dlmdomain.c +0 -14
@@ -674,20 +674,6 @@ static void dlm_leave_domain(struct dlm_spin_unlock (&dlm->spinlock); } -int dlm_shutting_down (struct dlm_ctxt *dlm) -{ -int ret =0 ; - -spin_lock (&dlm_domain_lock); - -if (dlm->dlm_state ==DLM_CTXT_IN_SHUTDOWN ) - ret =1 ; - -spin_unlock (&dlm_domain_lock); - -return ret; -} -void dlm_unregister_domain (struct dlm_ctxt *dlm) {int leave =0 ;
fs/ocfs2/dlm/dlmdomain.h +24 -1
@@ -28,7 +28,30 @@extern spinlock_t dlm_domain_lock;extern struct list_head dlm_domains; -int dlm_shutting_down (struct dlm_ctxt *dlm); +static inline int dlm_joined (struct dlm_ctxt *dlm) +{ +int ret =0 ; + +spin_lock (&dlm_domain_lock); +if (dlm->dlm_state ==DLM_CTXT_JOINED ) + ret =1 ; +spin_unlock (&dlm_domain_lock); + +return ret; +} + +static inline int dlm_shutting_down (struct dlm_ctxt *dlm) +{ +int ret =0 ; + +spin_lock (&dlm_domain_lock); +if (dlm->dlm_state ==DLM_CTXT_IN_SHUTDOWN ) + ret =1 ; +spin_unlock (&dlm_domain_lock); + +return ret; +} +void dlm_fire_domain_eviction_callbacks (struct dlm_ctxt *dlm,int node_num);
fs/ocfs2/dlm/dlmrecovery.c +9 -0
@@ -1377,6 +1377,15 @@ int dlm_mig_lockres_handler(struct o2netif (!dlm_grab (dlm))return -EINVAL ; +if (!dlm_joined (dlm)) { +mlog (ML_ERROR ,"Domain %s not joined! " +"lockres %.*s, master %u\n" , + dlm->name, mres->lockname_len, + mres->lockname, mres->master); +dlm_put (dlm); +return -EINVAL ; + } +BUG_ON (!(mres->flags & (DLM_MRES_RECOVERY |DLM_MRES_MIGRATION ))); real_master = mres->master;
Greg Kroah-Hartman
maintainerPATCH 173/268 sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit d29a20645d5e929aa7e8616f28e5d8e1c49263ec ]
While running rt-tests' pi_stress program I got the following splat:
rq->clock_update_flags < RQCF_ACT_SKIP
WARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20
[...]
<IRQ> enqueue_top_rt_rq+0xf4/0x150 ? cpufreq_dbs_governor_start+0x170/0x170 sched_rt_rq_enqueue+0x65/0x80 sched_rt_period_timer+0x156/0x360 ? sched_rt_rq_enqueue+0x80/0x80 __hrtimer_run_queues+0xfa/0x260 hrtimer_interrupt+0xcb/0x220 smp_apic_timer_interrupt+0x62/0x120 apic_timer_interrupt+0xf/0x20 </IRQ>
[...]
do_idle+0x183/0x1e0 cpu_startup_entry+0x5f/0x70 start_secondary+0x192/0x1d0 secondary_startup_64+0xa5/0xb0
We can get rid of it be the "traditional" means of adding an update_rq_clock() call after acquiring the rq->lock in do_sched_rt_period_timer().
The case for the RT task throttling (which this workload also hits) can be ignored in that the skip_update call is actually bogus and quite the contrary (the request bits are removed/reverted).
By setting RQCF_UPDATED we really don't care if the skip is happening or not and will therefore make the assert_clock_updated() check happy.
--- kernel/sched/rt.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/rt.c +2 -0
@@ -822,6 +822,8 @@ static int do_sched_rt_period_timer(strustruct rq *rq =rq_of_rt_rq (rt_rq);raw_spin_lock (&rq->lock); +update_rq_clock (rq); +if (rt_rq->rt_time) {u64 runtime;
Greg Kroah-Hartman
maintainerPATCH 175/268 fscache: Fix hanging wait on page discarded by writeback
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 2c98425720233ae3e135add0c7e869b32913502f ]
If the fscache asynchronous write operation elects to discard a page that's pending storage to the cache because the page would be over the store limit then it needs to wake the page as someone may be waiting on completion of the write.
The problem is that the store limit may be updated by a different asynchronous operation - and so may miss the write - and that the store limit may not even get updated until later by the netfs.
Fix the kernel hang by making fscache_write_op() mark as written any pages that are over the limit.
--- fs/fscache/page.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/fscache/page.c +9 -4
@@ -776,6 +776,7 @@ static void fscache_write_op(struct fsca_enter ("{OP%x,%d}" , op->op.debug_id,atomic_read (&op->op.usage)); +again:spin_lock (&object->lock); cookie = object->cookie;
@@ -816,10 +817,6 @@ static void fscache_write_op(struct fsca goto superseded; page = results[0 ];_debug ("gang %d [%lx]" , n, page->index); -if (page->index >= op->store_limit) { -fscache_stat (&fscache_n_store_pages_over_limit); - goto superseded; - }radix_tree_tag_set (&cookie->stores, page->index,FSCACHE_COOKIE_STORING_TAG );
@@ -829,6 +826,9 @@ static void fscache_write_op(struct fscaspin_unlock (&cookie->stores_lock);spin_unlock (&object->lock); +if (page->index >= op->store_limit) + goto discard_page; +fscache_stat (&fscache_n_store_pages);fscache_stat (&fscache_n_cop_write_page); ret = object->cache->ops->write_page (op, page);
@@ -844,6 +844,11 @@ static void fscache_write_op(struct fsca_leave ("" );return ; +discard_page: +fscache_stat (&fscache_n_store_pages_over_limit); +fscache_end_page_write (object, page); + goto again; + superseded:/* this writer is going away and there aren't any more things to * write */
Greg Kroah-Hartman
maintainerPATCH 177/268 rtc: snvs: Fix usage of snvs_rtc_enable
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
[ Upstream commit 1485991c024603b2fb4ae77beb7a0d741128a48e ]
commit 179a502f8c46 ("rtc: snvs: add Freescale rtc-snvs driver") introduces the SNVS RTC driver with a function snvs_rtc_enable().
snvs_rtc_enable() can return an error on the enable path however this driver does not currently trap that failure on the probe() path and consequently if enabling the RTC fails we encounter a later error spinning forever in rtc_write_sync_lp().
[ 36.093481] [<c010d630>] (__irq_svc) from [<c0c2e9ec>] (_raw_spin_unlock_irqrestore+0x34/0x44) [ 36.102122] [<c0c2e9ec>] (_raw_spin_unlock_irqrestore) from [<c072e32c>] (regmap_read+0x4c/0x5c) [ 36.110938] [<c072e32c>] (regmap_read) from [<c085d0f4>] (rtc_write_sync_lp+0x6c/0x98) [ 36.118881] [<c085d0f4>] (rtc_write_sync_lp) from [<c085d160>] (snvs_rtc_alarm_irq_enable+0x40/0x4c) [ 36.128041] [<c085d160>] (snvs_rtc_alarm_irq_enable) from [<c08567b4>] (rtc_timer_do_work+0xd8/0x1a8) [ 36.137291] [<c08567b4>] (rtc_timer_do_work) from [<c01441b8>] (process_one_work+0x28c/0x76c) [ 36.145840] [<c01441b8>] (process_one_work) from [<c01446cc>] (worker_thread+0x34/0x58c) [ 36.153961] [<c01446cc>] (worker_thread) from [<c014aee4>] (kthread+0x138/0x150) [ 36.161388] [<c014aee4>] (kthread) from [<c0107e14>] (ret_from_fork+0x14/0x20) [ 36.168635] rcu_sched kthread starved for 2602 jiffies! g496 c495 f0x2 RCU_GP_WAIT_FQS(3) ->state=0x0 ->cpu=0 [ 36.178564] rcu_sched R running task 0 8 2 0x00000000 [ 36.185664] [<c0c288b0>] (__schedule) from [<c0c29134>] (schedule+0x3c/0xa0) [ 36.192739] [<c0c29134>] (schedule) from [<c0c2db80>] (schedule_timeout+0x78/0x4e0) [ 36.200422] [<c0c2db80>] (schedule_timeout) from [<c01a7ab0>] (rcu_gp_kthread+0x648/0x1864) [ 36.208800] [<c01a7ab0>] (rcu_gp_kthread) from [<c014aee4>] (kthread+0x138/0x150) [ 36.216309] [<c014aee4>] (kthread) from [<c0107e14>] (ret_from_fork+0x14/0x20)
This patch fixes by parsing the result of rtc_write_sync_lp() and propagating both in the probe and elsewhere. If the RTC doesn't start we don't proceed loading the driver and don't get into this loop mess later on.
--- drivers/rtc/rtc-snvs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/rtc/rtc-snvs.c +11 -4
@@ -132,20 +132,23 @@ static int snvs_rtc_set_time(struct devi {struct snvs_rtc_data *data =dev_get_drvdata (dev);unsigned long time; +int ret;rtc_tm_to_time (tm, &time);/* Disable RTC first */ -snvs_rtc_enable (data, false); + ret =snvs_rtc_enable (data, false); +if (ret) +return ret;/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */ regmap_write (data->regmap, data->offset +SNVS_LPSRTCLR , time <<CNTR_TO_SECS_SH );regmap_write (data->regmap, data->offset +SNVS_LPSRTCMR , time >> (32 -CNTR_TO_SECS_SH ));/* Enable RTC again */ -snvs_rtc_enable (data, true); + ret =snvs_rtc_enable (data, true); -return 0 ; +return ret; }static int snvs_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alrm)
@@ -287,7 +290,11 @@ static int snvs_rtc_probe(struct platforregmap_write (data->regmap, data->offset +SNVS_LPSR ,0xffffffff );/* Enable RTC */ -snvs_rtc_enable (data, true); + ret =snvs_rtc_enable (data, true); +if (ret) { +dev_err (&pdev->dev,"failed to enable rtc %d\n" , ret); + goto error_rtc_device_register; + }device_init_wakeup (&pdev->dev, true);
Greg Kroah-Hartman
maintainerPATCH 178/268 net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 60d6e6f0b9e422dd01aeda39257ee0428e5e2a3f ]
bgmac_dma_tx_ring_free() assigns the ctl1 word which is a litle endian 32-bit word without using proper accessors, fix this, and because a length cannot be negative, use unsigned int while at it.
--- drivers/net/ethernet/broadcom/bgmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac.c +2 -1
@@ -531,7 +531,8 @@ static void bgmac_dma_tx_ring_free(strucint i;for (i =0 ; i <BGMAC_TX_RING_SLOTS ; i++) { -int len = dma_desc[i].ctl1 &BGMAC_DESC_CTL1_LEN ; +u32 ctl1 =le32_to_cpu (dma_desc[i].ctl1); +unsigned int len = ctl1 &BGMAC_DESC_CTL1_LEN ; slot = &ring->slots[i];dev_kfree_skb (slot->skb);
Greg Kroah-Hartman
maintainerPATCH 179/268 Bluetooth: btusb: Add USB ID 7392:a611 for Edimax EW-7611ULB
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vicente Bergas <[email protected]>
[ Upstream commit a41e0796396eeceff673af4a38feaee149c6ff86 ]
This WiFi/Bluetooth USB dongle uses a Realtek chipset, so, use btrtl for it.
Product information:
https://wikidevi.com/wiki/Edimax_EW-7611ULB
Quoted 1 line
Quoted 1 line
From
/sys/kernel/debug/usb/devices
T: Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=7392 ProdID=a611 Rev= 2.00 S: Manufacturer=Realtek S: Product=Edimax Wi-Fi N150 Bluetooth4.0 USB Adapter S: SerialNumber=00e04c000001 C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms I:* If#= 2 Alt= 0 #EPs= 6 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8723bu E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=500us E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -336,6 +336,9 @@ static const struct usb_device_id blackl { USB_DEVICE(0x13d3, 0x3459), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3494), .driver_info = BTUSB_REALTEK }, + /* Additional Realtek 8723BU Bluetooth devices */ + { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK }, + /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
Greg Kroah-Hartman
maintainerPATCH 180/268 btrfs: tests/qgroup: Fix wrong tree backref level
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a ]
The extent tree of the test fs is like the following:
BTRFS info (device (null)): leaf 16327509003777336587 total ptrs 1 free space 3919
item 0 key (4096 168 4096) itemoff 3944 itemsize 51
extent refs 1 gen 1 flags 2
tree block key (68719476736 0 0) level 1
^^^^^^^
ref#0: tree block backref root 5
And it's using an empty tree for fs tree, so there is no way that its level can be 1.
For REAL (created by mkfs) fs tree backref with no skinny metadata, the result should look like:
item 3 key (30408704 EXTENT_ITEM 4096) itemoff 3845 itemsize 51
refs 1 gen 4 flags TREE_BLOCK
tree block key (256 INODE_ITEM 0) level 0
^^^^^^^
tree block backref root 5
Fix the level to 0, so it won't break later tree level checker.
--- fs/btrfs/tests/qgroup-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tests/qgroup-tests.c +1 -1
@@ -70,7 +70,7 @@ static int insert_normal_tree_ref(structbtrfs_set_extent_generation (leaf, item,1 );btrfs_set_extent_flags (leaf, item,BTRFS_EXTENT_FLAG_TREE_BLOCK ); block_info = (struct btrfs_tree_block_info *)(item +1 ); -btrfs_set_tree_block_level (leaf, block_info,1 ); +btrfs_set_tree_block_level (leaf, block_info,0 ); iref = (struct btrfs_extent_inline_ref *)(block_info +1 );if (parent >0 ) { btrfs_set_extent_inline_ref_type(leaf, iref,
Greg Kroah-Hartman
maintainerPATCH 150/268 ARM: 8748/1: mm: Define vdso_start, vdso_end as array
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinbum Park <[email protected]>
[ Upstream commit 73b9160d0dfe44dfdaffd6465dc1224c38a4a73c ]
Define vdso_start, vdso_end as array to avoid compile-time analysis error for the case of built with CONFIG_FORTIFY_SOURCE.
and, since vdso_start, vdso_end are used in vdso.c only, move extern-declaration from vdso.h to vdso.c.
If kernel is built with CONFIG_FORTIFY_SOURCE,
compile-time error happens at this code.
- if (memcmp(&vdso_start, "177ELF", 4))
The size of "&vdso_start" is recognized as 1 byte, but n is 4, So that compile-time error is reported.
--- arch/arm/include/asm/vdso.h | 2 -- arch/arm/kernel/vdso.c | 12 +++++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/include/asm/vdso.h +0 -2
@@ -11,8 +11,6 @@ struct mm_struct;void arm_install_vdso (struct mm_struct *mm,unsigned long addr); -extern char vdso_start, vdso_end; -extern unsigned int vdso_total_pages;#else /* CONFIG_VDSO */
arch/arm/kernel/vdso.c +7 -5
@@ -38,6 +38,8 @@static struct page **vdso_text_pagelist; +extern char vdso_start[], vdso_end[]; +/* Total number of pages needed for the data and text portions of the VDSO. */ unsigned int vdso_total_pages__read_mostly ;
@@ -178,13 +180,13 @@ static int __init vdso_init(void)unsigned int text_pages;int i; -if (memcmp (&vdso_start,"\177ELF" ,4 )) { +if (memcmp (vdso_start,"\177ELF" ,4 )) {pr_err ("VDSO is not a valid ELF object!\n" );return -ENOEXEC ; } - text_pages = (&vdso_end - &vdso_start) >>PAGE_SHIFT ; -pr_debug ("vdso: %i text pages at base %p\n" , text_pages, &vdso_start); + text_pages = (vdso_end - vdso_start) >>PAGE_SHIFT ; +pr_debug ("vdso: %i text pages at base %p\n" , text_pages, vdso_start);/* Allocate the VDSO text pagelist */ vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
@@ -199,7 +201,7 @@ static int __init vdso_init(void)for (i =0 ; i < text_pages; i++) {struct page *page; - page =virt_to_page (&vdso_start + i *PAGE_SIZE ); + page =virt_to_page (vdso_start + i *PAGE_SIZE ); vdso_text_pagelist[i] = page; }
@@ -210,7 +212,7 @@ static int __init vdso_init(void) cntvct_ok =cntvct_functional (); -patch_vdso (&vdso_start); +patch_vdso (vdso_start);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 151/268 net: qmi_wwan: add BroadMobi BM806U 2020:2033
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit 743989254ea9f132517806d8893ca9b6cf9dc86b ]
BroadMobi BM806U is an Qualcomm MDM9225 based 3G/4G modem. Tested hardware BM806U is mounted on D-Link DWR-921-C3 router. The USB id is added to qmi_wwan.c to allow QMI communication with the BM806U.
Tested on 4.14 kernel and OpenWRT.
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -713,6 +713,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ + {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
Greg Kroah-Hartman
maintainerPATCH 152/268 net/usb/qmi_wwan.c: Add USB id for lt4120 modem
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Torsten Hilbrich <[email protected]>
[ Upstream commit f3d801baf118c9d452ee7c278df16880c892e669 ]
This is needed to support the modem found in HP EliteBook 820 G3.
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -763,6 +763,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ + {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
Greg Kroah-Hartman
maintainerPATCH 153/268 net-usb: add qmi_wwan if on lte modem wistron neweb d18q1
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giuseppe Lippolis <[email protected]>
[ Upstream commit d4c4bc11353f3bea6754f7d21e3612c9f32d1d64 ]
This modem is embedded on dlink dwr-921 router.
The oem configuration states:
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1435 ProdID=0918 Rev= 2.32
S: Manufacturer=Android
S: Product=Android
S: SerialNumber=0123456789ABCDEF
C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=84(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=86(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=125usTested on openwrt distribution
--- drivers/net/usb/qmi_wwan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/qmi_wwan.c +3 -0
@@ -637,6 +637,9 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
Greg Kroah-Hartman
maintainerPATCH 154/268 llc: properly handle dev_queue_xmit() return value
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit b85ab56c3f81c5a24b5a5213374f549df06430da ]
llc_conn_send_pdu() pushes the skb into write queue and calls llc_conn_send_pdus() to flush them out. However, the status of dev_queue_xmit() is not returned to caller, in this case, llc_conn_state_process().
llc_conn_state_process() needs hold the skb no matter success or failure, because it still uses it after that, therefore we should hold skb before dev_queue_xmit() when that skb is the one being processed by llc_conn_state_process().
For other callers, they can just pass NULL and ignore the return value as they are.
--- include/net/llc_conn.h | 2 +- net/llc/llc_c_ac.c | 15 +++++++++------ net/llc/llc_conn.c | 32 +++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 16 deletions(-)
include/net/llc_conn.h +1 -1
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk);/* Access to a connection */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb); -void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb); +int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_rtn_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_resend_i_pdu_as_cmd (struct sock *sk,u8 nr,u8 first_p_bit);void llc_conn_resend_i_pdu_as_rsp (struct sock *sk,u8 nr,u8 first_f_bit);
net/llc/llc_c_ac.c +9 -6
@@ -389,7 +389,7 @@ static int llc_conn_ac_send_i_cmd_p_set_llc_pdu_init_as_i_cmd (skb,0 , llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { -llc_conn_send_pdu (sk, skb); + rc =llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
@@ -916,7 +916,7 @@ static int llc_conn_ac_send_i_rsp_f_set_llc_pdu_init_as_i_cmd (skb, llc->ack_pf, llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { -llc_conn_send_pdu (sk, skb); + rc =llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
@@ -935,14 +935,17 @@ static int llc_conn_ac_send_i_rsp_f_set_int llc_conn_ac_send_i_as_ack (struct sock *sk,struct sk_buff *skb) {struct llc_sock *llc =llc_sk (sk); +int ret;if (llc->ack_must_be_send) { -llc_conn_ac_send_i_rsp_f_set_ackpf (sk, skb); + ret =llc_conn_ac_send_i_rsp_f_set_ackpf (sk, skb); llc->ack_must_be_send =0 ; llc->ack_pf =0 ; - }else -llc_conn_ac_send_i_cmd_p_set_0 (sk, skb); -return 0 ; + }else { + ret =llc_conn_ac_send_i_cmd_p_set_0 (sk, skb); + } + +return ret; }/**
net/llc/llc_conn.c +23 -9
@@ -30,7 +30,7 @@#endif static int llc_find_offset (int state,int ev_type); -static void llc_conn_send_pdus (struct sock *sk); +static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *skb);static int llc_conn_service (struct sock *sk,struct sk_buff *skb); static int llc_exec_conn_trans_actions(struct sock *sk, struct llc_conn_state_trans *trans,
@@ -193,11 +193,11 @@ out_skb_put:return rc; } -void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) +int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) {/* queue PDU to send to MAC layer */ skb_queue_tail (&sk->sk_write_queue, skb); -llc_conn_send_pdus (sk); +return llc_conn_send_pdus (sk, skb); }/**
@@ -255,7 +255,7 @@ void llc_conn_resend_i_pdu_as_cmd(structif (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk); +llc_conn_send_pdus (sk,NULL ); out:; }
@@ -296,7 +296,7 @@ void llc_conn_resend_i_pdu_as_rsp(structif (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk); +llc_conn_send_pdus (sk,NULL ); out:; }
@@ -340,12 +340,16 @@ out:/** * llc_conn_send_pdus - Sends queued PDUs * @sk: active connection +* @hold_skb: the skb held by caller, or NULL if does not care * -* Sends queued pdus to MAC layer for transmission. +* Sends queued pdus to MAC layer for transmission. When @hold_skb is +* NULL, always return 0. Otherwise, return 0 if @hold_skb is sent +* successfully, or 1 for failure. */ -static void llc_conn_send_pdus (struct sock *sk) +static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *hold_skb) {struct sk_buff *skb; +int ret =0 ;while ((skb =skb_dequeue (&sk->sk_write_queue)) !=NULL ) {struct llc_pdu_sn *pdu =llc_pdu_sn_hdr (skb);
@@ -357,10 +361,20 @@ static void llc_conn_send_pdus(struct soskb_queue_tail (&llc_sk (sk)->pdu_unack_q, skb);if (!skb2)break ; - skb = skb2; +dev_queue_xmit (skb2); + }else { +bool is_target = skb == hold_skb; +int rc; + +if (is_target) +skb_get (skb); + rc =dev_queue_xmit (skb); +if (is_target) + ret = rc; } -dev_queue_xmit (skb); } + +return ret; }/**
Greg Kroah-Hartman
maintainerPATCH 145/268 selftests: ftrace: Add probe event argument syntax testcase
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit 871bef2000968c312a4000b2f56d370dcedbc93c ]
Add a testcase for probe event argument syntax which ensures the kprobe_events interface correctly parses given event arguments.
--- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc | 97 ++++++++++ 1 file changed, 97 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc new file +97 -0
@@ -0,0 +1,97 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event argument syntax + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue + +echo 0 > events/enable +echo > kprobe_events + +PROBEFUNC="vfs_read" +GOODREG= +BADREG= +GOODSYM="_sdata" +if ! grep -qw ${GOODSYM} /proc/kallsyms ; then + GOODSYM=$PROBEFUNC +fi +BADSYM="deaqswdefr" +SYMADDR=0x`grep -w ${GOODSYM} /proc/kallsyms | cut -f 1 -d " "` +GOODTYPE="x16" +BADTYPE="y16" + +case `uname -m` in +x86_64|i[3456]86) + GOODREG=%ax + BADREG=%ex +;; +aarch64) + GOODREG=%x0 + BADREG=%ax +;; +arm*) + GOODREG=%r0 + BADREG=%ax +;; +esac + +test_goodarg() # Good-args +{ + while [ "$1" ]; do + echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +test_badarg() # Bad-args +{ + while [ "$1" ]; do + ! echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +echo > kprobe_events + +: "Register access" +test_goodarg ${GOODREG} +test_badarg ${BADREG} + +: "Symbol access" +test_goodarg "@${GOODSYM}" "@${SYMADDR}" "@${GOODSYM}+10" "@${GOODSYM}-10" +test_badarg "@" "@${BADSYM}" "@${GOODSYM}*10" "@${GOODSYM}/10" \ + "@${GOODSYM}%10" "@${GOODSYM}&10" "@${GOODSYM}|10" + +: "Stack access" +test_goodarg "\$stack" "\$stack0" "\$stack1" +test_badarg "\$stackp" "\$stack0+10" "\$stack1-10" + +: "Retval access" +echo "r ${PROBEFUNC} \$retval" > kprobe_events +! echo "p ${PROBEFUNC} \$retval" > kprobe_events + +: "Comm access" +test_goodarg "\$comm" + +: "Indirect memory access" +test_goodarg "+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \ + "+0(\$stack1)" "+10(@${GOODSYM}-10)" "+0(+10(+20(\$stack)))" +test_badarg "+(${GOODREG})" "(${GOODREG}+10)" "-(${GOODREG})" "(${GOODREG})" \ + "+10(\$comm)" "+0(${GOODREG})+10" + +: "Name assignment" +test_goodarg "varname=${GOODREG}" +test_badarg "varname=varname2=${GOODREG}" + +: "Type syntax" +test_goodarg "${GOODREG}:${GOODTYPE}" +test_badarg "${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \ + "${GOODTYPE}:${GOODREG}" + +: "Combination check" + +test_goodarg "\$comm:string" "+0(\$stack):string" +test_badarg "\$comm:x64" "\$stack:string" "${GOODREG}:string" + +echo > kprobe_events
Greg Kroah-Hartman
maintainerPATCH 182/268 btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
[ Upstream commit 8a5a916d9a35e13576d79cc16e24611821b13e34 ]
While running btrfs/011, I hit the following lockdep splat.
This is the important bit:
pcpu_alloc+0x1ac/0x5e0 __percpu_counter_init+0x4e/0xb0 btrfs_init_fs_root+0x99/0x1c0 [btrfs] btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs] resolve_indirect_refs+0x130/0x830 [btrfs] find_parent_nodes+0x69e/0xff0 [btrfs] btrfs_find_all_roots_safe+0xa0/0x110 [btrfs] btrfs_find_all_roots+0x50/0x70 [btrfs] btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs] btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
The percpu_counter_init call in btrfs_alloc_subvolume_writers uses GFP_KERNEL, which we can't do during transaction commit.
This switches it to GFP_NOFS.
========================================================
WARNING: possible irq lock inversion dependency detected
4.12.14-kvmsmall #8 Tainted: G W
--------------------------------------------------------
kswapd0/50 just changed the state of lock:
(&delayed_node->mutex){+.+.-.}, at: [<ffffffffc06994fa>] __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
but this lock took another, RECLAIM_FS-unsafe lock in the past:
(pcpu_alloc_mutex){+.+.+.}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Chain exists of: &delayed_node->mutex --> &found->groups_sem --> pcpu_alloc_mutex
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(pcpu_alloc_mutex);
local_irq_disable();
lock(&delayed_node->mutex);
lock(&found->groups_sem);
<Interrupt>
lock(&delayed_node->mutex);*** DEADLOCK ***
2 locks held by kswapd0/50:
#0: (shrinker_rwsem){++++..}, at: [<ffffffff811dc11f>] shrink_slab+0x7f/0x5b0 #1: (&type->s_umount_key#30){+++++.}, at: [<ffffffff8126dec6>] trylock_super+0x16/0x50
the shortest dependencies between 2nd lock and 1st lock:
-> (pcpu_alloc_mutex){+.+.+.} ops: 4904 {
HARDIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
kmem_cache_init_late+0x42/0x75
start_kernel+0x343/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
SOFTIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
kmem_cache_init_late+0x42/0x75
start_kernel+0x343/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
RECLAIM_FS-ON-W at:
__kmalloc+0x47/0x310
pcpu_extend_area_map+0x2b/0xc0
pcpu_alloc+0x3ec/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
__kmem_cache_create+0x1bf/0x390
create_cache+0xba/0x1b0
kmem_cache_create+0x1f8/0x2b0
ksm_init+0x6f/0x19d
do_one_initcall+0x50/0x1b0
kernel_init_freeable+0x201/0x289
kernel_init+0xa/0x100
ret_from_fork+0x3a/0x50
INITIAL USE at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
setup_cpu_cache+0x2f/0x1f0
__kmem_cache_create+0x1bf/0x390
create_boot_cache+0x8b/0xb1
kmem_cache_init+0xa1/0x19e
start_kernel+0x270/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
}
... key at: [<ffffffff821d8e70>] pcpu_alloc_mutex+0x70/0xa0
... acquired at:
pcpu_alloc+0x1ac/0x5e0
__percpu_counter_init+0x4e/0xb0
btrfs_init_fs_root+0x99/0x1c0 [btrfs]
btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
resolve_indirect_refs+0x130/0x830 [btrfs]
find_parent_nodes+0x69e/0xff0 [btrfs]
btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
btrfs_find_all_roots+0x50/0x70 [btrfs]
btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
transaction_kthread+0x176/0x1b0 [btrfs]
kthread+0x102/0x140
ret_from_fork+0x3a/0x50 -> (&fs_info->commit_root_sem){++++..} ops: 1566382 {
HARDIRQ-ON-W at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
HARDIRQ-ON-R at:
down_read+0x35/0x90
caching_thread+0x57/0x560 [btrfs]
normal_work_helper+0x1c0/0x5e0 [btrfs]
process_one_work+0x1e0/0x5c0
worker_thread+0x44/0x390
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
SOFTIRQ-ON-W at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-R at:
down_read+0x35/0x90
caching_thread+0x57/0x560 [btrfs]
normal_work_helper+0x1c0/0x5e0 [btrfs]
process_one_work+0x1e0/0x5c0
worker_thread+0x44/0x390
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
INITIAL USE at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc0729578>] __key.61970+0x0/0xfffffffffff9aa88 [btrfs]
... acquired at:
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
btrfs_create_tree+0xbb/0x2a0 [btrfs]
btrfs_create_uuid_tree+0x37/0x140 [btrfs]
open_ctree+0x23c0/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> (&found->groups_sem){++++..} ops: 2134587 {
HARDIRQ-ON-W at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
HARDIRQ-ON-R at:
down_read+0x35/0x90
btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
open_ctree+0x207b/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-W at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-R at:
down_read+0x35/0x90
btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
open_ctree+0x207b/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
INITIAL USE at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc0729488>] __key.59101+0x0/0xfffffffffff9ab78 [btrfs]
... acquired at:
find_free_extent+0xcb4/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
__btrfs_cow_block+0x110/0x5b0 [btrfs]
btrfs_cow_block+0xd7/0x290 [btrfs]
btrfs_search_slot+0x1f6/0x960 [btrfs]
btrfs_lookup_inode+0x2a/0x90 [btrfs]
__btrfs_update_delayed_inode+0x65/0x210 [btrfs]
btrfs_commit_inode_delayed_inode+0x121/0x130 [btrfs]
btrfs_evict_inode+0x3fe/0x6a0 [btrfs]
evict+0xc4/0x190
__dentry_kill+0xbf/0x170
dput+0x2ae/0x2f0
SyS_rename+0x2a6/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7-> (&delayed_node->mutex){+.+.-.} ops: 5580204 {
HARDIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
IN-RECLAIM_FS-W at:
__mutex_lock+0x4e/0x8c0
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
INITIAL USE at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc072d488>] __key.56935+0x0/0xfffffffffff96b78 [btrfs]
... acquired at:
__lock_acquire+0x264/0x11c0
lock_acquire+0xbd/0x1e0
__mutex_lock+0x4e/0x8c0
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
stack backtrace:
CPU: 1 PID: 50 Comm: kswapd0 Tainted: G W 4.12.14-kvmsmall #8 SLE15 (unreleased)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
dump_stack+0x78/0xb7
print_irq_inversion_bug.part.38+0x19f/0x1aa
check_usage_forwards+0x102/0x120
? ret_from_fork+0x3a/0x50
? check_usage_backwards+0x110/0x110
mark_lock+0x16c/0x270
__lock_acquire+0x264/0x11c0
? pagevec_lookup_entries+0x1a/0x30
? truncate_inode_pages_range+0x2b3/0x7f0
lock_acquire+0xbd/0x1e0
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
__mutex_lock+0x4e/0x8c0
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
? btrfs_evict_inode+0x1f6/0x6a0 [btrfs]
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
? mem_cgroup_shrink_node+0x2c0/0x2c0
? kthread_create_on_node+0x40/0x40
ret_from_fork+0x3a/0x50--- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/disk-io.c +1 -1
@@ -1196,7 +1196,7 @@ static struct btrfs_subvolume_writers *bif (!writers)return ERR_PTR (-ENOMEM ); - ret =percpu_counter_init (&writers->counter,0 ,GFP_KERNEL ); + ret =percpu_counter_init (&writers->counter,0 ,GFP_NOFS );if (ret <0 ) {kfree (writers);return ERR_PTR (ret);
Greg Kroah-Hartman
maintainerPATCH 191/268 powerpc/perf: Fix kernel address leak via sampling registers
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit e1ebd0e5b9d0a10ba65e63a3514b6da8c6a5a819 ]
Current code in power_pmu_disable() does not clear the sampling registers like Sampling Instruction Address Register (SIAR) and Sampling Data Address Register (SDAR) after disabling the PMU. Since these are userspace readable and could contain kernel addresses, add code to explicitly clear the content of these registers.
Also add a "context synchronizing instruction" to enforce no further updates to these registers as suggested by Power ISA v3.0B. From section 9.4, on page 1108:
"If an mtspr instruction is executed that changes the value of a Performance Monitor register other than SIAR, SDAR, and SIER, the change is not guaranteed to have taken effect until after a subsequent context synchronizing instruction has been executed (see Chapter 11. "Synchronization Requirements for Context Alterations" on page 1133)."
--- arch/powerpc/perf/core-book3s.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/powerpc/perf/core-book3s.c +15 -0
@@ -1198,6 +1198,7 @@ static void power_pmu_disable(struct pmu*/ write_mmcr0 (cpuhw, val);mb (); +isync ();/* * Disable instruction sampling if it was enabled
@@ -1206,12 +1207,26 @@ static void power_pmu_disable(struct pmumtspr (SPRN_MMCRA , cpuhw->mmcr[2 ] & ~MMCRA_SAMPLE_ENABLE );mb (); +isync (); } cpuhw->disabled =1 ; cpuhw->n_added =0 ;ebb_switch_out (mmcr0); + +#ifdef CONFIG_PPC64 +/* +* These are readable by userspace, may contain kernel +* addresses and are not switched by context switch, so clear +* them now to avoid leaking anything to userspace in general +* including to another process. +*/ +if (ppmu->flags &PPMU_ARCH_207S ) { +mtspr (SPRN_SDAR ,0 ); +mtspr (SPRN_SIAR ,0 ); + } +#endif }local_irq_restore (flags);
Greg Kroah-Hartman
maintainerPATCH 192/268 tools/thermal: tmon: fix for segfault
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Asseg <[email protected]>
[ Upstream commit 6c59f64b7ecf2bccbe73931d7d573d66ed13b537 ]
Fixes a segfault occurring when e.g. <TAB> is pressed multiple times in the ncurses tmon application. The segfault is caused by incrementing cur_thermal_record in the main function without checking if it's value reached NR_THERMAL_RECORD immediately. Since the boundary check only occurred in update_thermal_data a race condition existed, which lead to an attempted read beyond the last element of the trec array.
The fix was implemented by moving the cur_thermal_record incrementation to the update_thermal_data function using a temporary variable on which the boundary condition is checked before updating cur_thread_record, so that the variable is never incremented beyond the trec array's boundary.
It seems the segfault does not occur on every machine: On a HP EliteBook G4 the segfault happens, while it does not happen on a Thinkpad T540p.
--- tools/thermal/tmon/sysfs.c | 12 +++++++----- tools/thermal/tmon/tmon.c | 1 - 2 files changed, 7 insertions(+), 6 deletions(-)
tools/thermal/tmon/sysfs.c +7 -5
@@ -486,6 +486,7 @@ int zone_instance_to_index(int zone_instint update_thermal_data () {int i; +int next_thermal_record = cur_thermal_record +1 ;char tz_name[256 ];static unsigned long samples;
@@ -495,9 +496,9 @@ int update_thermal_data() }/* circular buffer for keeping historic data */ -if (cur_thermal_record >=NR_THERMAL_RECORDS ) - cur_thermal_record =0 ; -gettimeofday (&trec[cur_thermal_record].tv,NULL ); +if (next_thermal_record >=NR_THERMAL_RECORDS ) + next_thermal_record =0 ; +gettimeofday (&trec[next_thermal_record].tv,NULL );if (tmon_log) {fprintf (tmon_log,"%lu " , ++samples);fprintf (tmon_log,"%3.1f " , p_param.t_target);
@@ -507,11 +508,12 @@ int update_thermal_data()snprintf (tz_name,256 ,"%s/%s%d" ,THERMAL_SYSFS ,TZONE , ptdata.tzi[i].instance);sysfs_get_ulong (tz_name,"temp" , - &trec[cur_thermal_record].temp[i]); + &trec[next_thermal_record].temp[i]);if (tmon_log)fprintf (tmon_log,"%lu " , - trec[cur_thermal_record].temp[i]/1000 ); + trec[next_thermal_record].temp[i] /1000 ); } + cur_thermal_record = next_thermal_record;for (i =0 ; i < ptdata.nr_cooling_dev; i++) {char cdev_name[256 ];unsigned long val;
tools/thermal/tmon/tmon.c +0 -1
@@ -336,7 +336,6 @@ int main(int argc, char **argv)show_data_w ();show_cooling_device (); } - cur_thermal_record++; time_elapsed += ticktime;controller_handler (trec[0 ].temp[target_tz_index] /1000 , &yk);
Greg Kroah-Hartman
maintainerPATCH 193/268 selftests: Print the test were running to /dev/kmsg
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 88893cf787d3062c631cc20b875068eb11756e03 ]
Some tests cause the kernel to print things to the kernel log buffer (ie. printk), in particular oops and warnings etc. However when running all the tests in succession it's not always obvious which test(s) caused the kernel to print something.
We can narrow it down by printing which test directory we're running in to /dev/kmsg, if it's writable.
Example output:
[ 170.149149] kselftest: Running tests in powerpc
[ 305.300132] kworker/dying (71) used greatest stack depth: 7776 bytes
left
[ 808.915456] kselftest: Running tests in pstore--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -90,6 +90,7 @@ ifdef INSTALL_PATH for TARGET in $(TARGETS); do \ echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ echo "echo ========================================" >> $(ALL_SCRIPT); \ + echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \ echo "cd $$TARGET" >> $(ALL_SCRIPT); \ make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
Greg Kroah-Hartman
maintainerPATCH 194/268 net/mlx5: Protect from command bit overflow
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 957f6ba8adc7be401a74ccff427e4cfd88d3bfcb ]
The system with CONFIG_UBSAN enabled on produces the following error during driver initialization. The reason to it that max_reg_cmds can be larger enough to cause to "1 << max_reg_cmds" overflow the unsigned long.
================================================================================
UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1805:42 signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-00032-g06cda2358d9b-dirty #724 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 Call Trace: dump_stack+0xe9/0x18f ? dma_virt_alloc+0x81/0x81 ubsan_epilogue+0xe/0x4e handle_overflow+0x187/0x20c mlx5_cmd_init+0x73a/0x12b0 mlx5_load_one+0x1c3d/0x1d30 init_one+0xd02/0xf10 pci_device_probe+0x26c/0x3b0 driver_probe_device+0x622/0xb40 __driver_attach+0x175/0x1b0 bus_for_each_dev+0xef/0x190 bus_add_driver+0x2db/0x490 driver_register+0x16b/0x1e0 __pci_register_driver+0x177/0x1b0 init+0x6d/0x92 do_one_initcall+0x15b/0x270 kernel_init_freeable+0x2d8/0x3d0 kernel_init+0x14/0x190 ret_from_fork+0x24/0x30 ================================================================================
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 -1
@@ -1623,7 +1623,7 @@ int mlx5_cmd_init(struct mlx5_core_dev * cmd->checksum_disabled =1 ; cmd->max_reg_cmds = (1 << cmd->log_sz) -1 ; - cmd->bitmask = (1 << cmd->max_reg_cmds) -1 ; + cmd->bitmask = (1UL << cmd->max_reg_cmds) -1 ; cmd->cmdif_rev =ioread32be (&dev->iseg->cmdif_rev_fw_sub) >>16 ;if (cmd->cmdif_rev >CMD_IF_REV ) {
Greg Kroah-Hartman
maintainerPATCH 195/268 ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karthikeyan Periyasamy <[email protected]>
[ Upstream commit 8b2d93dd22615cb7f3046a5a2083a6f8bb8052ed ]
When attempt to run worker (ath10k_sta_rc_update_wk) after the station object (ieee80211_sta) delete will trigger the kernel panic.
This problem arise in AP + Mesh configuration, Where the current node AP VAP and neighbor node mesh VAP MAC address are same. When the current mesh node try to establish the mesh link with neighbor node, driver peer creation for the neighbor mesh node fails due to duplication MAC address. Already the AP VAP created with same MAC address.
It is caused by the following scenario steps.
Steps:
1. In above condition, ath10k driver sta_state callback (ath10k_sta_state) fails to do the state change for a station from IEEE80211_STA_NOTEXIST to IEEE80211_STA_NONE due to peer creation fails. Sta_state callback is called from ieee80211_add_station() to handle the new station (neighbor mesh node) request from the wpa_supplicant.
2. Concurrently ath10k receive the sta_rc_update callback notification from the mesh_neighbour_update() to handle the beacon frames of the above neighbor mesh node. since its atomic callback, ath10k driver queue the work (ath10k_sta_rc_update_wk) to handle rc update.
3. Due to driver sta_state callback fails (step 1), mac80211 free the station object.
4. When the worker (ath10k_sta_rc_update_wk) scheduled to run, it will access the station object which is already deleted. so it will trigger kernel panic.
Added the peer exist check in sta_rc_update callback before queue the work.
Kernel Panic log:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0204000 [00000000] *pgd=00000000 Internal error: Oops: 17 [#1] PREEMPT SMP ARM CPU: 1 PID: 1833 Comm: kworker/u4:2 Not tainted 3.14.77 #1 task: dcef0000 ti: d72b6000 task.ti: d72b6000 PC is at pwq_activate_delayed_work+0x10/0x40 LR is at pwq_activate_delayed_work+0xc/0x40 pc : [<c023f988>] lr : [<c023f984>] psr: 40000193
sp : d72b7f18 ip : 0000007a fp : d72b6000
r10: 00000000 r9 : dd404414 r8 : d8c31998
r7 : d72b6038 r6 : 00000004 r5 : d4907ec8 r4 : dcee1300 r3 : ffffffe0 r2 : 00000000 r1 : 00000001 r0 : 00000000
Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5787d Table: 595bc06a DAC: 00000015
...
Process kworker/u4:2 (pid: 1833, stack limit = 0xd72b6238)
Stack: (0xd72b7f18 to 0xd72b8000)
7f00: 00000001 dcee1300
7f20: 00000001 c02410dc d8c31980 dd404400 dd404400 c0242790 d8c31980 00000089 7f40: 00000000 d93e1340 00000000 d8c31980 c0242568 00000000 00000000 00000000 7f60: 00000000 c02474dc 00000000 00000000 000000f8 d8c31980 00000000 00000000 7f80: d72b7f80 d72b7f80 00000000 00000000 d72b7f90 d72b7f90 d72b7fac d93e1340 7fa0: c0247404 00000000 00000000 c0208d20 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [<c023f988>] (pwq_activate_delayed_work) from [<c02410dc>] (pwq_dec_nr_in_flight+0x58/0xc4) [<c02410dc>] (pwq_dec_nr_in_flight) from [<c0242790>] (worker_thread+0x228/0x360) [<c0242790>] (worker_thread) from [<c02474dc>] (kthread+0xd8/0xec) [<c02474dc>] (kthread) from [<c0208d20>] (ret_from_fork+0x14/0x34)
Code: e92d4038 e1a05000 ebffffbc[69210.619376] SMP: failed to stop secondary CPUs
Rebooting in 3 seconds..
--- drivers/net/wireless/ath/ath10k/mac.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +10 -0
@@ -6311,10 +6311,20 @@ static void ath10k_sta_rc_update(struct {struct ath10k *ar = hw->priv;struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; +struct ath10k_vif *arvif = (void *)vif->drv_priv; +struct ath10k_peer *peer;u32 bw, smps;spin_lock_bh (&ar->data_lock); + peer =ath10k_peer_find (ar, arvif->vdev_id, sta->addr); +if (!peer) { +spin_unlock_bh (&ar->data_lock); +ath10k_warn (ar,"mac sta rc update failed to find peer %pM on vdev %i\n" , + sta->addr, arvif->vdev_id); +return ; + } + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", sta->addr, changed, sta->bandwidth, sta->rx_nss,
Greg Kroah-Hartman
maintainerPATCH 196/268 ima: Fix Kconfig to select TPM 2.0 CRB interface
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiandi An <[email protected]>
[ Upstream commit fac37c628fd5d68fd7298d9b57ae8601ee1b4723 ]
TPM_CRB driver provides TPM CRB 2.0 support. If it is built as a module, the TPM chip is registered after IMA init. tpm_pcr_read() in IMA fails and displays the following message even though eventually there is a TPM chip on the system.
ima: No TPM chip found, activating TPM-bypass! (rc=-19)
Fix IMA Kconfig to select TPM_CRB so TPM_CRB driver is built in the kernel and initializes before IMA.
--- security/integrity/ima/Kconfig | 1 + 1 file changed, 1 insertion(+)
security/integrity/ima/Kconfig +1 -0
@@ -10,6 +10,7 @@ config IMA select CRYPTO_HASH_INFO select TCG_TPM if HAS_IOMEM && !UML select TCG_TIS if TCG_TPM && X86 + select TCG_CRB if TCG_TPM && ACPI select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES help The Trusted Computing Group(TCG) runtime Integrity
Greg Kroah-Hartman
maintainerPATCH 197/268 ima: Fallback to the builtin hash algorithm
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Vorel <[email protected]>
[ Upstream commit ab60368ab6a452466885ef4edf0cefd089465132 ]
IMA requires having it's hash algorithm be compiled-in due to it's early use. The default IMA algorithm is protected by Kconfig to be compiled-in.
The ima_hash kernel parameter allows to choose the hash algorithm. When the specified algorithm is not available or available as a module, IMA initialization fails, which leads to a kernel panic (mknodat syscall calls ima_post_path_mknod()). Therefore as fallback we force IMA to use the default builtin Kconfig hash algorithm.
Fixed crash:
$ grep CONFIG_CRYPTO_MD4 .config CONFIG_CRYPTO_MD4=m
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4 ... [ 1.545190] ima: Can not allocate md4 (reason: -2) ... [ 2.610120] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2.611903] IP: ima_match_policy+0x23/0x390 [ 2.612967] PGD 0 P4D 0 [ 2.613080] Oops: 0000 [#1] SMP [ 2.613080] Modules linked in: autofs4 [ 2.613080] Supported: Yes [ 2.613080] CPU: 0 PID: 1 Comm: systemd Not tainted 4.12.14-2.3-default #1 [ 2.613080] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 [ 2.613080] task: ffff88003e2d0040 task.stack: ffffc90000190000 [ 2.613080] RIP: 0010:ima_match_policy+0x23/0x390 [ 2.613080] RSP: 0018:ffffc90000193e88 EFLAGS: 00010296 [ 2.613080] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000004 [ 2.613080] RDX: 0000000000000010 RSI: 0000000000000001 RDI: ffff880037071728 [ 2.613080] RBP: 0000000000008000 R08: 0000000000000000 R09: 0000000000000000 [ 2.613080] R10: 0000000000000008 R11: 61c8864680b583eb R12: 00005580ff10086f [ 2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000008000 [ 2.613080] FS: 00007f5c1da08940(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000 [ 2.613080] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2.613080] CR2: 0000000000000000 CR3: 0000000037002000 CR4: 00000000003406f0 [ 2.613080] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.613080] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2.613080] Call Trace: [ 2.613080] ? shmem_mknod+0xbf/0xd0 [ 2.613080] ima_post_path_mknod+0x1c/0x40 [ 2.613080] SyS_mknod+0x210/0x220 [ 2.613080] entry_SYSCALL_64_fastpath+0x1a/0xa5 [ 2.613080] RIP: 0033:0x7f5c1bfde570 [ 2.613080] RSP: 002b:00007ffde1c90dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000085 [ 2.613080] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c1bfde570 [ 2.613080] RDX: 0000000000000000 RSI: 0000000000008000 RDI: 00005580ff10086f [ 2.613080] RBP: 00007ffde1c91040 R08: 00005580ff10086f R09: 0000000000000000 [ 2.613080] R10: 0000000000104000 R11: 0000000000000246 R12: 00005580ffb99660 [ 2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002 [ 2.613080] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 44 8d 14 09 41 55 41 54 55 53 44 89 d3 09 cb 48 83 ec 38 48 8b 05 c5 03 29 01 <4c> 8b 20 4c 39 e0 0f 84 d7 01 00 00 4c 89 44 24 08 89 54 24 20 [ 2.613080] RIP: ima_match_policy+0x23/0x390 RSP: ffffc90000193e88 [ 2.613080] CR2: 0000000000000000 [ 2.613080] ---[ end trace 9a9f0a8a73079f6a ]--- [ 2.673052] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 2.673052] [ 2.675337] Kernel Offset: disabled [ 2.676405] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
--- security/integrity/ima/ima_crypto.c | 2 ++ security/integrity/ima/ima_main.c | 13 +++++++++++++ 2 files changed, 15 insertions(+)
security/integrity/ima/ima_crypto.c +2 -0
@@ -78,6 +78,8 @@ int __init ima_init_crypto(void) hash_algo_name[ima_hash_algo], rc);return rc; } +pr_info ("Allocated hash algorithm: %s\n" , + hash_algo_name[ima_hash_algo]);return 0 ; }
security/integrity/ima/ima_main.c +13 -0
@@ -16,6 +16,9 @@* implements the IMA hooks: ima_bprm_check, ima_file_mmap, * and ima_file_check. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/file.h> #include <linux/binfmts.h>
@@ -353,6 +356,16 @@ static int __init init_ima(void)hash_setup (CONFIG_IMA_DEFAULT_HASH ); error =ima_init (); + +if (error &&strcmp (hash_algo_name[ima_hash_algo], +CONFIG_IMA_DEFAULT_HASH ) !=0 ) { +pr_info ("Allocating %s failed, going to use default hash algorithm %s\n" , + hash_algo_name[ima_hash_algo],CONFIG_IMA_DEFAULT_HASH ); + hash_setup_done =0 ; +hash_setup (CONFIG_IMA_DEFAULT_HASH ); + error =ima_init (); + } +if (!error) { ima_initialized =1 ;ima_update_policy_flag ();
Greg Kroah-Hartman
maintainerPATCH 198/268 virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718 ]
The operstate update logic will leave an interface in the default UNKNOWN operstate if the interface carrier state never changes from the default carrier up state set at creation. This includes the case of an explicit call to netif_carrier_on, as the carrier on to on transition has no effect on operstate.
This affects virtio-net for the case that the virtio peer does
not support VIRTIO_NET_F_STATUS (the feature that provides carrier state updates). Without this feature, the virtio specification states that "the link should be assumed active," so, logically, the operstate should be UP instead of UNKNOWN. This has impact on user space applications that use the operstate to make availability decisions for the interface.
Resolve this by changing the virtio probe logic slightly to callnetif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS cases, and then the existing call to netif_carrier_on for the "without" case will cause an operstate transition.
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
@@ -1912,8 +1912,8 @@ static int virtnet_probe(struct virtio_d/* Assume link up if device can't report link status, otherwise get link status from config. */ +netif_carrier_off (dev);if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_STATUS )) { -netif_carrier_off (dev);schedule_work (&vi->config_work); }else { vi->status =VIRTIO_NET_S_LINK_UP ;
Greg Kroah-Hartman
maintainerPATCH 199/268 arm: dts: socfpga: fix GIC PPI warning
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Puschmann <[email protected]>
[ Upstream commit 6d97d5aba08b26108f95dc9fb7bbe4d9436c769c ]
Fixes the warning "GIC: PPI13 is secure or misconfigured" by changing the interrupt type from level_low to edge_raising
--- arch/arm/boot/dts/socfpga.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
@@ -738,7 +738,7 @@ timer@fffec600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xfffec600 0x100>; - interrupts = <1 13 0xf04>; + interrupts = <1 13 0xf01>; clocks = <&mpu_periph_clk>; };
Greg Kroah-Hartman
maintainerPATCH 183/268 xen/acpi: off by one in read_acpi_id()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ]
If acpi_id is == nr_acpi_bits, then we access one element beyond the end of the acpi_psd[] array or we set one bit beyond the end of the bit map when we do __set_bit(acpi_id, acpi_id_present);
--- drivers/xen/xen-acpi-processor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/xen/xen-acpi-processor.c +3 -3
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl }/* There are more ACPI Processor objects than in x2APIC or MADT. * This can happen with incorrect ACPI SSDT declerations. */ -if (acpi_id > nr_acpi_bits) { -pr_debug ("We only have %u, trying to set %u\n" , - nr_acpi_bits, acpi_id); +if (acpi_id >= nr_acpi_bits) { +pr_debug ("max acpi id %u, trying to set %u\n" , + nr_acpi_bits -1 , acpi_id);return AE_OK ; }/* OK, There is a ACPI Processor object */
Greg Kroah-Hartman
maintainerPATCH 201/268 cpufreq: cppc_cpufreq: Fix cppc_cpufreq_init() failure path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunyu Hu <[email protected]>
[ Upstream commit 55b55abc17f238c61921360e61dde90dd9a326d1 ]
Kmemleak reported the below leak. When cppc_cpufreq_init went into failure path, the cpu mask is not freed. After fix, this report is gone. And to avaoid potential NULL pointer reference, check the cpu value first.
unreferenced object 0xffff800fd5ea4880 (size 128):
comm "swapper/0", pid 1, jiffies 4294939510 (age 668.680s) hex dump (first 32 bytes):
00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 .... ...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffff0000082c4ae4>] __kmalloc_node+0x278/0x634
[<ffff0000088f4a74>] alloc_cpumask_var_node+0x28/0x60
[<ffff0000088f4af0>] zalloc_cpumask_var+0x14/0x1c
[<ffff000008d20254>] cppc_cpufreq_init+0xd0/0x19c
[<ffff000008083828>] do_one_initcall+0xec/0x15c
[<ffff000008cd1018>] kernel_init_freeable+0x1f4/0x2a4
[<ffff0000089099b0>] kernel_init+0x18/0x10c
[<ffff000008084d50>] ret_from_fork+0x10/0x18
[<ffffffffffffffff>] 0xffffffffffffffff--- drivers/cpufreq/cppc_cpufreq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +7 -2
@@ -176,8 +176,13 @@ static int __init cppc_cpufreq_init(voidreturn ret; out: -for_each_possible_cpu (i) -kfree (all_cpu_data[i]); +for_each_possible_cpu (i) { + cpu = all_cpu_data[i]; +if (!cpu) +break ; +free_cpumask_var (cpu->shared_cpu_map); +kfree (cpu); + }kfree (all_cpu_data);return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 202/268 clk: Dont show the incorrect clock phase
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit 1f9c63e8de3d7b377c9d74e4a17524cfb60e6384 ]
It's found that the clock phase output from clk_summary is wrong compared to the actual phase reading from the register.
cat /sys/kernel/debug/clk/clk_summary | grep sdio_samplesdio_sample 0 1 0 50000000 0 -22
It exposes an issue that clk core, clk_core_get_phase, always returns the cached core->phase which should be either updated by calling clk_set_phase or directly from the first place the clk was registered.
When registering the clk, the core->phase geting from ->get_phase() may return negative value indicating error. This is quite common since the clk's phase may be highly related to its parent chain, but it was temporarily orphan when registered, since its parent chains hadn't be ready at that time, so the clk drivers decide to return error in this case. However, if no clk_set_phase is called or maybe the ->set_phase() isn't even implemented, the core->phase would never be updated. This is wrong, and we should try to update it when all its parent chains are settled down, like the way of updating clock rate for that. But it's not deserved to complicate the code now and just update it anyway when calling clk_core_get_phase, which would be much simple and enough.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -1905,6 +1905,9 @@ static int clk_core_get_phase(struct clkint ret;clk_prepare_lock (); +/* Always try to update cached phase if possible */ +if (core->ops->get_phase) + core->phase = core->ops->get_phase (core->hw); ret = core->phase;clk_prepare_unlock ();
Greg Kroah-Hartman
maintainerPATCH 203/268 zorro: Set up z->dev.dma_mask for the DMA API
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
[ Upstream commit 55496d3fe2acd1a365c43cbd613a20ecd4d74395 ]
The generic DMA API uses dev->dma_mask to check the DMA addressable memory bitmask, and warns if no mask is set or even allocated.
Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask to point to z->dev.dma_coherent_mask so device drivers that need DMA have everything set up to avoid warnings from dma_alloc_coherent(). Drivers can still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.
--- drivers/zorro/zorro.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/zorro/zorro.c +12 -0
@@ -16,6 +16,7 @@#include <linux/bitops.h> #include <linux/string.h> #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <asm/byteorder.h>
@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(stru z->dev.parent = &bus->dev; z->dev.bus = &zorro_bus_type; z->dev.id = i; +switch (z->rom.er_Type &ERT_TYPEMASK ) { +case ERT_ZORROIII : + z->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); +break ; + +case ERT_ZORROII : +default : + z->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); +break ; + } + z->dev.dma_mask = &z->dev.coherent_dma_mask; }/* ... then register them */
Greg Kroah-Hartman
maintainerPATCH 204/268 bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
[ Upstream commit fadd94e05c02afec7b70b0b14915624f1782f578 ]
In patch "bcache: fix cached_dev->count usage for bch_cache_set_error()", cached_dev_get() is called when creating dc->writeback_thread, and cached_dev_put() is called when exiting dc->writeback_thread. This modification works well unless people detach the bcache device manually by
'echo 1 > /sys/block/bcache<N>/bcache/detach'
Because this sysfs interface only calls bch_cached_dev_detach() which wakes up dc->writeback_thread but does not stop it. The reason is, before patch "bcache: fix cached_dev->count usage for bch_cache_set_error()", inside bch_writeback_thread(), if cache is not dirty after writeback, cached_dev_put() will be called here. And in cached_dev_make_request() when a new write request makes cache from clean to dirty, cached_dev_get() will be called there. Since we don't operate dc->count in these locations, refcount d->count cannot be dropped after cache becomes clean, and cached_dev_detach_finish() won't be called to detach bcache device.
This patch fixes the issue by checking whether BCACHE_DEV_DETACHING is set inside bch_writeback_thread(). If this bit is set and cache is clean (no existing writeback_keys), break the while-loop, call cached_dev_put() and quit the writeback thread.
Please note if cache is still dirty, even BCACHE_DEV_DETACHING is set the writeback thread should continue to perform writeback, this is the original design of manually detach.
It is safe to do the following check without locking, let me explain why,
+ if (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
+ (!atomic_read(&dc->has_dirty) || !dc->writeback_running)) {
If the kenrel thread does not sleep and continue to run due to conditions are not updated in time on the running CPU core, it just consumes more CPU cycles and has no hurt. This should-sleep-but-run is safe here. We just focus on the should-run-but-sleep condition, which means the writeback thread goes to sleep in mistake while it should continue to run. 1, First of all, no matter the writeback thread is hung or not,
kthread_stop() from cached_dev_detach_finish() will wake up it and terminate by making kthread_should_stop() return true. And in normal run time, bit on index BCACHE_DEV_DETACHING is always cleared, the condition
!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)
is always true and can be ignored as constant value.
2, If one of the following conditions is true, the writeback thread should
go to sleep,
"!atomic_read(&dc->has_dirty)" or "!dc->writeback_running)" each of them independently controls the writeback thread should sleep or not, let's analyse them one by one.
2.1 condition "!atomic_read(&dc->has_dirty)"
If dc->has_dirty is set from 0 to 1 on another CPU core, bcache will call bch_writeback_queue() immediately or call bch_writeback_add() which indirectly calls bch_writeback_queue() too. In bch_writeback_queue(), wake_up_process(dc->writeback_thread) is called. It sets writeback thread's task state to TASK_RUNNING and following an implicit memory barrier, then tries to wake up the writeback thread.
In writeback thread, its task state is set to TASK_INTERRUPTIBLE before doing the condition check. If other CPU core sets the TASK_RUNNING state after writeback thread setting TASK_INTERRUPTIBLE, the writeback thread will be scheduled to run very soon because its state is not TASK_INTERRUPTIBLE. If other CPU core sets the TASK_RUNNING state before writeback thread setting TASK_INTERRUPTIBLE, the implict memory barrier of wake_up_process() will make sure modification of dc->has_dirty on other CPU core is updated and observed on the CPU core of writeback thread. Therefore the condition check will correctly be false, and continue writeback code without sleeping.
2.2 condition "!dc->writeback_running)"
dc->writeback_running can be changed via sysfs file, every time it is modified, a following bch_writeback_queue() is alwasy called. So the change is always observed on the CPU core of writeback thread. If dc->writeback_running is changed from 0 to 1 on other CPU core, this condition check will observe the modification and allow writeback thread to continue to run without sleeping.
Now we can see, even without a locking protection, multiple conditions check is safe here, no deadlock or process hang up will happen.
I compose a separte patch because that patch "bcache: fix cached_dev->count usage for bch_cache_set_error()" already gets a "Reviewed-by:" from Hannes Reinecke. Also this fix is not trivial and good for a separate patch.
--- drivers/md/bcache/writeback.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/md/bcache/writeback.c +17 -3
@@ -426,9 +426,15 @@ static int bch_writeback_thread(void *arwhile (!kthread_should_stop ()) {down_write (&dc->writeback_lock);set_current_state (TASK_INTERRUPTIBLE ); -if (!atomic_read (&dc->has_dirty) || - (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && - !dc->writeback_running)) { +/* +* If the bache device is detaching, skip here and continue +* to perform writeback. Otherwise, if no dirty data on cache, +* or there is dirty data on cache but writeback is disabled, +* the writeback thread should sleep here and wait for others +* to wake up it. +*/ +if (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && + (!atomic_read (&dc->has_dirty) || !dc->writeback_running)) {up_write (&dc->writeback_lock);if (kthread_should_stop ()) {
@@ -450,6 +456,14 @@ static int bch_writeback_thread(void *arcached_dev_put (dc);SET_BDEV_STATE (&dc->sb,BDEV_STATE_CLEAN );bch_write_bdev_super (dc,NULL ); +/* +* If bcache device is detaching via sysfs interface, +* writeback thread should stop after there is no dirty +* data on cache. BCACHE_DEV_DETACHING flag is set in +* bch_cached_dev_detach(). +*/ +if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) +break ; }up_write (&dc->writeback_lock);
Greg Kroah-Hartman
maintainerPATCH 205/268 ACPICA: Events: add a return on failure from acpi_hw_register_read
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erik Schmauss <[email protected]>
[ Upstream commit b4c0de312613ca676db5bd7e696a44b56795612a ]
This ensures that acpi_ev_fixed_event_detect() does not use fixed_status and and fixed_enable as uninitialized variables.
--- drivers/acpi/acpica/evevent.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/acpica/evevent.c +7 -2
@@ -204,6 +204,7 @@ u32 acpi_ev_fixed_event_detect(void)u32 fixed_status;u32 fixed_enable;u32 i; +acpi_status status;ACPI_FUNCTION_NAME (ev_fixed_event_detect);
@@ -211,8 +212,12 @@ u32 acpi_ev_fixed_event_detect(void)* Read the fixed feature status and enable registers, as all the cases * depend on their values. Ignore errors here. */ - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); + status =acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); + status |= +acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); +if (ACPI_FAILURE (status)) { +return (int_status); + } ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, "Fixed Event Block: Enable %08X Status %08X\n",
Greg Kroah-Hartman
maintainerPATCH 206/268 ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
[ Upstream commit 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c ]
I found an ACPI cache leak in ACPI early termination and boot continuing case.
When early termination occurs due to malicious ACPI table, Linux kernel terminates ACPI function and continues to boot process. While kernel terminates ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.
Boot log of ACPI operand cache leak is as follows:
Quoted 36 lines
[ 0.464168] ACPI: Added _OSI(Module Device) [ 0.467022] ACPI: Added _OSI(Processor Device) [ 0.469376] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.471647] ACPI: Added _OSI(Processor Aggregator Device) [ 0.477997] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174) [ 0.482706] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461) [ 0.487503] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543) [ 0.492136] ACPI Error: Method parse/execution failed [\_SB._INI] (Node ffff88021710a618), AE_AML_INTERNAL (20170303/psparse-543) [ 0.497683] ACPI: Interpreter enabled [ 0.499385] ACPI: (supports S0) [ 0.501151] ACPI: Using IOAPIC for interrupt routing [ 0.503342] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174) [ 0.506522] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461) [ 0.510463] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543) [ 0.514477] ACPI Error: Method parse/execution failed [\_PIC] (Node ffff88021710ab18), AE_AML_INTERNAL (20170303/psparse-543) [ 0.518867] ACPI Exception: AE_AML_INTERNAL, Evaluating _PIC (20170303/bus-991) [ 0.522384] kmem_cache_destroy Acpi-Operand: Slab cache still has objects [ 0.524597] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26 [ 0.526795] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.529668] Call Trace: [ 0.530811] ? dump_stack+0x5c/0x81 [ 0.532240] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.533905] ? acpi_os_delete_cache+0xa/0x10 [ 0.535497] ? acpi_ut_delete_caches+0x3f/0x7b [ 0.537237] ? acpi_terminate+0xa/0x14 [ 0.538701] ? acpi_init+0x2af/0x34f [ 0.540008] ? acpi_sleep_proc_init+0x27/0x27 [ 0.541593] ? do_one_initcall+0x4e/0x1a0 [ 0.543008] ? kernel_init_freeable+0x19e/0x21f [ 0.546202] ? rest_init+0x80/0x80 [ 0.547513] ? kernel_init+0xa/0x100 [ 0.548817] ? ret_from_fork+0x25/0x30 [ 0.550587] vgaarb: loaded [ 0.551716] EDAC MC: Ver: 3.0.0 [ 0.553744] PCI: Probing PCI hardware [ 0.555038] PCI host bridge to bus 0000:00
Quoted 1 line
... Continue to boot and log is omitted ...
I analyzed this memory leak in detail and found acpi_ns_evaluate() function only removes Info->return_object in AE_CTRL_RETURN_VALUE case. But, when errors occur, the status value is not AE_CTRL_RETURN_VALUE, and Info->return_object is also not null. Therefore, this causes acpi operand memory leak.
This cache leak causes a security threat because an old kernel (<= 4.9) shows memory locations of kernel functions in stack dump. Some malicious users could use this information to neutralize kernel ASLR.
I made a patch to fix ACPI operand cache leak.
--- drivers/acpi/acpica/nseval.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/acpica/nseval.c +8 -0
@@ -308,6 +308,14 @@ acpi_status acpi_ns_evaluate(struct acpi/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ status =AE_OK ; + }else if (ACPI_FAILURE (status)) { + +/* If return_object exists, delete it */ + +if (info->return_object) { +acpi_ut_remove_reference (info->return_object); + info->return_object =NULL ; + } } ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
Greg Kroah-Hartman
maintainerPATCH 207/268 i2c: mv64xxx: Apply errata delay only in standard mode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
[ Upstream commit 31184d8c6ea49ea0676d100cdd7e1f102ad025b5 ]
The errata FE-8471889 description has been updated. There is still a timing violation for repeated start. But the errata now states that it was only the case for the Standard mode (100 kHz), in Fast mode (400 kHz) there is no issue.
This patch limit the errata fix to the Standard mode.
It has been tesed successfully on the clearfog (Aramda 388 based board).
--- drivers/i2c/busses/i2c-mv64xxx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-mv64xxx.c +6 -2
@@ -856,12 +856,16 @@ mv64xxx_of_config(struct mv64xxx_i2c_dat*/ if (of_device_is_compatible (np,"marvell,mv78230-i2c" )) { drv_data->offload_enabled = true; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"marvell,mv78230-a0-i2c" )) { drv_data->offload_enabled = false; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"allwinner,sun6i-a31-i2c" ))
Greg Kroah-Hartman
maintainerPATCH 209/268 xhci: zero usb device slot_id member when disabling and freeing a xhci slot
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit a400efe455f7b61ac9a801ac8d0d01f8c8d82dd5 ]
set udev->slot_id to zero when disabling and freeing the xhci slot. Prevents usb core from calling xhci with a stale slot id.
xHC controller may be reset during resume to recover from some error. All slots are unusable as they are disabled and freed.
xhci driver starts slot enumeration again from 1 in the order they are enabled. In the worst case a stale udev->slot_id for one device matches a newly enabled slot_id for a different device, causing us to perform a action on the wrong device.
--- drivers/usb/host/xhci-mem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-mem.c +2 -0
@@ -960,6 +960,8 @@ void xhci_free_virt_device(struct xhci_hif (dev->out_ctx)xhci_free_container_ctx (xhci, dev->out_ctx); +if (dev->udev && dev->udev->slot_id) + dev->udev->slot_id =0 ;kfree (xhci->devs[slot_id]); xhci->devs[slot_id] =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 210/268 MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Kresin <[email protected]>
[ Upstream commit 05454c1bde91fb013c0431801001da82947e6b5a ]
According to the QCA u-boot source the "PCIE Phase Lock Loop Configuration (PCIE_PLL_CONFIG)" register is for all SoCs except the QCA955X and QCA956X at offset 0x10.
Since the PCIE PLL config register is only defined for the AR724x fix only this value. The value is wrong since the day it was added and isn't used by any driver yet.
Patchwork: https://patchwork.linux-mips.org/patch/16048/
--- arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +1 -1
@@ -167,7 +167,7 @@#define AR71XX_AHB_DIV_MASK 0x7#define AR724X_PLL_REG_CPU_CONFIG 0x00 -#define AR724X_PLL_REG_PCIE_CONFIG 0x18 +#define AR724X_PLL_REG_PCIE_CONFIG 0x10#define AR724X_PLL_FB_SHIFT 0#define AR724X_PLL_FB_MASK 0x3ff
Greg Kroah-Hartman
maintainerPATCH 184/268 ACPI: acpi_pad: Fix memory leak in power saving threads
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lenny Szubowicz <[email protected]>
[ Upstream commit 8b29d29abc484d638213dd79a18a95ae7e5bb402 ]
Fix once per second (round_robin_time) memory leak of about 1 KB in each acpi_pad kernel idling thread that is activated.
Found by testing with kmemleak.
--- drivers/acpi/acpi_pad.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_pad.c +3 -0
@@ -108,6 +108,7 @@ static void round_robin_cpu(unsigned intcpumask_andnot (tmp, cpu_online_mask, pad_busy_cpus);if (cpumask_empty (tmp)) {mutex_unlock (&round_robin_lock); +free_cpumask_var (tmp);return ; }for_each_cpu (cpu, tmp) {
@@ -125,6 +126,8 @@ static void round_robin_cpu(unsigned intmutex_unlock (&round_robin_lock);set_cpus_allowed_ptr (current,cpumask_of (preferred_cpu)); + +free_cpumask_var (tmp); }static void exit_round_robin (unsigned int tsk_index)
Greg Kroah-Hartman
maintainerPATCH 212/268 ipmi_ssif: Fix kernel panic at msg_done_handler
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamlakant Patel <[email protected]>
[ Upstream commit f002612b9d86613bc6fde0a444e0095225f6053e ]
This happens when BMC doesn't return any data and the code is trying to print the value of data[2].
Getting following crash:
[ 484.728410] Unable to handle kernel NULL pointer dereference at virtual address 00000002 [ 484.736496] pgd = ffff0000094a2000 [ 484.739885] [00000002] *pgd=00000047fcffe003, *pud=00000047fcffd003, *pmd=0000000000000000 [ 484.748158] Internal error: Oops: 96000005 [#1] SMP [...] [ 485.101451] Call trace: [...] [ 485.188473] [<ffff000000a46e68>] msg_done_handler+0x668/0x700 [ipmi_ssif] [ 485.195249] [<ffff000000a456b8>] ipmi_ssif_thread+0x110/0x128 [ipmi_ssif] [ 485.202038] [<ffff0000080f1430>] kthread+0x108/0x138 [ 485.206994] [<ffff0000080838e0>] ret_from_fork+0x10/0x30 [ 485.212294] Code: aa1903e1 aa1803e0 b900227f 95fef6a5 (39400aa3)
Adding a check to validate the data len before printing data[2] to fix this issue.
--- drivers/char/ipmi/ipmi_ssif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +2 -2
@@ -757,7 +757,7 @@ static void msg_done_handler(struct ssif ssif_info->ssif_state =SSIF_NORMAL ;ipmi_ssif_unlock_cond (ssif_info, flags);pr_warn (PFX "Error getting flags: %d %d, %x\n" , - result, len, data[2 ]); + result, len, (len >=3 ) ? data[2 ] :0 ); }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_GET_MSG_FLAGS_CMD ) {/*
@@ -779,7 +779,7 @@ static void msg_done_handler(struct ssifif ((result <0 ) || (len <3 ) || (data[2 ] !=0 )) {/* Error clearing flags */ pr_warn (PFX "Error clearing flags: %d %d, %x\n" , - result, len, data[2 ]); + result, len, (len >=3 ) ? data[2 ] :0 ); }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_CLEAR_MSG_FLAGS_CMD ) { pr_warn(PFX "Invalid response clearing flags: %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 213/268 usb: dwc2: Fix interval type issue
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Grigor Tovmasyan <[email protected]>
[ Upstream commit 12814a3f8f9b247531d7863170cc82b3fe4218fd ]
The maximum value that unsigned char can hold is 255, meanwhile the maximum value of interval is 2^(bIntervalMax-1)=2^15.
--- drivers/usb/dwc2/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/core.h +1 -1
@@ -187,7 +187,7 @@ struct dwc2_hsotg_ep {unsigned char dir_in;unsigned char index;unsigned char mc; -unsigned char interval; +u16 interval; unsigned int halted:1; unsigned int periodic:1;
Greg Kroah-Hartman
maintainerPATCH 214/268 usb: gadget: ffs: Let setup() return USB_GADGET_DELAYED_STATUS
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
[ Upstream commit 946ef68ad4e45aa048a5fb41ce8823ed29da866a ]
Some UDC drivers (like the DWC3) expect that the response to a setup() request is queued from within the setup function itself so that it is available as soon as setup() has completed.
Upon receiving a setup request the function fs driver creates an event that is made available to userspace. And only once userspace has acknowledged that event the response to the setup request is queued.
So it violates the requirement of those UDC drivers and random failures can be observed. This is basically a race condition and if userspace is able to read the event and queue the response fast enough all is good. But if it is not, for example because other processes are currently scheduled to run, the USB host that sent the setup request will observe an error.
To avoid this the gadget framework provides the USB_GADGET_DELAYED_STATUS return code. If a setup() callback returns this value the UDC driver is aware that response is not yet available and can uses the appropriate methods to handle this case.
Since in the case of function fs the response will never be available when the setup() function returns make sure that this status code is used.
This fixed random occasional failures that were previously observed on a DWC3 based system under high system load.
--- drivers/usb/gadget/function/f_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +1 -1
@@ -3033,7 +3033,7 @@ static int ffs_func_setup(struct usb_fun__ffs_event_add (ffs,FUNCTIONFS_SETUP );spin_unlock_irqrestore (&ffs->ev.waitq.lock, flags); -return 0 ; +return USB_GADGET_DELAYED_STATUS ; }static void ffs_func_suspend (struct usb_function *f)
Greg Kroah-Hartman
maintainerPATCH 185/268 powerpc/mpic: Check if cpu_possible() in mpic_physmask()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 0834d627fbea00c1444075eb3e448e1974da452d ]
In mpic_physmask() we loop over all CPUs up to 32, then get the hard SMP processor id of that CPU.
Currently that's possibly walking off the end of the paca array, but in a future patch we will change the paca array to be an array of pointers, and in that case we will get a NULL for missing CPUs and oops. eg:
Unable to handle kernel paging request for data at address 0x88888888888888b8 Faulting instruction address: 0xc00000000004e380 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP .mpic_set_affinity+0x60/0x1a0 LR .irq_do_set_affinity+0x48/0x100
Fix it by checking the CPU is possible, this also fixes the code if there are gaps in the CPU numbering which probably never happens on mpic systems but who knows.
--- arch/powerpc/sysdev/mpic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/sysdev/mpic.c +1 -1
@@ -626,7 +626,7 @@ static inline u32 mpic_physmask(u32 cpumint i;u32 mask =0 ; -for (i =0 ; i <min (32 ,NR_CPUS ); ++i, cpumask >>=1 ) +for (i =0 ; i <min (32 ,NR_CPUS ) &&cpu_possible (i); ++i, cpumask >>=1 ) mask |= (cpumask &1 ) <<get_hard_smp_processor_id (i);return mask; }
Greg Kroah-Hartman
maintainerPATCH 186/268 m68k: set dma and coherent masks for platform FEC ethernets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Ungerer <[email protected]>
[ Upstream commit f61e64310b75733d782e930d1fb404b84699eed6 ]
As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") the Freescale FEC driver is issuing the following warning on driver initialization on ColdFire systems:
WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 0x40159e20
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc7-dirty #4
Stack from 41833dd8:
41833dd8 40259c53 40025534 40279e26 00000003 00000000 4004e514 41827000
400255de 40244e42 00000204 40159e20 00000009 00000000 00000000 4024531d
40159e20 40244e42 00000204 00000000 00000000 00000000 00000007 00000000
00000000 40279e26 4028d040 40226576 4003ae88 40279e26 418273f6 41833ef8
7fffffff 418273f2 41867028 4003c9a2 4180ac6c 00000004 41833f8c 4013e71c
40279e1c 40279e26 40226c16 4013ced2 40279e26 40279e58 4028d040 00000000
Call Trace:
[<40025534>] 0x40025534
[<4004e514>] 0x4004e514
[<400255de>] 0x400255de
[<40159e20>] 0x40159e20
[<40159e20>] 0x40159e20It is not fatal, the driver and the system continue to function normally.
As per the warning the coherent_dma_mask is not set on this device. There is nothing special about the DMA memory coherency on this hardware so we can just set the mask to 32bits in the platform data for the FEC ethernet devices.
--- arch/m68k/coldfire/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/m68k/coldfire/device.c +10 -2
@@ -135,7 +135,11 @@ static struct platform_device mcf_fec0 = .id = 0, .num_resources = ARRAY_SIZE(mcf_fec0_resources), .resource = mcf_fec0_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec0.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#ifdef MCFFEC_BASE1
@@ -167,7 +171,11 @@ static struct platform_device mcf_fec1 = .id = 1, .num_resources = ARRAY_SIZE(mcf_fec1_resources), .resource = mcf_fec1_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec1.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#endif /* MCFFEC_BASE1 */ #endif /* CONFIG_FEC */
Greg Kroah-Hartman
maintainerPATCH 188/268 hwmon: (nct6775) Fix writing pwmX_mode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 415eb2a1aaa4881cf85bd86c683356fdd8094a23 ]
pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip register bit is set to 1 for DC mode. This got mixed up, and writing 1 into pwmX_mode resulted in DC mode enabled. Fix it up by using the ABI definition throughout the driver for consistency.
--- drivers/hwmon/nct6775.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/nct6775.c +5 -5
@@ -1390,7 +1390,7 @@ static void nct6775_update_pwm(struct de duty_is_dc = data->REG_PWM_MODE[i] && (nct6775_read_value (data, data->REG_PWM_MODE[i]) & data->PWM_MODE_MASK[i]); - data->pwm_mode[i] = duty_is_dc; + data->pwm_mode[i] = !duty_is_dc; fanmodecfg =nct6775_read_value (data, data->REG_FAN_MODE[i]);for (j =0 ; j <ARRAY_SIZE (data->REG_PWM); j++) {
@@ -2267,7 +2267,7 @@ show_pwm_mode(struct device *dev, structstruct nct6775_data *data =nct6775_update_device (dev);struct sensor_device_attribute *sattr =to_sensor_dev_attr (attr); -return sprintf (buf,"%d\n" , !data->pwm_mode[sattr->index]); +return sprintf (buf,"%d\n" , data->pwm_mode[sattr->index]); } static ssize_t
@@ -2288,9 +2288,9 @@ store_pwm_mode(struct device *dev, strucif (val >1 )return -EINVAL ; -/* Setting DC mode is not supported for all chips/channels */ +/* Setting DC mode (0) is not supported for all chips/channels */ if (data->REG_PWM_MODE[nr] ==0 ) { -if (val) +if (!val)return -EINVAL ;return count; }
@@ -2299,7 +2299,7 @@ store_pwm_mode(struct device *dev, struc data->pwm_mode[nr] = val; reg =nct6775_read_value (data, data->REG_PWM_MODE[nr]); reg &= ~data->PWM_MODE_MASK[nr]; -if (val) +if (!val) reg |= data->PWM_MODE_MASK[nr];nct6775_write_value (data, data->REG_PWM_MODE[nr], reg);mutex_unlock (&data->update_lock);
Greg Kroah-Hartman
maintainerPATCH 189/268 rtc: hctosys: Ensure system time doesnt overflow time_t
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
[ Upstream commit b3a5ac42ab18b7d1a8f2f072ca0ee76a3b754a43 ]
On 32bit platforms, time_t is still a signed 32bit long. If it is overflowed, userspace and the kernel cant agree on the current system time. This causes multiple issues, in particular with systemd:
https://github.com/systemd/systemd/issues/1143
A good workaround is to simply avoid using hctosys which is something I greatly encourage as the time is better set by userspace.
However, many distribution enable it and use systemd which is rendering the system unusable in case the RTC holds a date after 2038 (and more so after 2106). Many drivers have workaround for this case and they should be eliminated so there is only one place left to fix when userspace is able to cope with dates after the 31bit overflow.
--- drivers/rtc/hctosys.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rtc/hctosys.c +5 -0
@@ -49,6 +49,11 @@ static int __init rtc_hctosys(void) tv64.tv_sec =rtc_tm_to_time64 (&tm); +#if BITS_PER_LONG ==32 +if (tv64.tv_sec >INT_MAX ) + goto err_read; +#endif + err =do_settimeofday64 (&tv64); dev_info(rtc->dev.parent,
Greg Kroah-Hartman
maintainerPATCH 190/268 powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Madhavan Srinivasan <[email protected]>
[ Upstream commit bb19af816025d495376bd76bf6fbcf4244f9a06d ]
The current Branch History Rolling Buffer (BHRB) code does not check for any privilege levels before updating the data from BHRB. This could leak kernel addresses to userspace even when profiling only with userspace privileges. Add proper checks to prevent it.
--- arch/powerpc/perf/core-book3s.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/perf/core-book3s.c +10 -0
@@ -448,6 +448,16 @@ static void power_pmu_bhrb_read(struct c/* invalid entry */ continue ; +/* +* BHRB rolling buffer could very much contain the kernel +* addresses at this point. Check the privileges before +* exporting it to userspace (avoid exposure of regions +* where we could have speculative execution) +*/ +if (perf_paranoid_kernel () && !capable (CAP_SYS_ADMIN ) && +is_kernel_addr (addr)) +continue ; +/* Branches are read most recent first (ie. mfbhrb 0 is * the most recent branch). * There are two types of valid entries:
Greg Kroah-Hartman
maintainerPATCH 181/268 Btrfs: fix copy_items() return value when logging an inode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 8434ec46c6e3232cebc25a910363b29f5c617820 ]
When logging an inode, at tree-log.c:copy_items(), if we call btrfs_next_leaf() at the loop which checks for the need to log holes, we need to make sure copy_items() returns the value 1 to its caller and not 0 (on success). This is because the path the caller passed was released and is now different from what is was before, and the caller expects a return value of 0 to mean both success and that the path has not changed, while a return value of 1 means both success and signals the caller that it can not reuse the path, it has to perform another tree search.
Even though this is a case that should not be triggered on normal circumstances or very rare at least, its consequences can be very unpredictable (especially when replaying a log tree).
--- fs/btrfs/tree-log.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/tree-log.c +1 -0
@@ -3835,6 +3835,7 @@ fill_holes:ASSERT (ret ==0 ); src = src_path->nodes[0 ]; i =0 ; + need_find_last_extent = true; }btrfs_item_key_to_cpu (src, &key, i);
Greg Kroah-Hartman
maintainerPATCH 225/268 x86/devicetree: Initialize device tree before using it
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Gorinov <[email protected]>
[ Upstream commit 628df9dc5ad886b0a9b33c75a7b09710eb859ca1 ]
Commit 08d53aa58cb1 added CRC32 calculation in early_init_dt_verify() and checking in late initcall of_fdt_raw_init(), making early_init_dt_verify() mandatory.
The required call to early_init_dt_verify() was not added to the x86-specific implementation, causing failure to create the sysfs entry in of_fdt_raw_init().
--- arch/x86/kernel/devicetree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/devicetree.c +5 -3
@@ -11,6 +11,7 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/of_irq.h> +#include <linux/libfdt.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/of_pci.h>
@@ -276,14 +277,15 @@ static void __init x86_flattree_get_conf map_len =max (PAGE_SIZE - (initial_dtb & ~PAGE_MASK ), (u64 )128 ); - initial_boot_params = dt =early_memremap (initial_dtb, map_len); - size =of_get_flat_dt_size (); + dt =early_memremap (initial_dtb, map_len); + size =fdt_totalsize (dt);if (map_len < size) {early_memunmap (dt, map_len); - initial_boot_params = dt =early_memremap (initial_dtb, size); + dt =early_memremap (initial_dtb, size); map_len = size; } +early_init_dt_verify (dt);unflatten_and_copy_device_tree ();early_memunmap (dt, map_len); }
Greg Kroah-Hartman
maintainerPATCH 226/268 x86/devicetree: Fix device IRQ settings in DT
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Gorinov <[email protected]>
[ Upstream commit 0a5169add90e43ab45ab1ba34223b8583fcaf675 ]
IRQ parameters for the SoC devices connected directly to I/O APIC lines (without PCI IRQ routing) may be specified in the Device Tree.
Called from DT IRQ parser, irq_create_fwspec_mapping() calls irq_domain_alloc_irqs() with a pointer to irq_fwspec structure as @arg.
But x86-specific DT IRQ allocation code casts @arg to of_phandle_args structure pointer and crashes trying to read the IRQ parameters. The function was not converted when the mapping descriptor was changed to irq_fwspec in the generic irqdomain code.
--- arch/x86/kernel/devicetree.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/x86/kernel/devicetree.c +8 -5
@@ -200,19 +200,22 @@ static struct of_ioapic_type of_ioapic_tstatic int dt_irqdomain_alloc (struct irq_domain *domain,unsigned int virq,unsigned int nr_irqs,void *arg) { -struct of_phandle_args *irq_data = (void *)arg; +struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;struct of_ioapic_type *it;struct irq_alloc_info tmp; +int type_index; -if (WARN_ON (irq_data->args_count <2 )) +if (WARN_ON (fwspec->param_count <2 ))return -EINVAL ; -if (irq_data->args[1 ] >=ARRAY_SIZE (of_ioapic_type)) + + type_index = fwspec->param[1 ]; +if (type_index >=ARRAY_SIZE (of_ioapic_type))return -EINVAL ; - it = &of_ioapic_type[irq_data->args[1 ]]; + it = &of_ioapic_type[type_index];ioapic_set_alloc_attr (&tmp,NUMA_NO_NODE , it->trigger, it->polarity); tmp.ioapic_id =mpc_ioapic_id (mp_irqdomain_ioapic_idx (domain)); - tmp.ioapic_pin = irq_data->args[0 ]; + tmp.ioapic_pin = fwspec->param[0 ];return mp_irqdomain_alloc (domain, virq, nr_irqs, &tmp); }
Greg Kroah-Hartman
maintainerPATCH 227/268 ALSA: vmaster: Propagate slave error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 2e2c177ca84aff092c3c96714b0f6a12900f3946 ]
In slave_update() of vmaster code ignores the error from the slave get() callback and copies the values. It's not only about the missing error code but also that this may potentially lead to a leak of uninitialized variables when the slave get() don't clear them.
This patch fixes slave_update() not to copy the potentially uninitialized values when an error is returned from the slave get() callback, and to propagate the error value properly.
--- sound/core/vmaster.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/core/vmaster.c +4 -1
@@ -68,10 +68,13 @@ static int slave_update(struct link_slavreturn -ENOMEM ; uctl->id = slave->slave.id; err = slave->slave.get (&slave->slave, uctl); +if (err <0 ) + goto error;for (ch =0 ; ch < slave->info.count; ch++) slave->vals[ch] = uctl->value.integer.value[ch]; + error:kfree (uctl); -return 0 ; +return err <0 ? err :0 ; }/* get the slave ctl info and save the initial values */
Greg Kroah-Hartman
maintainerPATCH 228/268 media: cx23885: Override 888 ImpactVCBe crystal frequency
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
[ Upstream commit 779c79d4b833ec646b0aed878da38edb45bbe156 ]
Hauppauge produced a revision of ImpactVCBe using an 888, with a 25MHz crystal, instead of using the default third overtone 50Mhz crystal. This overrides that frequency so that the cx25840 is properly configured. Without the proper crystal setup the cx25840 cannot load the firmware or decode video.
--- drivers/media/pci/cx23885/cx23885-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/media/pci/cx23885/cx23885-core.c +10 -0
@@ -872,6 +872,16 @@ static int cx23885_dev_setup(struct cx23if (cx23885_boards[dev->board].clk_freq >0 ) dev->clk_freq = cx23885_boards[dev->board].clk_freq; +if (dev->board ==CX23885_BOARD_HAUPPAUGE_IMPACTVCBE && + dev->pci->subsystem_device ==0x7137 ) { +/* Hauppauge ImpactVCBe device ID 0x7137 is populated +* with an 888, and a 25Mhz crystal, instead of the +* usual third overtone 50Mhz. The default clock rate must +* be overridden so the cx25840 is properly configured +*/ + dev->clk_freq =25000000 ; + } + dev->pci_bus = dev->pci->bus->number; dev->pci_slot =PCI_SLOT (dev->pci->devfn);cx23885_irq_add (dev,0x001f00 );
Greg Kroah-Hartman
maintainerPATCH 229/268 media: cx23885: Set subdev host data to clk_freq pointer
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
[ Upstream commit 5ceade1d97fc6687e050c44c257382c192f56276 ]
Currently clk_freq is ignored entirely, because the cx235840 driver configures the xtal at the chip defaults. This is an issue if a board is produced with a non-default frequency crystal. If clk_freq is not zero the cx25840 will attempt to use the setting provided, or fall back to defaults otherwise.
--- drivers/media/pci/cx23885/cx23885-cards.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/pci/cx23885/cx23885-cards.c +4 -0
@@ -2124,6 +2124,10 @@ void cx23885_card_setup(struct cx23885_d &dev->i2c_bus[2 ].i2c_adap, "cx25840", 0x88 >> 1, NULL);if (dev->sd_cx25840) { +/* set host data for clk_freq configuration */ +v4l2_set_subdev_hostdata (dev->sd_cx25840, + &dev->clk_freq); + dev->sd_cx25840->grp_id =CX23885_HW_AV_CORE ;v4l2_subdev_call (dev->sd_cx25840, core, load_fw); }
Greg Kroah-Hartman
maintainerPATCH 230/268 media: s3c-camif: fix out-of-bounds array access
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a398e043637a4819a0e96467bfecaabf3224dd62 ]
While experimenting with older compiler versions, I ran into a warning that no longer shows up on gcc-4.8 or newer:
drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds
This is an off-by-one bug, leading to an access before the start of the array, while newer compilers silently assume this undefined behavior cannot happen and leave the loop at index 0 if no other entry matches.
As Sylvester explains, we actually need to ensure that the value is within the range, so this reworks the loop to be easier to parse correctly, and an additional check to fall back on the first format value for any unexpected input.
I found an existing gcc bug for it and added a reduced version of the function there.
--- drivers/media/platform/s3c-camif/camif-capture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/platform/s3c-camif/camif-capture.c +4 -3
@@ -1268,16 +1268,17 @@ static void __camif_subdev_try_format(st {const struct s3c_camif_variant *variant = camif->variant;const struct vp_pix_limits *pix_lim; -int i =ARRAY_SIZE (camif_mbus_formats); +unsigned int i;/* FIXME: constraints against codec or preview path ? */ pix_lim = &variant->vp_pix_limits[VP_CODEC ]; -while (i-- >=0 ) +for (i =0 ; i <ARRAY_SIZE (camif_mbus_formats); i++)if (camif_mbus_formats[i] == mf->code)break ; - mf->code = camif_mbus_formats[i]; +if (i ==ARRAY_SIZE (camif_mbus_formats)) + mf->code = camif_mbus_formats[0 ];if (pad ==CAMIF_SD_PAD_SINK ) { v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH,
Greg Kroah-Hartman
maintainerPATCH 231/268 dmaengine: pl330: fix a race condition in case of threaded irqs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Hou <[email protected]>
[ Upstream commit a3ca831249ca8c4c226e4ceafee04e280152e59d ]
When booting up with "threadirqs" in command line, all irq handlers of the DMA controller pl330 will be threaded forcedly. These threads will race for the same list, pl330->req_done.
Before the callback, the spinlock was released. And after it, the spinlock was taken. This opened an race window where another threaded irq handler could steal the spinlock and be permitted to delete entries of the list, pl330->req_done.
If the later deleted an entry that was still referred to by the former, there would be a kernel panic when the former was scheduled and tried to get the next sibling of the deleted entry.
The scenario could be depicted as below:
Thread: T1 pl330->req_done Thread: T2
| | |
| -A-B-C-D- |
Locked | |
| | Waiting
Del A | |
| -B-C-D- |
Unlocked | |
| | Locked
Waiting | |
| | Del B
| | |
| -C-D- Unlocked
Waiting | |
|
Locked
| get C via B
\
- Kernel panic
The kernel panic looked like as below:
Unable to handle kernel paging request at virtual address dead000000000108 pgd = ffffff8008c9e000 [dead000000000108] *pgd=000000027fffe003, *pud=000000027fffe003, *pmd=0000000000000000 Internal error: Oops: 96000044 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 85 Comm: irq/59-66330000 Not tainted 4.8.24-WR9.0.0.12_standard #2 Hardware name: Broadcom NS2 SVK (DT) task: ffffffc1f5cc3c00 task.stack: ffffffc1f5ce0000 PC is at pl330_irq_handler+0x27c/0x390 LR is at pl330_irq_handler+0x2a8/0x390 pc : [<ffffff80084cb694>] lr : [<ffffff80084cb6c0>] pstate: 800001c5
sp : ffffffc1f5ce3d00
x29: ffffffc1f5ce3d00 x28: 0000000000000140
x27: ffffffc1f5c530b0 x26: dead000000000100
x25: dead000000000200 x24: 0000000000418958
x23: 0000000000000001 x22: ffffffc1f5ccd668
x21: ffffffc1f5ccd590 x20: ffffffc1f5ccd418
x19: dead000000000060 x18: 0000000000000001
x17: 0000000000000007 x16: 0000000000000001
x15: ffffffffffffffff x14: ffffffffffffffff
x13: ffffffffffffffff x12: 0000000000000000
x11: 0000000000000001 x10: 0000000000000840
x9 : ffffffc1f5ce0000 x8 : ffffffc1f5cc3338
x7 : ffffff8008ce2020 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001
x3 : dead000000000200 x2 : dead000000000100
x1 : 0000000000000140 x0 : ffffffc1f5ccd590
Process irq/59-66330000 (pid: 85, stack limit = 0xffffffc1f5ce0020)
Stack: (0xffffffc1f5ce3d00 to 0xffffffc1f5ce4000)
3d00: ffffffc1f5ce3d80 ffffff80080f09d0 ffffffc1f5ca0c00 ffffffc1f6f7c600 3d20: ffffffc1f5ce0000 ffffffc1f6f7c600 ffffffc1f5ca0c00 ffffff80080f0998 3d40: ffffffc1f5ce0000 ffffff80080f0000 0000000000000000 0000000000000000 3d60: ffffff8008ce202c ffffff8008ce2020 ffffffc1f5ccd668 ffffffc1f5c530b0 3d80: ffffffc1f5ce3db0 ffffff80080f0d70 ffffffc1f5ca0c40 0000000000000001 3da0: ffffffc1f5ce0000 ffffff80080f0cfc ffffffc1f5ce3e20 ffffff80080bf4f8 3dc0: ffffffc1f5ca0c80 ffffff8008bf3798 ffffff8008955528 ffffffc1f5ca0c00 3de0: ffffff80080f0c30 0000000000000000 0000000000000000 0000000000000000 3e00: 0000000000000000 0000000000000000 0000000000000000 ffffff80080f0b68 3e20: 0000000000000000 ffffff8008083690 ffffff80080bf420 ffffffc1f5ca0c80 3e40: 0000000000000000 0000000000000000 0000000000000000 ffffff80080cb648 3e60: ffffff8008b1c780 0000000000000000 0000000000000000 ffffffc1f5ca0c00 3e80: ffffffc100000000 ffffff8000000000 ffffffc1f5ce3e90 ffffffc1f5ce3e90 3ea0: 0000000000000000 ffffff8000000000 ffffffc1f5ce3eb0 ffffffc1f5ce3eb0 3ec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3fa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3fc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000 3fe0: 0000000000000000 0000000000000000 0000000275ce3ff0 0000000275ce3ff8
Call trace: Exception stack(0xffffffc1f5ce3b30 to 0xffffffc1f5ce3c60)
3b20: dead000000000060 0000008000000000
3b40: ffffffc1f5ce3d00 ffffff80084cb694 0000000000000008 0000000000000e88 3b60: ffffffc1f5ce3bb0 ffffff80080dac68 ffffffc1f5ce3b90 ffffff8008826fe4 3b80: 00000000000001c0 00000000000001c0 ffffffc1f5ce3bb0 ffffff800848dfcc 3ba0: 0000000000020000 ffffff8008b15ae4 ffffffc1f5ce3c00 ffffff800808f000 3bc0: 0000000000000010 ffffff80088377f0 ffffffc1f5ccd590 0000000000000140 3be0: dead000000000100 dead000000000200 0000000000000001 0000000000000000 3c00: 0000000000000000 ffffff8008ce2020 ffffffc1f5cc3338 ffffffc1f5ce0000 3c20: 0000000000000840 0000000000000001 0000000000000000 ffffffffffffffff 3c40: ffffffffffffffff ffffffffffffffff 0000000000000001 0000000000000007
[<ffffff80084cb694>] pl330_irq_handler+0x27c/0x390 [<ffffff80080f09d0>] irq_forced_thread_fn+0x38/0x88 [<ffffff80080f0d70>] irq_thread+0x140/0x200 [<ffffff80080bf4f8>] kthread+0xd8/0xf0 [<ffffff8008083690>] ret_from_fork+0x10/0x40 Code: f2a00838 f9405763 aa1c03e1 aa1503e0 (f9000443) ---[ end trace f50005726d31199c ]--- Kernel panic - not syncing: Fatal exception in interrupt
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0-1
Kernel Offset: disabled
Memory Limit: none
---[ end Kernel panic - not syncing: Fatal exception in interrupt
To fix this, re-start with the list-head after dropping the lock then re-takeing it.
--- drivers/dma/pl330.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +4 -2
@@ -1533,7 +1533,7 @@ static void pl330_dotask(unsigned long d/* Returns 1 if state was updated, 0 otherwise */ static int pl330_update (struct pl330_dmac *pl330) { -struct dma_pl330_desc *descdone, *tmp; +struct dma_pl330_desc *descdone;unsigned long flags;void __iomem *regs;u32 val;
@@ -1611,7 +1611,9 @@ static int pl330_update(struct pl330_dma }/* Now that we are in no hurry, do the callbacks */ -list_for_each_entry_safe (descdone, tmp, &pl330->req_done, rqd) { +while (!list_empty (&pl330->req_done)) { + descdone =list_first_entry (&pl330->req_done, + struct dma_pl330_desc, rqd);list_del (&descdone->rqd);spin_unlock_irqrestore (&pl330->lock, flags);dma_pl330_rqcb (descdone,PL330_ERR_NONE );
Greg Kroah-Hartman
maintainerPATCH 232/268 media: em28xx: USB bulk packet size fix
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
[ Upstream commit c7c7e8d7803406daa21e96d00c357de8b77b6764 ]
Hauppauge em28xx bulk devices exhibit continuity errors and corrupted packets, when run in VMWare virtual machines. Unknown if other manufacturers bulk models exhibit the same issue. KVM/Qemu is unaffected.
According to documentation the maximum packet multiplier for em28xx in bulk transfer mode is 256 * 188 bytes. This changes the size of bulk transfers to maximum supported value and have a bonus beneficial alignment.
Before:
After:
This sets up USB to expect just as many bytes as the em28xx is set to emit.
Successful usage under load afterwards natively and in both VMWare and KVM/Qemu virtual machines.
--- drivers/media/usb/em28xx/em28xx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx.h +1 -1
@@ -187,7 +187,7 @@USB 2.0 spec says bulk packet size is always 512 bytes */ #define EM28XX_BULK_PACKET_MULTIPLIER 384 -#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 384 +#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 94#define EM28XX_INTERLACED_DEFAULT 1
Greg Kroah-Hartman
maintainerPATCH 233/268 clk: rockchip: Prevent calculating mmc phase if clock rate is zero
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit 4bf59902b50012b1dddeeaa23b217d9c4956cdda ]
The MMC sample and drv clock for rockchip platforms are derived from the bus clock output to the MMC/SDIO card. So it should never happens that the clk rate is zero given it should inherits the clock rate from its parent. If something goes wrong and makes the clock rate to be zero, the calculation would be wrong but may still make the mmc tuning process work luckily. However it makes people harder to debug when the following data transfer is unstable.
--- drivers/clk/rockchip/clk-mmc-phase.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/clk/rockchip/clk-mmc-phase.c +23 -0
@@ -60,6 +60,12 @@ static int rockchip_mmc_get_phase(structu16 degrees;u32 delay_num =0 ; +/* See the comment for rockchip_mmc_set_phase below */ +if (!rate) { +pr_err ("%s: invalid clk rate\n" , __func__); +return -EINVAL ; + } + raw_value =readl (mmc_clock->reg) >> (mmc_clock->shift); degrees = (raw_value &ROCKCHIP_MMC_DEGREE_MASK ) *90 ;
@@ -86,6 +92,23 @@ static int rockchip_mmc_set_phase(structu32 raw_value;u32 delay; +/* +* The below calculation is based on the output clock from +* MMC host to the card, which expects the phase clock inherits +* the clock rate from its parent, namely the output clock +* provider of MMC host. However, things may go wrong if +* (1) It is orphan. +* (2) It is assigned to the wrong parent. +* +* This check help debug the case (1), which seems to be the +* most likely problem we often face and which makes it difficult +* for people to debug unstable mmc tuning results. +*/ +if (!rate) { +pr_err ("%s: invalid clk rate\n" , __func__); +return -EINVAL ; + } + nineties = degrees /90 ; remainder = (degrees %90 );
Greg Kroah-Hartman
maintainerPATCH 234/268 enic: enable rq before updating rq descriptors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit e8588e268509292550634d9a35f2723a207683b2 ]
rq should be enabled before posting the buffers to rq desc. If not hw sees stale value and casuses DMAR errors.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +7 -3
@@ -1726,6 +1726,8 @@ static int enic_open(struct net_device * }for (i =0 ; i < enic->rq_count; i++) { +/* enable rq before updating rq desc */ +vnic_rq_enable (&enic->rq[i]);vnic_rq_fill (&enic->rq[i], enic_rq_alloc_buf);/* Need at least one buffer on ring to get going */ if (vnic_rq_desc_used (&enic->rq[i]) ==0 ) {
@@ -1737,8 +1739,6 @@ static int enic_open(struct net_device *for (i =0 ; i < enic->wq_count; i++)vnic_wq_enable (&enic->wq[i]); -for (i =0 ; i < enic->rq_count; i++) -vnic_rq_enable (&enic->rq[i]);if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic))enic_dev_add_station_addr (enic);
@@ -1765,8 +1765,12 @@ static int enic_open(struct net_device *return 0 ; err_out_free_rq: -for (i =0 ; i < enic->rq_count; i++) +for (i =0 ; i < enic->rq_count; i++) { + err =vnic_rq_disable (&enic->rq[i]); +if (err) +return err;vnic_rq_clean (&enic->rq[i], enic_free_rq_buf); + }enic_dev_notify_unset (enic); err_out_free_intr:enic_unset_affinity_hint (enic);
Greg Kroah-Hartman
maintainerPATCH 217/268 ASoC: topology: create TLV data for dapm widgets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
[ Upstream commit bde8b3887add8368ecf0ca71117baf2fd56a6fc9 ]
This patch adds the change required to create the TLV data for dapm widget kcontrols from topology. This also fixes the following TLV read error shown in amixer while showing the card control contents. "amixer: Control hw:1 element TLV read error: No such device or address"
--- sound/soc/soc-topology.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/soc-topology.c +3 -0
@@ -1188,6 +1188,9 @@ static struct snd_kcontrol_new *soc_tplgkfree (sm);continue ; } + +/* create any TLV data */ +soc_tplg_create_tlv (tplg, &kc[i], &mc->hdr); }return kc;
Greg Kroah-Hartman
maintainerPATCH 235/268 hwrng: stm32 - add reset during probe
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 326ed382256475aa4b8b7eae8a2f60689fd25e78 ]
Avoid issue when probing the RNG without
reset if bad status has been detected previously
--- drivers/char/hw_random/stm32-rng.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/char/hw_random/stm32-rng.c +9 -0
@@ -21,6 +21,7 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/slab.h> #define RNG_CR 0x00
@@ -46,6 +47,7 @@ struct stm32_rng_private {struct hwrng rng;void __iomem *base;struct clk *clk; +struct reset_control *rst; };static int stm32_rng_read (struct hwrng *rng,void *data,size_t max,bool wait)
@@ -140,6 +142,13 @@ static int stm32_rng_probe(struct platfoif (IS_ERR (priv->clk))return PTR_ERR (priv->clk); + priv->rst =devm_reset_control_get (&ofdev->dev,NULL ); +if (!IS_ERR (priv->rst)) { +reset_control_assert (priv->rst); +udelay (2 ); +reset_control_deassert (priv->rst); + } +dev_set_drvdata (dev, priv); priv->rng.name = dev_driver_string(dev),
Greg Kroah-Hartman
maintainerPATCH 237/268 rtc: tx4939: avoid unintended sign extension on a 24 bit shift
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 347876ad47b9923ce26e686173bbf46581802ffa ]
The shifting of buf[5] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an unsigned long. If the top bit of buf[5] is set then all then all the upper bits sec end up as also being set because of the sign-extension. Fix this by casting buf[5] to an unsigned long before the shift.
Detected by CoverityScan, CID#1465292 ("Unintended sign extension")
--- drivers/rtc/rtc-tx4939.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-tx4939.c +4 -2
@@ -86,7 +86,8 @@ static int tx4939_rtc_read_time(struct dfor (i =2 ; i <6 ; i++) buf[i] =__raw_readl (&rtcreg->dat);spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, tm);return rtc_valid_tm (tm); }
@@ -147,7 +148,8 @@ static int tx4939_rtc_read_alarm(struct alrm->enabled = (ctl &TX4939_RTCCTL_ALME ) ?1 :0 ; alrm->pending = (ctl &TX4939_RTCCTL_ALMD ) ?1 :0 ;spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, &alrm->time);return rtc_valid_tm (&alrm->time); }
Greg Kroah-Hartman
maintainerPATCH 238/268 serial: xuartps: Fix out-of-bounds access through DT alias
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit e7d75e18d0fc3f7193b65282b651f980c778d935 ]
The cdns_uart_port[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/xilinx_uartps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/xilinx_uartps.c +1 -1
@@ -1026,7 +1026,7 @@ static struct uart_port *cdns_uart_get_pstruct uart_port *port;/* Try the given port id if failed use default method */ -if (cdns_uart_port[id].mapbase !=0 ) { +if (id <CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase !=0 ) {/* Find the next unused port */ for (id =0 ; id <CDNS_UART_NR_PORTS ; id++)if (cdns_uart_port[id].mapbase ==0 )
Greg Kroah-Hartman
maintainerPATCH 239/268 serial: samsung: Fix out-of-bounds access through serial port index
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 49ee23b71877831ac087d6083f6f397dc19c9664 ]
The s3c24xx_serial_ports[] array is indexed using a value derived from the "serialN" alias in DT, or from an incrementing probe index, which may lead to an out-of-bounds access.
Fix this by adding a range check.
Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_SAMSUNG_UARTS), so this can even be triggered using a legitimate DTB or legitimate board code.
--- drivers/tty/serial/samsung.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/samsung.c +4 -0
@@ -1807,6 +1807,10 @@ static int s3c24xx_serial_probe(struct pdbg ("s3c24xx_serial_probe(%p) %d\n" , pdev, index); +if (index >=ARRAY_SIZE (s3c24xx_serial_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , index); +return -EINVAL ; + } ourport = &s3c24xx_serial_ports[index]; ourport->drv_data =s3c24xx_get_driver_data (pdev);
Greg Kroah-Hartman
maintainerPATCH 240/268 serial: mxs-auart: Fix out-of-bounds access through serial port index
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit dd345a31bfdec350d2593e6de5964e55c7f19c76 ]
The auart_port[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/mxs-auart.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/mxs-auart.c +4 -0
@@ -1274,6 +1274,10 @@ static int mxs_auart_probe(struct platfo s->port.line = pdev->id <0 ?0 : pdev->id; else if (ret < 0) return ret; + if (s->port.line >= ARRAY_SIZE(auart_port)) { +dev_err (&pdev->dev,"serial%d out of range\n" , s->port.line); +return -EINVAL ; + }if (of_id) { pdev->id_entry = of_id->data;
Greg Kroah-Hartman
maintainerPATCH 242/268 serial: fsl_lpuart: Fix out-of-bounds access through DT alias
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit ffab87fdecc655cc676f8be8dd1a2c5e22bd6d47 ]
The lpuart_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/fsl_lpuart.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/fsl_lpuart.c +4 -0
@@ -1818,6 +1818,10 @@ static int lpuart_probe(struct platform_dev_err (&pdev->dev,"failed to get alias id, errno %d\n" , ret);return ret; } +if (ret >=ARRAY_SIZE (lpuart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , ret); +return -EINVAL ; + } sport->port.line = ret; sport->lpuart32 =of_device_is_compatible (np,"fsl,ls1021a-lpuart" );
Greg Kroah-Hartman
maintainerPATCH 243/268 serial: arc_uart: Fix out-of-bounds access through DT alias
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f9f5786987e81d166c60833edcb7d1836aa16944 ]
The arc_uart_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_ARC_NR_PORTS), so this can even be triggered using a legitimate DTB.
--- drivers/tty/serial/arc_uart.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/arc_uart.c +5 -0
@@ -597,6 +597,11 @@ static int arc_serial_probe(struct platfif (dev_id <0 ) dev_id =0 ; +if (dev_id >=ARRAY_SIZE (arc_uart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , dev_id); +return -EINVAL ; + } + uart = &arc_uart_ports[dev_id]; port = &uart->port;
Greg Kroah-Hartman
maintainerPATCH 244/268 PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Vincent-Cross <[email protected]>
[ Upstream commit 832e4e1f76b8a84991e9db56fdcef1ebce839b8b ]
Add Marvell 88SE9220 DMA quirk as found and tested on bug 42679.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3628,6 +3628,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x91a0 , quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9220 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9230 , quirk_dma_func1_alias);
Greg Kroah-Hartman
maintainerPATCH 218/268 perf/core: Fix perf_output_read_group()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 9e5b127d6f33468143d90c8a45ca12410e4c3fa7 ]
Mark reported his arm64 perf fuzzer runs sometimes splat like:
armv8pmu_read_counter+0x1e8/0x2d8 armpmu_event_update+0x8c/0x188 armpmu_read+0xc/0x18 perf_output_read+0x550/0x11e8 perf_event_read_event+0x1d0/0x248 perf_event_exit_task+0x468/0xbb8 do_exit+0x690/0x1310 do_group_exit+0xd0/0x2b0 get_signal+0x2e8/0x17a8 do_signal+0x144/0x4f8 do_notify_resume+0x148/0x1e8 work_pending+0x8/0x14
which asserts that we only call pmu::read() on ACTIVE events.
The above callchain does:
perf_event_exit_task()
perf_event_exit_task_context()
task_ctx_sched_out() // INACTIVE
perf_event_exit_event()
perf_event_set_state(EXIT) // EXIT
sync_child_event()
perf_event_read_event()
perf_output_read()
perf_output_read_group()
leader->pmu->read()
Which results in doing a pmu::read() on an !ACTIVE event.
I _think_ this is 'new' since we added attr.inherit_stat, which added the perf_event_read_event() to the exit path, without that perf_event_read_output() would only trigger from samples and for @event to trigger a sample, it's leader _must_ be ACTIVE too.
Still, adding this check makes it consistent with the @sub case for the siblings.
--- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
@@ -5299,7 +5299,8 @@ static void perf_output_read_group(strucif (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if (leader != event) +if ((leader != event) && + (leader->state ==PERF_EVENT_STATE_ACTIVE )) leader->pmu->read (leader); values[n++] =perf_event_count (leader);
Greg Kroah-Hartman
maintainerPATCH 246/268 media: cx25821: prevent out-of-bounds read on array card
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 67300abdbe9f1717532aaf4e037222762716d0f6 ]
Currently an out of range dev->nr is detected by just reporting the issue and later on an out-of-bounds read on array card occurs because of this. Fix this by checking the upper range of dev->nr with the size of array card (removes the hard coded size), move this check earlier and also exit with the error -ENOSYS to avoid the later out-of-bounds array read.
Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")
--- drivers/media/pci/cx25821/cx25821-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/pci/cx25821/cx25821-core.c +4 -3
@@ -871,6 +871,10 @@ static int cx25821_dev_setup(struct cx25 dev->nr = ++cx25821_devcount;sprintf (dev->name,"cx25821[%d]" , dev->nr); +if (dev->nr >=ARRAY_SIZE (card)) { +CX25821_INFO ("dev->nr >= %zd" ,ARRAY_SIZE (card)); +return -ENODEV ; + }if (dev->pci->device !=0x8210 ) {pr_info ("%s(): Exiting. Incorrect Hardware device = 0x%02x\n" , __func__, dev->pci->device);
@@ -886,9 +890,6 @@ static int cx25821_dev_setup(struct cx25 dev->channels[i].sram_channels = &cx25821_sram_channels[i]; } -if (dev->nr >1 ) -CX25821_INFO ("dev->nr > 1!" ); -/* board config */ dev->board =1 ;/* card[dev->nr]; */ dev->_max_num_decoders =MAX_DECODERS ;
Greg Kroah-Hartman
maintainerPATCH 249/268 clk: samsung: exynos5433: Fix PLL rates
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Hajda <[email protected]>
[ Upstream commit ab0447845cffc0fd752df2ccd6b4e34006000ce4 ]
Rates declared in PLL rate tables should match exactly rates calculated from the PLL coefficients. If that is not the case, rate of the PLL's child clock might be set not as expected. For instance, if in the PLL rates table we have a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate will return 393216003. If we now attempt to set rate of a PLL's child divider clock to 393216000/2 its rate will be 131072001, rather than 196608000. That is, the divider will be set to 3 instead of 2, because 393216003/2 is greater than 196608000.
To fix this issue declared rates are changed to exactly match rates generated by the PLL, as calculated from the P, M, S, K coefficients.
--- drivers/clk/samsung/clk-exynos5433.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/samsung/clk-exynos5433.c +6 -6
@@ -747,7 +747,7 @@ static struct samsung_pll_rate_table exyPLL_35XX_RATE (800000000U ,400 ,6 ,1 ),PLL_35XX_RATE (733000000U ,733 ,12 ,1 ),PLL_35XX_RATE (700000000U ,175 ,3 ,1 ), -PLL_35XX_RATE (667000000U ,222 ,4 ,1 ), +PLL_35XX_RATE (666000000U ,222 ,4 ,1 ),PLL_35XX_RATE (633000000U ,211 ,4 ,1 ),PLL_35XX_RATE (600000000U ,500 ,5 ,2 ), PLL_35XX_RATE(552000000U, 460, 5, 2),
@@ -773,12 +773,12 @@ static struct samsung_pll_rate_table exy/* AUD_PLL */ static struct samsung_pll_rate_table exynos5443_aud_pll_rates[] = {PLL_36XX_RATE (400000000U ,200 ,3 ,2 ,0 ), -PLL_36XX_RATE (393216000U ,197 ,3 ,2 ,-25690 ), +PLL_36XX_RATE (393216003U ,197 ,3 ,2 ,-25690 ),PLL_36XX_RATE (384000000U ,128 ,2 ,2 ,0 ), -PLL_36XX_RATE (368640000U ,246 ,4 ,2 ,-15729 ), -PLL_36XX_RATE (361507200U ,181 ,3 ,2 ,-16148 ), -PLL_36XX_RATE (338688000U ,113 ,2 ,2 ,-6816 ), -PLL_36XX_RATE (294912000U ,98 ,1 ,3 ,19923 ), +PLL_36XX_RATE (368639991U ,246 ,4 ,2 ,-15729 ), +PLL_36XX_RATE (361507202U ,181 ,3 ,2 ,-16148 ), +PLL_36XX_RATE (338687988U ,113 ,2 ,2 ,-6816 ), +PLL_36XX_RATE (294912002U ,98 ,1 ,3 ,19923 ),PLL_36XX_RATE (288000000U ,96 ,1 ,3 ,0 ),PLL_36XX_RATE (252000000U ,84 ,1 ,3 ,0 ), {/* sentinel */ }
Greg Kroah-Hartman
maintainerPATCH 219/268 hwmon: (pmbus/max8688) Accept negative page register values
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit a46f8cd696624ef757be0311eb28f119c36778e8 ]
A negative page register value means that no page needs to be selected. This is used by status register evaluations and needs to be accepted.
--- drivers/hwmon/pmbus/max8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/max8688.c +1 -1
@@ -45,7 +45,7 @@ static int max8688_read_word_data(struct {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
Greg Kroah-Hartman
maintainerPATCH 220/268 hwmon: (pmbus/adm1275) Accept negative page register values
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit ecb29abd4cb0670c616fb563a078f25d777ce530 ]
A negative page register value means that no page needs to be selected. This is used by status register read operations and needs to be accepted. The failure to do so so results in missed status and limit registers.
--- drivers/hwmon/pmbus/adm1275.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/pmbus/adm1275.c +2 -2
@@ -141,7 +141,7 @@ static int adm1275_read_word_data(structconst struct adm1275_data *data =to_adm1275_data (info);int ret =0 ; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
@@ -218,7 +218,7 @@ static int adm1275_write_word_data(strucconst struct adm1275_data *data =to_adm1275_data (info);int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
Greg Kroah-Hartman
maintainerPATCH 221/268 cdrom: do not call check_disk_change() inside cdrom_open()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit 2bbea6e117357d17842114c65e9a9cf2d13ae8a3 ]
when mounting an ISO filesystem sometimes (very rarely) the system hangs because of a race condition between two tasks.
PID: 6766 TASK: ffff88007b2a6dd0 CPU: 0 COMMAND: "mount"
#0 [ffff880078447ae0] __schedule at ffffffff8168d605
#1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49 #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995 #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
#4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod] #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50 #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3 #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs] #8 [ffff880078447da8] mount_bdev at ffffffff81202570
#9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
#10 [ffff880078447e28] mount_fs at ffffffff81202d09
#11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f #12 [ffff880078447ea8] do_mount at ffffffff81220fee
#13 [ffff880078447f28] sys_mount at ffffffff812218d6
#14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
RIP: 00007fd9ea914e9a RSP: 00007ffd5d9bf648 RFLAGS: 00010246
RAX: 00000000000000a5 RBX: ffffffff81698c49 RCX: 0000000000000010
RDX: 00007fd9ec2bc210 RSI: 00007fd9ec2bc290 RDI: 00007fd9ec2bcf30
RBP: 0000000000000000 R8: 0000000000000000 R9: 0000000000000010
R10: 00000000c0ed0001 R11: 0000000000000206 R12: 00007fd9ec2bc040
R13: 00007fd9eb6b2380 R14: 00007fd9ec2bc210 R15: 00007fd9ec2bcf30
ORIG_RAX: 00000000000000a5 CS: 0033 SS: 002bThis task was trying to mount the cdrom. It allocated and configured a super_block struct and owned the write-lock for the super_block->s_umount rwsem. While exclusively owning the s_umount lock, it called sr_block_ioctl and waited to acquire the global sr_mutex lock.
PID: 6785 TASK: ffff880078720fb0 CPU: 0 COMMAND: "systemd-udevd"
#0 [ffff880078417898] __schedule at ffffffff8168d605
#1 [ffff880078417900] schedule at ffffffff8168dc59
#2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605 #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838 #4 [ffff8800784179d0] down_read at ffffffff8168cde0
#5 [ffff8800784179e8] get_super at ffffffff81201cc7
#6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
#8 [ffff880078417a88] check_disk_change at ffffffff8123ab50 #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
#10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod] #11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
#12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
#13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
#14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7 #15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
#16 [ffff880078417d00] do_last at ffffffff8120d53d
#17 [ffff880078417db0] path_openat at ffffffff8120e6b2
#18 [ffff880078417e48] do_filp_open at ffffffff8121082b
#19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
#20 [ffff880078417f70] sys_open at ffffffff811fde4e
#21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
RIP: 00007f29438b0c20 RSP: 00007ffc76624b78 RFLAGS: 00010246
RAX: 0000000000000002 RBX: ffffffff81698c49 RCX: 0000000000000000
RDX: 00007f2944a5fa70 RSI: 00000000000a0800 RDI: 00007f2944a5fa70
RBP: 00007f2944a5f540 R8: 0000000000000000 R9: 0000000000000020
R10: 00007f2943614c40 R11: 0000000000000246 R12: ffffffff811fde4e
R13: ffff880078417f78 R14: 000000000000000c R15: 00007f2944a4b010
ORIG_RAX: 0000000000000002 CS: 0033 SS: 002bThis task tried to open the cdrom device, the sr_block_open function acquired the global sr_mutex lock. The call to check_disk_change() then saw an event flag indicating a possible media change and tried to flush any cached data for the device.
As part of the flush, it tried to acquire the super_block->s_umount lock associated with the cdrom device.
This was the same super_block as created and locked by the previous task.
The first task acquires the s_umount lock and then the sr_mutex_lock; the second task acquires the sr_mutex_lock and then the s_umount lock.
This patch fixes the issue by moving check_disk_change() out of cdrom_open() and let the caller take care of it.
--- drivers/block/paride/pcd.c | 2 ++ drivers/cdrom/cdrom.c | 3 --- drivers/cdrom/gdrom.c | 3 +++ drivers/ide/ide-cd.c | 2 ++ drivers/scsi/sr.c | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-)
drivers/block/paride/pcd.c +2 -0
@@ -230,6 +230,8 @@ static int pcd_block_open(struct block_dstruct pcd_unit *cd = bdev->bd_disk->private_data;int ret; +check_disk_change (bdev); +mutex_lock (&pcd_mutex); ret =cdrom_open (&cd->info, bdev, mode);mutex_unlock (&pcd_mutex);
drivers/cdrom/cdrom.c +0 -3
@@ -1154,9 +1154,6 @@ int cdrom_open(struct cdrom_device_infocd_dbg (CD_OPEN ,"entering cdrom_open\n" ); -/* open is event synchronization point, check events first */ -check_disk_change (bdev); -/* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */ cdi->use_count++;
drivers/cdrom/gdrom.c +3 -0
@@ -497,6 +497,9 @@ static struct cdrom_device_ops gdrom_opsstatic int gdrom_bdops_open (struct block_device *bdev,fmode_t mode) {int ret; + +check_disk_change (bdev); +mutex_lock (&gdrom_mutex); ret =cdrom_open (gd.cd_info, bdev, mode);mutex_unlock (&gdrom_mutex);
drivers/ide/ide-cd.c +2 -0
@@ -1593,6 +1593,8 @@ static int idecd_open(struct block_devicstruct cdrom_info *info;int rc = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&ide_cd_mutex); info =ide_cd_get (bdev->bd_disk);if (!info)
drivers/scsi/sr.c +2 -0
@@ -522,6 +522,8 @@ static int sr_block_open(struct block_destruct scsi_cd *cd;int ret = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&sr_mutex); cd =scsi_cd_get (bdev->bd_disk);if (cd) {
Greg Kroah-Hartman
maintainerPATCH 222/268 gfs2: Fix fallocate chunk size
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 174d1232ebc84fcde8f5889d1171c9c7e74a10a7 ]
The chunk size of allocations in __gfs2_fallocate is calculated incorrectly. The size can collapse, causing __gfs2_fallocate to allocate one block at a time, which is very inefficient. This needs fixing in two places:
In gfs2_quota_lock_check, always set ap->allowed to UINT_MAX to indicate that there is no quota limit. This fixes callers that rely on ap->allowed to be set even when quotas are off.
In __gfs2_fallocate, reset max_blks to UINT_MAX in each iteration of the loop to make sure that allocation limits from one resource group won't spill over into another resource group.
--- fs/gfs2/file.c | 5 +++-- fs/gfs2/quota.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
fs/gfs2/file.c +3 -2
@@ -806,7 +806,7 @@ static long __gfs2_fallocate(struct filestruct gfs2_inode *ip =GFS2_I (inode);struct gfs2_alloc_parms ap = { .aflags =0 , };unsigned int data_blocks =0 , ind_blocks =0 , rblocks; -loff_t bytes, max_bytes, max_blks =UINT_MAX ; +loff_t bytes, max_bytes, max_blks;int error;const loff_t pos = offset;const loff_t count = len;
@@ -858,7 +858,8 @@ static long __gfs2_fallocate(struct filereturn error;/* ap.allowed tells us how many blocks quota will allow * us to write. Check if this reduces max_blks */ -if (ap.allowed && ap.allowed < max_blks) + max_blks =UINT_MAX ; +if (ap.allowed) max_blks = ap.allowed; error =gfs2_inplace_reserve (ip, &ap);
fs/gfs2/quota.h +2 -0
@@ -43,6 +43,8 @@ static inline int gfs2_quota_lock_check( {struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);int ret; + + ap->allowed =UINT_MAX ;/* Assume we are permitted a whole lot */ if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; ret =gfs2_quota_lock (ip,NO_UID_QUOTA_CHANGE ,NO_GID_QUOTA_CHANGE );
Greg Kroah-Hartman
maintainerPATCH 223/268 usb: gadget: udc: change comparison to bitshift when dealing with a mask
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit ac87e560f7c0f91b62012e9a159c0681a373b922 ]
Due to a typo, the mask was destroyed by a comparison instead of a bit shift.
--- drivers/usb/gadget/udc/goku_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/goku_udc.h +1 -1
@@ -28,7 +28,7 @@ struct goku_udc_regs {# define INT_EP1DATASET 0x00040# define INT_EP2DATASET 0x00080# define INT_EP3DATASET 0x00100 -#define INT_EPnNAK (n) (0x00100 < (n))/* 0 < n < 4 */ +#define INT_EPnNAK (n) (0x00100 << (n))/* 0 < n < 4 */ # define INT_EP1NAK 0x00200# define INT_EP2NAK 0x00400# define INT_EP3NAK 0x00800
Greg Kroah-Hartman
maintainerPATCH 224/268 usb: gadget: composite: fix incorrect handling of OS desc requests
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Dickens <[email protected]>
[ Upstream commit 5d6ae4f0da8a64a185074dabb1b2f8c148efa741 ]
When handling an OS descriptor request, one of the first operations is to zero out the request buffer using the wLength from the setup packet. There is no bounds checking, so a wLength > 4096 would clobber memory adjacent to the request buffer. Fix this by taking the min of wLength and the request buffer length prior to the memset. While at it, define the buffer length in a header file so that magic numbers don't appear throughout the code.
When returning data to the host, the data length should be the min of the wLength and the valid data we have to return. Currently we are returning wLength, thus requests for a wLength greater than the amount of data in the OS descriptor buffer would return invalid (albeit zero'd) data following the valid descriptor data. Fix this by counting the number of bytes when constructing the data and using this when determining the length of the request.
--- drivers/usb/gadget/composite.c | 40 +++++++++++++++++++--------------------- include/linux/usb/composite.h | 3 +++ 2 files changed, 22 insertions(+), 21 deletions(-)
drivers/usb/gadget/composite.c +19 -21
@@ -1328,7 +1328,7 @@ static int count_ext_compat(struct usb_creturn res; } -static void fill_ext_compat (struct usb_configuration *c,u8 *buf) +static int fill_ext_compat (struct usb_configuration *c,u8 *buf) {int i, count;
@@ -1355,10 +1355,12 @@ static void fill_ext_compat(struct usb_c buf +=23 ; } count +=24 ; -if (count >=4096 ) -return ; +if (count +24 >=USB_COMP_EP0_OS_DESC_BUFSIZ ) +return count; } } + +return count; }static int count_ext_prop (struct usb_configuration *c,int interface)
@@ -1403,25 +1405,20 @@ static int fill_ext_prop(struct usb_confstruct usb_os_desc *d;struct usb_os_desc_ext_prop *ext_prop;int j, count, n, ret; -u8 *start = buf; f = c->interface[interface]; + count =10 ;/* header length */ for (j =0 ; j < f->os_desc_n; ++j) {if (interface != f->os_desc_table[j].if_id)continue ; d = f->os_desc_table[j].os_desc;if (d)list_for_each_entry (ext_prop, &d->ext_prop, entry) { -/* 4kB minus header length */ - n = buf - start; -if (n >=4086 ) -return 0 ; - - count = ext_prop->data_len + + n = ext_prop->data_len + ext_prop->name_len +14 ; -if (count >4086 - n) -return -EINVAL ; -usb_ext_prop_put_size (buf, count); +if (count + n >=USB_COMP_EP0_OS_DESC_BUFSIZ ) +return count; +usb_ext_prop_put_size (buf, n);usb_ext_prop_put_type (buf, ext_prop->type); ret =usb_ext_prop_put_name (buf, ext_prop->name, ext_prop->name_len);
@@ -1447,11 +1444,12 @@ static int fill_ext_prop(struct usb_confdefault :return -EINVAL ; } - buf += count; + buf += n; + count += n; } } -return 0 ; +return count; }/*
@@ -1720,6 +1718,7 @@ unknown: req->complete = composite_setup_complete; buf = req->buf; os_desc_cfg = cdev->os_desc_config; + w_length =min_t (u16, w_length,USB_COMP_EP0_OS_DESC_BUFSIZ );memset (buf,0 , w_length); buf[5 ] =0x01 ;switch (ctrl->bRequestType &USB_RECIP_MASK ) {
@@ -1743,8 +1742,8 @@ unknown: count +=16 ;/* header */ put_unaligned_le32 (count, buf); buf +=16 ; -fill_ext_compat (os_desc_cfg, buf); - value = w_length; + value =fill_ext_compat (os_desc_cfg, buf); + value =min_t (u16, w_length, value); }break ;case USB_RECIP_INTERFACE :
@@ -1773,8 +1772,7 @@ unknown: interface, buf);if (value <0 )return value; - - value = w_length; + value =min_t (u16, w_length, value); }break ; }
@@ -2038,8 +2036,8 @@ int composite_os_desc_req_prepare(struct goto end; } -/* OS feature descriptor length <= 4kB */ - cdev->os_desc_req->buf =kmalloc (4096 ,GFP_KERNEL ); + cdev->os_desc_req->buf =kmalloc (USB_COMP_EP0_OS_DESC_BUFSIZ , +GFP_KERNEL );if (!cdev->os_desc_req->buf) { ret =PTR_ERR (cdev->os_desc_req->buf);kfree (cdev->os_desc_req);
include/linux/usb/composite.h +3 -0
@@ -53,6 +53,9 @@/* big enough to hold our biggest descriptor */ #define USB_COMP_EP0_BUFSIZ 1024 +/* OS feature descriptor length <= 4kB */ +#define USB_COMP_EP0_OS_DESC_BUFSIZ 4096 +#define USB_MS_TO_HS_INTERVAL (x) (ilog2((x * 1000 / 125)) + 1)struct usb_configuration ;
Greg Kroah-Hartman
maintainerPATCH 215/268 usb: gadget: ffs: Execute copy_to_user() with USER_DS set
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
[ Upstream commit 4058ebf33cb0be88ca516f968eda24ab7b6b93e4 ]
When using a AIO read() operation on the function FS gadget driver a URB is submitted asynchronously and on URB completion the received data is copied to the userspace buffer associated with the read operation.
This is done from a kernel worker thread invoking copy_to_user() (through copy_to_iter()). And while the user space process memory is made available to the kernel thread using use_mm(), some architecture require in addition to this that the operation runs with USER_DS set. Otherwise the userspace memory access will fail.
For example on ARM64 with Privileged Access Never (PAN) and User Access Override (UAO) enabled the following crash occurs.
Internal error: Accessing user space memory with fs=KERNEL_DS: 9600004f [#1] SMP Modules linked in: CPU: 2 PID: 1636 Comm: kworker/2:1 Not tainted 4.9.0-04081-g8ab2dfb-dirty #487 Hardware name: ZynqMP ZCU102 Rev1.0 (DT) Workqueue: events ffs_user_copy_worker task: ffffffc87afc8080 task.stack: ffffffc87a00c000 PC is at __arch_copy_to_user+0x190/0x220 LR is at copy_to_iter+0x78/0x3c8 [...] [<ffffff800847b790>] __arch_copy_to_user+0x190/0x220 [<ffffff80086f25d8>] ffs_user_copy_worker+0x70/0x130 [<ffffff80080b8c64>] process_one_work+0x1dc/0x460 [<ffffff80080b8f38>] worker_thread+0x50/0x4b0 [<ffffff80080bf5a0>] kthread+0xd8/0xf0 [<ffffff8008083680>] ret_from_fork+0x10/0x50
Address this by placing a set_fs(USER_DS) before of the copy operation and revert it again once the copy operation has finished.
This patch is analogous to commit d7ffde35e31a ("vhost: use USER_DS in vhost_worker thread") which addresses the same underlying issue.
--- drivers/usb/gadget/function/f_fs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/gadget/function/f_fs.c +4 -0
@@ -649,11 +649,15 @@ static void ffs_user_copy_worker(structbool kiocb_has_eventfd = io_data->kiocb->ki_flags &IOCB_EVENTFD ;if (io_data->read && ret >0 ) { +mm_segment_t oldfs =get_fs (); + +set_fs (USER_DS );use_mm (io_data->mm); ret =copy_to_iter (io_data->buf, ret, &io_data->data);if (ret != io_data->req->actual &&iov_iter_count (&io_data->data)) ret = -EFAULT ;unuse_mm (io_data->mm); +set_fs (oldfs); } io_data->kiocb->ki_complete (io_data->kiocb, ret, ret);
Greg Kroah-Hartman
maintainerPATCH 251/268 clk: samsung: exynos3250: Fix PLL rates
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Hajda <[email protected]>
[ Upstream commit a8321e7887410a2b2e80ab89d1ef7b30562658ea ]
Rates declared in PLL rate tables should match exactly rates calculated from PLL coefficients. If that is not the case, rate of the PLL's child clock might be set not as expected. For instance, if in the PLL rates table we have a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate will return 393216003. If we now attempt to set rate of a PLL's child divider clock to 393216000/2 its rate will be 131072001, rather than 196608000. That is, the divider will be set to 3 instead of 2, because 393216003/2 is greater than 196608000.
To fix this issue declared rates are changed to exactly match rates generated by the PLL, as calculated from the P, M, S, K coefficients.
In this patch an erroneous P value for 74176002 output frequency is also corrected.
--- drivers/clk/samsung/clk-exynos3250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/samsung/clk-exynos3250.c +2 -2
@@ -683,7 +683,7 @@ static struct samsung_pll_rate_table exyPLL_36XX_RATE (144000000 ,96 ,2 ,3 ,0 ),PLL_36XX_RATE (96000000 ,128 ,2 ,4 ,0 ),PLL_36XX_RATE (84000000 ,112 ,2 ,4 ,0 ), -PLL_36XX_RATE (80000004 ,106 ,2 ,4 ,43691 ), +PLL_36XX_RATE (80000003 ,106 ,2 ,4 ,43691 ),PLL_36XX_RATE (73728000 ,98 ,2 ,4 ,19923 ),PLL_36XX_RATE (67737598 ,270 ,3 ,5 ,62285 ), PLL_36XX_RATE( 65535999, 174, 2, 5, 49982),
@@ -719,7 +719,7 @@ static struct samsung_pll_rate_table exyPLL_36XX_RATE (148352005 ,98 ,2 ,3 ,59070 ),PLL_36XX_RATE (108000000 ,144 ,2 ,4 ,0 ),PLL_36XX_RATE (74250000 ,99 ,2 ,4 ,0 ), -PLL_36XX_RATE (74176002 ,98 ,3 ,4 ,59070 ), +PLL_36XX_RATE (74176002 ,98 ,2 ,4 ,59070 ),PLL_36XX_RATE (54054000 ,216 ,3 ,5 ,14156 ), PLL_36XX_RATE( 54000000, 144, 2, 5, 0), { /* sentinel */ }
Greg Kroah-Hartman
maintainerPATCH 260/268 netlabel: If PF_INET6, check sk_buff ip header version
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Haines <[email protected]>
[ Upstream commit 213d7f94775322ba44e0bbb55ec6946e9de88cea ]
When resolving a fallback label, check the sk_buff version as it is possible (e.g. SCTP) to have family = PF_INET6 while receiving ip_hdr(skb)->version = 4.
--- net/netlabel/netlabel_unlabeled.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/netlabel/netlabel_unlabeled.c +10 -0
@@ -1469,6 +1469,16 @@ int netlbl_unlabel_getattr(const struct iface =rcu_dereference (netlbl_unlhsh_def);if (iface ==NULL || !iface->valid) goto unlabel_getattr_nolabel; + +#if IS_ENABLED (CONFIG_IPV6 ) +/* When resolving a fallback label, check the sk_buff version as +* it is possible (e.g. SCTP) to have family = PF_INET6 while +* receiving ip_hdr(skb)->version = 4. +*/ +if (family ==PF_INET6 &&ip_hdr (skb)->version ==4 ) + family =PF_INET ; +#endif /* IPv6 */ +switch (family) {case PF_INET : {struct iphdr *hdr4;
Greg Kroah-Hartman
maintainerPATCH 261/268 scsi: lpfc: Fix issue_lip if link is disabled
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Smart <[email protected]>
[ Upstream commit 2289e9598dde9705400559ca2606fb8c145c34f0 ]
The driver ignored checks on whether the link should be kept administratively down after a link bounce. Correct the checks.
--- drivers/scsi/lpfc/lpfc_attr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/lpfc/lpfc_attr.c +5 -0
@@ -634,7 +634,12 @@ lpfc_issue_lip(struct Scsi_Host *shost)LPFC_MBOXQ_t *pmboxq;int mbxstatus =MBXERR_ERROR ; +/* +* If the link is offline, disabled or BLOCK_MGMT_IO +* it doesn't make any sense to allow issue_lip +*/ if ((vport->fc_flag &FC_OFFLINE_MODE ) || + (phba->hba_flag &LINK_DISABLED ) || (phba->sli.sli_flag &LPFC_BLOCK_MGMT_IO ))return -EPERM ;
Greg Kroah-Hartman
maintainerPATCH 262/268 scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Smart <[email protected]>
[ Upstream commit 161df4f09987ae2e9f0f97f0b38eee298b4a39ff ]
During link bounce testing in a point-to-point topology, the host may enter a soft lockup on the lpfc_worker thread:
Call Trace:
lpfc_work_done+0x1f3/0x1390 [lpfc]
lpfc_do_work+0x16f/0x180 [lpfc]
kthread+0xc7/0xe0
ret_from_fork+0x3f/0x70The driver was simultaneously setting a combination of flags that caused lpfc_do_work()to effectively spin between slow path work and new event data, causing the lockup.
Ensure in the typical wq completions, that new event data flags are set if the slow path flag is running. The slow path will eventually reschedule the wq handling.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -2
@@ -691,8 +691,9 @@ lpfc_work_done(struct lpfc_hba *phba) (phba->hba_flag & HBA_SP_QUEUE_EVT)) {if (pring->flag &LPFC_STOP_IOCB_EVENT ) { pring->flag |=LPFC_DEFERRED_RING_EVENT ; -/* Set the lpfc data pending flag */ -set_bit (LPFC_DATA_READY , &phba->data_flags); +/* Preserve legacy behavior. */ +if (!(phba->hba_flag &HBA_SP_QUEUE_EVT )) +set_bit (LPFC_DATA_READY , &phba->data_flags); }else {if (phba->link_state >=LPFC_LINK_UP ) { pring->flag &= ~LPFC_DEFERRED_RING_EVENT ;
Greg Kroah-Hartman
maintainerPATCH 263/268 scsi: lpfc: Fix frequency of Release WQE CQEs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Smart <[email protected]>
[ Upstream commit 04673e38f56b30cd39b1fa0f386137d818b17781 ]
The driver controls when the hardware sends completions that communicate consumption of elements from the WQ. This is done by setting a WQEC bit on a WQE.
The current driver sets it on every Nth WQE posting. However, the driver isn't clearing the bit if the WQE is reused. Thus, if the queue depth isn't evenly divisible by N, with enough time, it can be set on every element, creating a lot of overhead and risking CQ full conditions.
Correct by clearing the bit when not setting it on an Nth element.
--- drivers/scsi/lpfc/lpfc_sli.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +2 -0
@@ -115,6 +115,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, u/* set consumption flag every once in a while */ if (!((q->host_index +1 ) % q->entry_repost))bf_set (wqe_wqec, &wqe->generic.wqe_com,1 ); +else +bf_set (wqe_wqec, &wqe->generic.wqe_com,0 );if (q->phba->sli3_options &LPFC_SLI4_PHWQ_ENABLED )bf_set (wqe_wqid, &wqe->generic.wqe_com, q->queue_id);lpfc_sli_pcimem_bcopy (wqe, temp_wqe, q->entry_size);
Greg Kroah-Hartman
maintainerPATCH 264/268 regulator: of: Add a missing of_node_put() in an error handling path of of_regulator_match()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ]
If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must release the reference on the current 'child' node before returning.
--- drivers/regulator/of_regulator.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/of_regulator.c +1 -0
@@ -274,6 +274,7 @@ int of_regulator_match(struct device *dedev_err (dev,"failed to parse DT for regulator %s\n" , child->name); +of_node_put (child);return -EINVAL ; } match->of_node =of_node_get (child);
Greg Kroah-Hartman
maintainerPATCH 268/268 s390/ftrace: use expoline for indirect branches
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 23a4d7fd34856da8218c4cfc23dba7a6ec0a423a upstream.
The return from the ftrace_stub, _mcount, ftrace_caller and return_to_handler functions is done with "br %r14" and "br %r1". These are indirect branches as well and need to use execute trampolines for CONFIG_EXPOLINE=y.
The ftrace_caller function is a special case as it returns to the start of a function and may only use %r0 and %r1. For a pre z10 machine the standard execute trampoline uses a LARL + EX to do this, but this requires *two* registers in the range %r1..%r15. To get around this the 'br %r1' located in the lowcore is used, then the EX instruction does not need an address register. But the lowcore trick may only be used for pre z14 machines, with noexec=on the mapping for the first page may not contain instructions. The solution for that is an ALTERNATIVE in the expoline THUNK generated by 'GEN_BR_THUNK %r1' to switch to EXRL, this relies on the fact that a machine that supports noexec=on has EXRL as well.
--- arch/s390/include/asm/nospec-insn.h | 13 +++++++++++++ arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kernel/mcount.S | 14 +++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-)
arch/s390/include/asm/nospec-insn.h +13 -0
@@ -2,10 +2,15 @@#ifndef _ASM_S390_NOSPEC_ASM_H#define _ASM_S390_NOSPEC_ASM_H +#include <asm/alternative-asm.h> +#include <asm/asm-offsets.h> +#ifdef __ASSEMBLY__#ifdef CONFIG_EXPOLINE +_LC_BR_R1 = __LC_BR_R1 +/* * The expoline macros are used to create thunks in the same format * as gcc generates them. The 'comdat' section flag makes sure that
@@ -101,13 +106,21 @@ .endm .macro __THUNK_EX_BR reg,ruse +# Be very careful when adding instructions to this macro! +# The ALTERNATIVE replacement code has a .+10 which targets +# the "br \reg" after the code has been patched.#ifdef CONFIG_HAVE_MARCH_Z10_FEATURES exrl 0,555f j . #else + .ifc \reg,%r1 +ALTERNATIVE "ex %r0,_LC_BR_R1" ,".insn ril,0xc60000000000,0,.+10" ,35 + j . + .else larl \ruse,555f ex 0,0(\ruse) j . + .endif#endif 555: br \reg .endm
arch/s390/kernel/asm-offsets.c +1 -0
@@ -170,6 +170,7 @@ int main(void)OFFSET (__LC_MACHINE_FLAGS, _lowcore, machine_flags);OFFSET (__LC_GMAP, _lowcore, gmap);OFFSET (__LC_PASTE, _lowcore, paste); +OFFSET (__LC_BR_R1, _lowcore, br_r1_trampoline);/* software defined ABI-relevant lowcore locations 0xe00 - 0xe20 */ OFFSET (__LC_DUMP_REIPL, _lowcore, ipib);/* hardware defined lowcore locations 0x1000 - 0x18ff */
arch/s390/kernel/mcount.S +9 -5
@@ -8,12 +8,16 @@ #include <linux/linkage.h> #include <asm/asm-offsets.h> #include <asm/ftrace.h> +#include <asm/nospec-insn.h> #include <asm/ptrace.h> + GEN_BR_THUNK %r1 + GEN_BR_THUNK %r14 + .section .kprobes.text, "ax" ENTRY(ftrace_stub) - br %r14 + BR_EX %r14 #define STACK_FRAME_SIZE (STACK_FRAME_OVERHEAD + __PT_SIZE) #define STACK_PTREGS (STACK_FRAME_OVERHEAD)
@@ -21,7 +25,7 @@ ENTRY(ftrace_stub) #define STACK_PTREGS_PSW (STACK_PTREGS + __PT_PSW) ENTRY(_mcount) - br %r14 + BR_EX %r14 ENTRY(ftrace_caller) .globl ftrace_regs_caller
@@ -49,7 +53,7 @@ ENTRY(ftrace_caller) #endif lgr %r3,%r14 la %r5,STACK_PTREGS(%r15) - basr %r14,%r1 + BASR_EX %r14,%r1 #ifdef CONFIG_FUNCTION_GRAPH_TRACER # The j instruction gets runtime patched to a nop instruction. # See ftrace_enable_ftrace_graph_caller.
@@ -64,7 +68,7 @@ ftrace_graph_caller_end: #endif lg %r1,(STACK_PTREGS_PSW+8)(%r15) lmg %r2,%r15,(STACK_PTREGS_GPRS+2*8)(%r15) - br %r1 + BR_EX %r1 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -77,6 +81,6 @@ ENTRY(return_to_handler) aghi %r15,STACK_FRAME_OVERHEAD lgr %r14,%r2 lmg %r2,%r5,32(%r15) - br %r14 + BR_EX %r14 #endif
Greg Kroah-Hartman
maintainerPATCH 252/268 crypto: sunxi-ss - Add MODULE_ALIAS to sun4i-ss
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Robinson <[email protected]>
[ Upstream commit 7c73cf4cc2ac16465f5102437dc0a12d66671bd6 ]
The MODULE_ALIAS is required to enable the sun4i-ss driver to load automatically when built at a module. Tested on a Cubietruck.
--- drivers/crypto/sunxi-ss/sun4i-ss-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/sunxi-ss/sun4i-ss-core.c +1 -0
@@ -422,6 +422,7 @@ static struct platform_driver sun4i_ss_dmodule_platform_driver (sun4i_ss_driver); +MODULE_ALIAS ("platform:sun4i-ss" );MODULE_DESCRIPTION ("Allwinner Security System cryptographic accelerator" );MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Corentin LABBE <[email protected]>" );
Greg Kroah-Hartman
maintainerPATCH 253/268 audit: return on memory error to avoid null pointer dereference
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Guy Briggs <[email protected]>
[ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ]
If there is a memory allocation error when trying to change an audit kernel feature value, the ignored allocation error will trigger a NULL pointer dereference oops on subsequent use of that pointer. Return instead.
Passes audit-testsuite.
See: https://github.com/linux-audit/audit-kernel/issues/76
--- kernel/audit.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/audit.c +2 -0
@@ -744,6 +744,8 @@ static void audit_log_feature_change(intreturn ; ab =audit_log_start (NULL ,GFP_KERNEL ,AUDIT_FEATURE_CHANGE ); +if (!ab) +return ;audit_log_task_info (ab, current); audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", audit_feature_names[which], !!old_feature, !!new_feature,
Greg Kroah-Hartman
maintainerPATCH 254/268 MIPS: Octeon: Fix logging messages with spurious periods after newlines
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit db6775ca6e0353d2618ca7d5e210fc36ad43bbd4 ]
Using a period after a newline causes bad output.
Patchwork: https://patchwork.linux-mips.org/patch/17886/
--- arch/mips/cavium-octeon/octeon-irq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/mips/cavium-octeon/octeon-irq.c +5 -5
@@ -2240,7 +2240,7 @@ static int __init octeon_irq_init_cib(st parent_irq =irq_of_parse_and_map (ciu_node,0 );if (!parent_irq) { -pr_err ("ERROR: Couldn't acquire parent_irq for %s\n." , +pr_err ("ERROR: Couldn't acquire parent_irq for %s\n" , ciu_node->name);return -EINVAL ; }
@@ -2252,7 +2252,7 @@ static int __init octeon_irq_init_cib(st addr =of_get_address (ciu_node,0 ,NULL ,NULL );if (!addr) { -pr_err ("ERROR: Couldn't acquire reg(0) %s\n." , ciu_node->name); +pr_err ("ERROR: Couldn't acquire reg(0) %s\n" , ciu_node->name);return -EINVAL ; } host_data->raw_reg = (u64)phys_to_virt(
@@ -2260,7 +2260,7 @@ static int __init octeon_irq_init_cib(st addr =of_get_address (ciu_node,1 ,NULL ,NULL );if (!addr) { -pr_err ("ERROR: Couldn't acquire reg(1) %s\n." , ciu_node->name); +pr_err ("ERROR: Couldn't acquire reg(1) %s\n" , ciu_node->name);return -EINVAL ; } host_data->en_reg = (u64)phys_to_virt(
@@ -2268,7 +2268,7 @@ static int __init octeon_irq_init_cib(st r =of_property_read_u32 (ciu_node,"cavium,max-bits" , &val);if (r) { -pr_err ("ERROR: Couldn't read cavium,max-bits from %s\n." , +pr_err ("ERROR: Couldn't read cavium,max-bits from %s\n" , ciu_node->name);return r; }
@@ -2278,7 +2278,7 @@ static int __init octeon_irq_init_cib(st &octeon_irq_domain_cib_ops, host_data);if (!cib_domain) { -pr_err ("ERROR: Couldn't irq_domain_add_linear()\n." ); +pr_err ("ERROR: Couldn't irq_domain_add_linear()\n" );return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 256/268 x86/apic: Set up through-local-APIC mode on the boot CPU if noapic specified
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baoquan He <[email protected]>
[ Upstream commit bee3204ec3c49f6f53add9c3962c9012a5c036fa ]
Currently the kdump kernel becomes very slow if 'noapic' is specified. Normal kernel doesn't have this bug.
Kernel parameter 'noapic' is used to disable IO-APIC in system for testing or special purpose. Here the root cause is that in kdump kernel LAPIC is disabled since commit:
522e664644 ("x86/apic: Disable I/O APIC before shutdown of the local APIC")
In this case we need set up through-local-APIC on boot CPU in setup_local_APIC().
In normal kernel the legacy irq mode is enabled by the BIOS. If it is virtual wire mode, the local-APIC has been enabled and set as through-local-APIC.
Though we fixed the regression introduced by commit 522e664644, to further improve robustness set up the through-local-APIC mode explicitly, do not rely on the default boot IRQ mode.
--- arch/x86/kernel/apic/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +1 -1
@@ -1368,7 +1368,7 @@ void setup_local_APIC(void)* TODO: set up through-local-APIC from through-I/O-APIC? --macro */ value =apic_read (APIC_LVT0 ) &APIC_LVT_MASKED ; -if (!cpu && (pic_mode || !value)) { +if (!cpu && (pic_mode || !value || skip_ioapic_setup)) { value =APIC_DM_EXTINT ;apic_printk (APIC_VERBOSE ,"enabled ExtINT on CPU#%d\n" , cpu); }else {
Greg Kroah-Hartman
maintainerPATCH 257/268 perf tests: Use arch__compare_symbol_names to compare symbols
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit ab6e9a99345131cd8e54268d1d0dc04a33f7ed11 ]
The symbol search called by machine__find_kernel_symbol_by_name is using internally arch__compare_symbol_names function to compare 2 symbol names, because different archs have different ways of comparing symbols. Mostly for skipping '.' prefixes and similar.
In test 1 when we try to find matching symbols in kallsyms and vmlinux, by address and by symbol name. When either is found we compare the pair symbol names by simple strcmp, which is not good enough for reasons explained in previous paragraph.
On powerpc this can cause lockup, because even thought we found the pair, the compared names are different and don't match simple strcmp. Following code path is executed, that leads to lockup:
- we find the pair in kallsyms by sym->startnext_pair:
- we compare the names and it fails
- we find the pair by sym->name
- the pair addresses match so we call goto next_pair because we assume the names match in this case
--- tools/perf/tests/vmlinux-kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/vmlinux-kallsyms.c +1 -1
@@ -126,7 +126,7 @@ int test__vmlinux_matches_kallsyms(void)if (pair &&UM (pair->start) == mem_start) { next_pair: -if (strcmp (sym->name, pair->name) ==0 ) { +if (arch__compare_symbol_names (sym->name, pair->name) ==0 ) {/* * kallsyms don't have the symbol end, so we * set that by using the next symbol start - 1,
Greg Kroah-Hartman
maintainerPATCH 258/268 perf report: Fix memory corruption in --branch-history mode --branch-history
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit e3ebaa465136ecfedf9c6f4671df02bf625f8125 ]
Jin Yao reported memory corrupton in perf report with branch info used for stack trace:
Quoted 15 lines
Following command lines will cause perf crash.
perf record -j call -g -a <application>
perf report --branch-history*** Error in `perf': double free or corruption (!prev):
0x00000000104aa040*** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f6b37254725] /lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f6b3725cf4a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f6b37260abc] perf[0x51b914]
perf(hist_entry_iter__add+0x1e5)[0x51f305]
perf[0x43cf01]
perf[0x4fa3bf]
perf[0x4fa923]
Quoted 8 lines
perf[0x4fd396]
perf[0x4f9614] perf(perf_session__process_events+0x89e)[0x4fc38e] perf(cmd_report+0x15d2)[0x43f202]
perf[0x4a059f]
perf(main+0x631)[0x427b71] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f6b371fd830] perf(_start+0x29)[0x427d89]
For the cumulative output, we allocate the he_cache array based on the --max-stack option value and populate it with data from 'callchain_cursor'.
The --max-stack option value does not ensure now the limit for number of callchain_cursor nodes, so the cumulative iter code will allocate smaller array than it's actually needed and cause above corruption.
I think the --max-stack limit does not apply here anyway, because we add callchain data as normal hist entries, while the --max-stack control the limit of single entry callchain depth.
Using the callchain_cursor.nr as he_cache array count to fix this. Also removing struct hist_entry_iter::max_stack, because there's no longer any use for it.
We need more fixes to ensure that the branch stack code follows properly the logic of --max-stack, which is not the case at the moment.
--- tools/perf/util/hist.c | 4 +--- tools/perf/util/hist.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/hist.c +1 -3
@@ -720,7 +720,7 @@ iter_prepare_cumulative_entry(struct his* cumulated only one time to prevent entries more than 100% * overhead. */ - he_cache =malloc (sizeof (*he_cache) * (iter->max_stack +1 )); + he_cache =malloc (sizeof (*he_cache) * (callchain_cursor.nr +1 ));if (he_cache ==NULL )return -ENOMEM ;
@@ -881,8 +881,6 @@ int hist_entry_iter__add(struct hist_entif (err)return err; - iter->max_stack = max_stack_depth; - err = iter->ops->prepare_entry (iter, al);if (err) goto out;
tools/perf/util/hist.h +0 -1
@@ -91,7 +91,6 @@ struct hist_entry_iter {int curr;bool hide_unresolved; -int max_stack;struct perf_evsel *evsel;struct perf_sample *sample;
Greg Kroah-Hartman
maintainerPATCH 259/268 selftests/net: fixes psock_fanout eBPF test case
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prashant Bhole <[email protected]>
[ Upstream commit ddd0010392d9cbcb95b53d11b7cafc67b373ab56 ]
eBPF test fails due to verifier failure because log_buf is too small. Fixed by increasing log_buf size
--- tools/testing/selftests/net/psock_fanout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/psock_fanout.c +2 -1
@@ -97,6 +97,8 @@ static int sock_fanout_open(uint16_t typstatic void sock_fanout_set_ebpf (int fd) { +static char log_buf[65536 ]; + const int len_off = __builtin_offsetof(struct __sk_buff, len);struct bpf_insn prog[] = { {BPF_ALU64 |BPF_MOV |BPF_X ,6 ,1 ,0 ,0 },
@@ -109,7 +111,6 @@ static void sock_fanout_set_ebpf(int fd) { BPF_ALU | BPF_MOV | BPF_K, 0, 0, 0, 0 }, { BPF_JMP | BPF_EXIT, 0, 0, 0, 0 } }; -char log_buf[512 ];union bpf_attr attr;int pfd;
Greg Kroah-Hartman
maintainerPATCH 17/268 do d_instantiate/unlock_new_inode combinations safely
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.
For anything NFS-exported we do _not_ want to unlock new inode before it has grown an alias; original set of fixes got the ordering right, but missed the nasty complication in case of lockdep being enabled - unlock_new_inode() does
lockdep_annotate_inode_mutex_key(inode)
which can only be done before anyone gets a chance to touch ->i_mutex. Unfortunately, flipping the order and doing unlock_new_inode() before d_instantiate() opens a window when mkdir can race with open-by-fhandle on a guessed fhandle, leading to multiple aliases for a directory inode and all the breakage that follows from that.
Correct solution: a new primitive (d_instantiate_new())
combining these two in the right order - lockdep annotate, then d_instantiate(), then the rest of unlock_new_inode(). All combinations of d_instantiate() with unlock_new_inode() should be converted to that.
--- fs/btrfs/inode.c | 16 ++++------------ fs/dcache.c | 22 ++++++++++++++++++++++ fs/ecryptfs/inode.c | 3 +-- fs/ext2/namei.c | 6 ++---- fs/ext4/namei.c | 6 ++---- fs/f2fs/namei.c | 12 ++++-------- fs/jffs2/dir.c | 12 ++++-------- fs/jfs/namei.c | 12 ++++-------- fs/nilfs2/namei.c | 6 ++---- fs/reiserfs/namei.c | 12 ++++-------- fs/udf/namei.c | 6 ++---- fs/ufs/namei.c | 6 ++---- include/linux/dcache.h | 1 + 13 files changed, 54 insertions(+), 66 deletions(-)
fs/btrfs/inode.c +4 -12
@@ -6413,8 +6413,7 @@ static int btrfs_mknod(struct inode *dir goto out_unlock_inode; }else {btrfs_update_inode (trans, root, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); } out_unlock:
@@ -6489,8 +6488,7 @@ static int btrfs_create(struct inode *di goto out_unlock_inode;BTRFS_I (inode)->io_tree.ops = &btrfs_extent_io_ops; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
@@ -6633,12 +6631,7 @@ static int btrfs_mkdir(struct inode *dirif (err) goto out_fail_inode; -d_instantiate (dentry, inode); -/* -* mkdir is special. We're unlocking after we call d_instantiate -* to avoid a race with nfsd calling d_instantiate. -*/ -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); drop_on_err =0 ; out_fail:
@@ -9789,8 +9782,7 @@ static int btrfs_symlink(struct inode *d goto out_unlock_inode; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
fs/dcache.c +22 -0
@@ -1897,6 +1897,28 @@ struct dentry *d_instantiate_unique(struEXPORT_SYMBOL (d_instantiate_unique); +/* +* This should be equivalent to d_instantiate() + unlock_new_inode(), +* with lockdep-related part of unlock_new_inode() done before +* anything else. Use that instead of open-coding d_instantiate()/ +* unlock_new_inode() combinations. +*/ +void d_instantiate_new (struct dentry *entry,struct inode *inode) +{ +BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +BUG_ON (!inode); +lockdep_annotate_inode_mutex_key (inode); +security_d_instantiate (entry, inode); +spin_lock (&inode->i_lock); +__d_instantiate (entry, inode); +WARN_ON (!(inode->i_state &I_NEW )); + inode->i_state &= ~I_NEW ; +smp_mb (); +wake_up_bit (&inode->i_state, __I_NEW); +spin_unlock (&inode->i_lock); +} +EXPORT_SYMBOL (d_instantiate_new); +/** * d_instantiate_no_diralias - instantiate a non-aliased dentry * @entry: dentry to complete
fs/ecryptfs/inode.c +1 -2
@@ -287,8 +287,7 @@ ecryptfs_create(struct inode *directory_iput (ecryptfs_inode); goto out; } -unlock_new_inode (ecryptfs_inode); -d_instantiate (ecryptfs_dentry, ecryptfs_inode); +d_instantiate_new (ecryptfs_dentry, ecryptfs_inode); out:return rc; }
fs/ext2/namei.c +2 -4
@@ -40,8 +40,7 @@ static inline int ext2_add_nondir(struct {int err =ext2_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -267,8 +266,7 @@ static int ext2_mkdir(struct inode * dirif (err) goto out_fail; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out:return err;
fs/ext4/namei.c +2 -4
@@ -2429,8 +2429,7 @@ static int ext4_add_nondir(handle_t *hanint err =ext4_add_entry (handle, dentry, inode);if (!err) {ext4_mark_inode_dirty (handle, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }drop_nlink (inode);
@@ -2669,8 +2668,7 @@ out_clear_inode: err =ext4_mark_inode_dirty (handle, dir);if (err) goto out_clear_inode; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))ext4_handle_sync (handle);
fs/f2fs/namei.c +4 -8
@@ -150,8 +150,7 @@ static int f2fs_create(struct inode *diralloc_nid_done (sbi, ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
@@ -399,8 +398,7 @@ static int f2fs_symlink(struct inode *di err =page_symlink (inode, p_str, p_len); err_out: -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);/* * Let's flush symlink data in order to avoid broken symlink as much as
@@ -454,8 +452,7 @@ static int f2fs_mkdir(struct inode *dir,alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
@@ -499,8 +496,7 @@ static int f2fs_mknod(struct inode *dir,alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))f2fs_sync_fs (sbi->sb,1 );
fs/jffs2/dir.c +4 -8
@@ -207,8 +207,7 @@ static int jffs2_create(struct inode *di __func__, inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->pino_nlink, inode->i_mapping->nrpages); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -428,8 +427,7 @@ static int jffs2_symlink (struct inode *mutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -573,8 +571,7 @@ static int jffs2_mkdir (struct inode *dimutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -745,8 +742,7 @@ static int jffs2_mknod (struct inode *dimutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
fs/jfs/namei.c +4 -8
@@ -178,8 +178,7 @@ static int jfs_create(struct inode *dip,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -313,8 +312,7 @@ static int jfs_mkdir(struct inode *dip,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1058,8 +1056,7 @@ static int jfs_symlink(struct inode *dipunlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1443,8 +1440,7 @@ static int jfs_mknod(struct inode *dir,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out1:
fs/nilfs2/namei.c +2 -4
@@ -50,8 +50,7 @@ static inline int nilfs_add_nondir(struc {int err =nilfs_add_link (dentry, inode);if (!err) { -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -246,8 +245,7 @@ static int nilfs_mkdir(struct inode *dir goto out_fail;nilfs_mark_inode_dirty (inode); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); out:if (!err) err =nilfs_transaction_commit (dir->i_sb);
fs/reiserfs/namei.c +4 -8
@@ -687,8 +687,7 @@ static int reiserfs_create(struct inodereiserfs_update_inode_transaction (inode);reiserfs_update_inode_transaction (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -771,8 +770,7 @@ static int reiserfs_mknod(struct inode * goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -871,8 +869,7 @@ static int reiserfs_mkdir(struct inode */* the above add_entry did not update dir's stat data */ reiserfs_update_sd (&th, dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -1186,8 +1183,7 @@ static int reiserfs_symlink(struct inode goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (parent_dir->i_sb);
fs/udf/namei.c +2 -4
@@ -611,8 +611,7 @@ static int udf_add_nondir(struct dentryif (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }
@@ -722,8 +721,7 @@ static int udf_mkdir(struct inode *dir,inc_nlink (dir); dir->i_ctime = dir->i_mtime =current_fs_time (dir->i_sb);mark_inode_dirty (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh);
fs/ufs/namei.c +2 -4
@@ -38,8 +38,7 @@ static inline int ufs_add_nondir(struct {int err =ufs_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -191,8 +190,7 @@ static int ufs_mkdir(struct inode * dir,if (err) goto out_fail; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; out_fail:
include/linux/dcache.h +1 -0
@@ -236,6 +236,7 @@ extern seqlock_t rename_lock;* These are the low-level FS interfaces to the dcache.. */ extern void d_instantiate (struct dentry *,struct inode *); +extern void d_instantiate_new (struct dentry *,struct inode *);extern struct dentry *d_instantiate_unique (struct dentry *,struct inode *);extern int d_instantiate_no_diralias (struct dentry *,struct inode *);extern void __d_drop (struct dentry *dentry);
Greg Kroah-Hartman
maintainerPATCH 90/268 md raid10: fix NULL deference in handle_write_completed()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yufen Yu <[email protected]>
[ Upstream commit 01a69cab01c184d3786af09e9339311123d63d22 ]
In the case of 'recover', an r10bio with R10BIO_WriteError & R10BIO_IsRecover will be progressed by handle_write_completed(). This function traverses all r10bio->devs[copies].
If devs[m].repl_bio != NULL, it thinks conf->mirrors[dev].replacement is also not NULL. However, this is not always true.
When there is an rdev of raid10 has replacement, then each r10bio ->devs[m].repl_bio != NULL in conf->r10buf_pool. However, in 'recover', even if corresponded replacement is NULL, it doesn't clear r10bio ->devs[m].repl_bio, resulting in replacement NULL deference.
This bug was introduced when replacement support for raid10 was added in Linux 3.3.
As NeilBrown suggested:
Elsewhere the determination of "is this device part of the resync/recovery" is made by resting bio->bi_end_io. If this is end_sync_write, then we tried to write here. If it is NULL, then we didn't try to write.
--- drivers/md/raid10.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/md/raid10.c +4 -2
@@ -2630,7 +2630,8 @@ static void handle_write_completed(strucfor (m =0 ; m < conf->copies; m++) {int dev = r10_bio->devs[m].devnum; rdev = conf->mirrors[dev].rdev; -if (r10_bio->devs[m].bio ==NULL ) +if (r10_bio->devs[m].bio ==NULL || + r10_bio->devs[m].bio->bi_end_io ==NULL )continue ;if (!r10_bio->devs[m].bio->bi_error) { rdev_clear_badblocks(
@@ -2645,7 +2646,8 @@ static void handle_write_completed(strucmd_error (conf->mddev, rdev); } rdev = conf->mirrors[dev].replacement; -if (r10_bio->devs[m].repl_bio ==NULL ) +if (r10_bio->devs[m].repl_bio ==NULL || + r10_bio->devs[m].repl_bio->bi_end_io ==NULL )continue ;if (!r10_bio->devs[m].repl_bio->bi_error) {
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.134 release. There are 268 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 Wed May 30 10:00:40 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.134-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Merged, compiled with -Werror, and installed onto my Pixel 2 XL and OnePlus 5.
No initial issues noticed in general usage or dmesg.
Thanks!
Nathan
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.134 release. There are 268 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 Wed May 30 10:00:40 UTC 2018. Anything received after that time might be too late.
Build results:
total: 146 pass: 146 fail: 0 Qemu test results: total: 127 pass: 127 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.134 release. There are 268 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 Wed May 30 10:00:40 UTC 2018. 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.4.134-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.
NOTE:
The failed LTP test case "cve-2017-5669" is a waiver here.
Summary
------------------------------------------------------------------------
kernel: 4.4.134-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 186b201a52cb29a2970391841c16a97833fe7119
git describe: v4.4.133-269-g186b201a52cb
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.133-269-g186b201a52cb
No regressions (compared to build v4.4.133-270-gc7a377784d68)
Ran 7070 total tests in the following environments and test suites.
Environments
--------------
- juno-r2 - arm64
- qemu_arm
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Hikey test results,
Summary
------------------------------------------------------------------------
kernel: 4.4.134-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.134-rc1-hikey-20180528-206
git commit: c4a9948ea47675e12c3f2a5ff009b2d0cb6c7517
git describe: 4.4.134-rc1-hikey-20180528-206
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.134-rc1-hikey-20180528-206
No regressions (compared to build 4.4.134-rc1-hikey-20180528-205)
Ran 2655 total tests in the following environments and test suites.
Environments
--------------
- hi6220-hikey - arm64
- qemu_arm64
Test Suites
-----------
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.134 release. There are 268 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 Wed May 30 10:00:40 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.134-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
RE: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"
In reply to Greg Kroah-HartmanQuoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On 4.4-stable review patch. If anyone has any objections, please let me know.------------------
From: Davidlohr Bueso <[email protected]>
commit
a73ab244f0dad8fffb3291b905f73e2d3eaa7c00upstream.Patch series "ipc/shm:
shmat()fixes around nil-page".
Sorry for being a bit late (the pace is really fast here).
I have found a regression from 4.4.133-rc1 to 4.4.134-rc1 using Fuego LTP wrapper.
4.4.134-rc1
tst_test.c:982: INFO: Timeout per run is 0h 05m 00s cve-2017-5669.c:62: INFO: Attempting to attach shared memory to null page cve-2017-5669.c:74: INFO: Mapped shared memory to (nil) cve-2017-5669.c:78: FAIL: We have mapped a VM address within the first 64Kb cve-2017-5669.c:84: INFO: Touching shared memory to see if anything strange happens
4.4.133-rc1:
tst_test.c:982: INFO: Timeout per run is 0h 05m 00s cve-2017-5669.c:62: INFO: Attempting to attach shared memory to null page cve-2017-5669.c:67: PASS: shmat returned EINVAL
The culprits should be one or both of the two last commits to ipc/shm (one of them a revert).
- ipc/shm: fix shmat() nil address after round-down when remapping
- Revert "ipc/shm: Fix shmat mmap nil-page protection"
I need to investigate the concrete reason, but for now I just wanted to report it.
Thanks,
Daniel
Quoted 63 lines
These patches fix two issues reported[1] a while back by Joe and Andrea around how shmat(2) behaves with nil-page.
The first reverts a commit that it was incorrectly thought that mapping nil-page (address=0) was a no no with
MAP_FIXED. This is not the case, with the exception ofSHM_REMAP; which is address in the second patch.I chose two patches because it is easier to backport and it explicitly reverts bogus behaviour. Both patches ought to be in -stable and ltp testcases need updated (the added testcase around the cve can be modified to just test for SHM_RND|SHM_REMAP).
[1] lkml.kernel.org/r/20180430172152.nfa564pvgpk3ut7p@linux-n805
This patch (of 2):
Commit
95e91b831f87("ipc/shm: Fix shmat mmap nil-page protection") worked on the idea that we should not be mapping as root addr=0 andMAP_FIXED. However, it was reported that this scenario is in fact valid, thus making the patch both bogus and breaks userspace as well.For example X11's libint10.so relies on
shmat(1, SHM_RND)for lowmem initialization[1].[1]
https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/os-support/linux/int1
0/linux.c#n347Fixes 95e91b831f87 ("ipc/shm: Fix shmat mmap nil-page protection")Signed-off-by Davidlohr Bueso <[email protected]>Reported-by Joe Lawrence <[email protected]>Reported-by Andrea Arcangeli <[email protected]>Cc Manfred Spraul <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- ipc/shm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)ipc/shm.c +2
-7@@ -1113,13 +1113,8 @@ long do_shmat(int shmid, char __user *sh goto out; else if ((addr = (ulong)shmaddr)) {if (addr & (shmlba -1 )) { -/* -* Round down to the nearest multiple of shmlba. -* For sane do_mmap_pgoff() parameters, avoid -* round downs that trigger nil-page and MAP_FIXED. -*/ -if ((shmflg &SHM_RND ) && addr >= shmlba) - addr &= ~(shmlba -1 ); +if (shmflg &SHM_RND ) + addr &= ~(shmlba -1 );/* round down */ else#ifndef __ARCH_FORCE_SHMLBAif (addr & ~PAGE_MASK )
'Greg Kroah-Hartman'
maintainerRe: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"
Quoted 28 lines · Daniel Sangorrin
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On 4.4-stable review patch. If anyone has any objections, please let me know.------------------
From: Davidlohr Bueso <[email protected]>
commit
a73ab244f0dad8fffb3291b905f73e2d3eaa7c00upstream.Patch series "ipc/shm:
shmat()fixes around nil-page".Sorry for being a bit late (the pace is really fast here).
I have found a regression from 4.4.133-rc1 to 4.4.134-rc1 using Fuego LTP wrapper.
4.4.134-rc1
tst_test.c:982: INFO: Timeout per run is 0h 05m 00s cve-2017-5669.c:62: INFO: Attempting to attach shared memory to null page cve-2017-5669.c:74: INFO: Mapped shared memory to (nil) cve-2017-5669.c:78: FAIL: We have mapped a VM address within the first 64Kb cve-2017-5669.c:84: INFO: Touching shared memory to see if anything strange happens4.4.133-rc1:
tst_test.c:982: INFO: Timeout per run is 0h 05m 00s cve-2017-5669.c:62: INFO: Attempting to attach shared memory to null page cve-2017-5669.c:67: PASS: shmat returned EINVAL
Quoted 6 lines
The culprits should be one or both of the two last commits to ipc/shm (one of them a revert).
- ipc/shm: fix
shmat()nil address after round-down when remapping
- Revert "ipc/shm: Fix shmat mmap nil-page protection"I need to investigate the concrete reason, but for now I just wanted to report it.
Thanks for letting us know, but this was reported already. See the emails on lkml with the subject:
Subject: Re: [PATCH 4.16 000/272] 4.16.13-stable review from Davidlohr Bueso Message-ID: <20180528213039.yy2madue67njkmw5@linux-n805>
where he discusses that the LTP test is incorrect and that the kernel change is correct and that LTP is going to be fixed because of this.
thanks,
greg k-h
RE: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"
Quoted 2 lines
-----Original Message-----
From: 'Greg Kroah-Hartman' [mailto:[email protected]]
..
Quoted 8 lines
Thanks for letting us know, but this was reported already. See the emails on lkml with the subject:
Subject: Re: [PATCH 4.16 000/272] 4.16.13-stable review from Davidlohr Bueso Message-ID: <20180528213039.yy2madue67njkmw5@linux-n805>where he discusses that the LTP test is incorrect and that the kernel change is correct and that LTP is going to be fixed because of this.
OK, thank you for the information!
Regards,
Daniel
Re: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"
Quoted 11 lines · Daniel Sangorrin
Quoted 2 lines
-----Original Message-----
From: 'Greg Kroah-Hartman' [mailto:[email protected]]..
Quoted 8 lines
Thanks for letting us know, but this was reported already. See the emails on lkml with the subject:
Subject: Re: [PATCH 4.16 000/272] 4.16.13-stable review from Davidlohr Bueso Message-ID: <20180528213039.yy2madue67njkmw5@linux-n805>where he discusses that the LTP test is incorrect and that the kernel change is correct and that LTP is going to be fixed because of this.
My two cents,
If you are referring to cve-2017-5669.c
LTP test case is been fixed few hours ago by Rafael Tinoco,
- shm_addr = shmat(shm_id, ((void *)1), SHM_RND);
+ shm_addr = shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP);
LTP patch pull request and it is been merged.
https://github.com/linux-test-project/ltp/pull/324
Quoted 3 lines
OK, thank you for the information!
- Naresh
Quoted 4 lines
Regards,
Daniel
RE: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"
Quoted 31 lines
-----Original Message-----
From: Naresh Kamboju [mailto:[email protected]]
Sent: Friday, June 1, 2018 12:55 AM
To: Daniel Sangorrin <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>; open list <[email protected]>; linux- stable <[email protected]>; Davidlohr Bueso <[email protected]>; Joe Lawrence <[email protected]>; Andrea Arcangeli <[email protected]>; Manfred Spraul <[email protected]>; Andrew Morton <[email protected]>; Linus Torvalds <[email protected]>
Subject: Re: [PATCH 4.4 011/268] Revert "ipc/shm: Fix shmat mmap nil-page protection"Quoted 11 lines · Daniel Sangorrin
Quoted 2 lines
-----Original Message-----
From: 'Greg Kroah-Hartman' [mailto:[email protected]]..
Quoted 8 lines
Thanks for letting us know, but this was reported already. See the emails on lkml with the subject:
Subject: Re: [PATCH 4.16 000/272] 4.16.13-stable review from Davidlohr Bueso Message-ID: <20180528213039.yy2madue67njkmw5@linux-n805>where he discusses that the LTP test is incorrect and that the kernel change is correct and that LTP is going to be fixed because of this.
My two cents,
If you are referring tocve-2017-5669.c
LTP test case is been fixed few hours ago by Rafael Tinoco,
Quoted 5 lines
-
shm_addr=shmat(shm_id, ((void *)1), SHM_RND);
+shm_addr=shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP);LTP patch pull request and it is been merged.
https://github.com/linux-test-project/ltp/pull/324
Thanks a lot Naresh.
I confirmed that the latest LTP cve-2017-5669 now PASSes.
Thanks,
Daniel
Re: [PATCH 4.4 010/268] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
In reply to Greg Kroah-HartmanQuoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Jin <[email protected]>
commit
4855c92dbb7b3b85c23e88ab7ca04f99b9677b41upstream.
Quoted 7 lines
When run raidconfig from Dom0 we found that the Xen DMA heap is reduced, but Dom Heap is increased by the same size. Tracing raidconfig we found that the related
ioctl()inmegaraid_saswill calldma_alloc_coherent()to apply memory. If the memory allocated by Dom0 is not in the DMA area, it will exchange memory with Xen to meet the requiment. Later drivers calldma_free_coherent()to free the memory, onxen_swiotlb_free_coherent()the check condition (dev_addr+ size - 1 <=dma_mask) is always false,
I think this was meant to say (dev_addr + size - 1 > dma_mask), i.e. the condition that is replaced by this commit. If that's always false, the new condition (the logical inverse) must always be true.
[...]
Quoted 11 lines
drivers/xen/swiotlb-xen.c +0
-0@@ -359,7 +359,7 @@ xen_swiotlb_free_coherent(struct device* physical address */ phys = xen_bus_to_phys(dev_addr);drivers/xen/swiotlb-xen.c +1
-1- if (((dev_addr + size - 1 > dma_mask)) || + if (((dev_addr + size - 1 <= dma_mask)) ||range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order);
So now we will always call xen_destroy_contiguous_region(), whether or not xen_create_contiguous_region() was called during allocation. Is that really the intent? If so, the entire condition could be removed to make this clear.
Alternately, if the commit message is correct, the condition could be simplified to range_straddles_page_boundary(...).
But I'm not at all convinced that either of these is correct. It seems like you need to either find a way of distinguishing between memory allocated with or without the use of xen_create_contiguous_region(), or to use it unconditionally.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 010/268] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
Quoted 17 lines · Ben Hutchings
Quoted 8 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Jin <[email protected]>
commit
4855c92dbb7b3b85c23e88ab7ca04f99b9677b41upstream.Quoted 7 lines
When run raidconfig from Dom0 we found that the Xen DMA heap is reduced, but Dom Heap is increased by the same size. Tracing raidconfig we found that the related
ioctl()inmegaraid_saswill calldma_alloc_coherent()to apply memory. If the memory allocated by Dom0 is not in the DMA area, it will exchange memory with Xen to meet the requiment. Later drivers calldma_free_coherent()to free the memory, onxen_swiotlb_free_coherent()the check condition (dev_addr+ size - 1 <=dma_mask) is always false,
Quoted 1 line
I think this was meant to say (
dev_addr+ size - 1 >dma_mask), i.e.
Hi Ben,
Yes you are right, sorry I made the mistake, thanks for catch it. Is there any way to fix description from git repo?
Regards,
Joe
Quoted 31 lines
the condition that is replaced by this commit. If that's always false, the new condition (the logical inverse) must always be true.
[...]
Quoted 11 lines
drivers/xen/swiotlb-xen.c +0
-0@@ -359,7 +359,7 @@ xen_swiotlb_free_coherent(struct device* physical address */ phys = xen_bus_to_phys(dev_addr);drivers/xen/swiotlb-xen.c +1
-1- if (((dev_addr + size - 1 > dma_mask)) || + if (((dev_addr + size - 1 <= dma_mask)) ||range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order);So now we will always call
xen_destroy_contiguous_region(), whether or notxen_create_contiguous_region()was called during allocation. Is that really the intent? If so, the entire condition could be removed to make this clear.Alternately, if the commit message is correct, the condition could be simplified to
range_straddles_page_boundary(...).But I'm not at all convinced that either of these is correct. It seems like you need to either find a way of distinguishing between memory allocated with or without the use of
xen_create_contiguous_region(), or to use it unconditionally.Ben.
Signature · 4 lines
Oracle <http://www.oracle.com> Joe Jin | IT Director ORACLE | Production Engineering and Operations 600 Oracle Parkway Redwood City, CA US 94065
Re: [PATCH 4.4 010/268] xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
Quoted 18 lines · Joe Jin
Quoted 17 lines · Ben Hutchings
Quoted 15 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Jin <[email protected]>
commit
4855c92dbb7b3b85c23e88ab7ca04f99b9677b41upstream.When run raidconfig from Dom0 we found that the Xen DMA heap is reduced, but Dom Heap is increased by the same size. Tracing raidconfig we found that the related
ioctl()inmegaraid_saswill calldma_alloc_coherent()to apply memory. If the memory allocated by Dom0 is not in the DMA area, it will exchange memory with Xen to meet the requiment. Later drivers calldma_free_coherent()to free the memory, onxen_swiotlb_free_coherent()the check condition (dev_addr+ size - 1 <=dma_mask) is always false,
Quoted 6 lines
Quoted 1 line
I think this was meant to say (
dev_addr+ size - 1 >dma_mask), i.e.Hi Ben,
Yes you are right, sorry I made the mistake, thanks for catch it. Is there any way to fix description from git repo?
No there isn't, but that wasn't my main point. Please address the rest of my message.
Ben.
Quoted 36 lines
Regards,
JoeQuoted 31 lines
the condition that is replaced by this commit. If that's always false, the new condition (the logical inverse) must always be true.
[...]
Quoted 11 lines
drivers/xen/swiotlb-xen.c +0
-0@@ -359,7 +359,7 @@ xen_swiotlb_free_coherent(struct device* physical address */ phys = xen_bus_to_phys(dev_addr);drivers/xen/swiotlb-xen.c +1
-1- if (((dev_addr + size - 1 > dma_mask)) || + if (((dev_addr + size - 1 <= dma_mask)) ||range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order);So now we will always call
xen_destroy_contiguous_region(), whether or notxen_create_contiguous_region()was called during allocation. Is that really the intent? If so, the entire condition could be removed to make this clear.Alternately, if the commit message is correct, the condition could be simplified to
range_straddles_page_boundary(...).But I'm not at all convinced that either of these is correct. It seems like you need to either find a way of distinguishing between memory allocated with or without the use of
xen_create_contiguous_region(), or to use it unconditionally.Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 017/268] do d_instantiate/unlock_new_inode combinations safely
In reply to Greg Kroah-HartmanQuoted 20 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit
1e2e547a93a00ebc21582c06ca3c6cfea2a309eeupstream.For anything NFS-exported we do _not_ want to unlock new inode before it has grown an alias; original set of fixes got the ordering right, but missed the nasty complication in case of lockdep being enabled -
unlock_new_inode()does
lockdep_annotate_inode_mutex_key(inode)
which can only be done before anyone gets a chance to touch ->i_mutex. Unfortunately, flipping the order and doingunlock_new_inode()befored_instantiate()opens a window when mkdir can race with open-by-fhandle on a guessed fhandle, leading to multiple aliases for a directory inode and all the breakage that follows from that.
Quoted 5 lines
Correct solution: a new primitive (
d_instantiate_new())
combining these two in the right order - lockdep annotate, thend_instantiate(), then the rest of unlock_new_inode(). All combinations ofd_instantiate()withunlock_new_inode()should be converted to that.
[...]
I think you missed xfs, which has a wrapper around unlock_new_inode() called xfs_finish_inode_setup(). It looks like xfs_generic_create() and xfs_vn_symlink() still need this conversion.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 038/268] Btrfs: fix scrub to repair raid6 corruption
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit
762221f095e3932669093466aaf4b85ed9ad2ac1]
The diff here is actually from commit 8810f7517a3b ("Btrfs: make raid6 rebuild retry more", mentioned in this commit message). (Sasha, please try to work out why commit messages and descriptions are getting mixed up in your auto-selections.)
Maybe stable branches should get the real commit 762221f095e3 as well?
Ben.
Quoted 75 lines
The raid6 corruption is that,
suppose that all disks can be read without problems and if the content that was read out doesn't match its checksum, currently for raid6 btrfs at most retries twice,- the 1st retry is to rebuild with all other stripes, it'll eventually be a raid5 xor rebuild,
- if the 1st fails, the 2nd retry will deliberately fail parity p so that it will do raid6 style rebuild,however, the chances are that another non-parity stripe content also has something corrupted, so that the above retries are not able to return correct content.
We've fixed normal reads to rebuild raid6 correctly with more retries in Patch "Btrfs: make raid6 rebuild retry more"[1], this is to fix scrub to do the exactly same rebuild process.
[1]: https://patchwork.kernel.org/patch/10091755/
Signed-off-by Liu Bo <[email protected]>Signed-off-by David Sterba <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
fs/btrfs/raid56.c | 18 ++++++++++++++----
fs/btrfs/volumes.c | 9 ++++++++-2 files changed, 22 insertions(+), 5 deletions(-)fs/btrfs/raid56.c +0
-0@@ -2160,11 +2160,21 @@ int raid56_parity_recover(struct btrfs_r }
/*fs/btrfs/raid56.c +3
-2- * reconstruct from the q stripe if they are - * asking for mirror 3 + * Loop retry: + * for 'mirror == 2', reconstruct from all other stripes. + * for 'mirror_num > 2', select a stripe to fail on every retry.*/
fs/btrfs/raid56.c +11
-2-if (mirror_num ==3 ) - rbio->failb = rbio->real_stripes -2 ; +if (mirror_num >2 ) { +/* +* 'mirror == 3' is to fail the p stripe and +* reconstruct from the q stripe. 'mirror > 3' is to +* fail a data stripe and reconstruct from p+q stripe. +*/ + rbio->failb = rbio->real_stripes - (mirror_num -1 ); +ASSERT (rbio->failb >0 ); +if (rbio->failb <= rbio->faila) + rbio->failb--; + }
ret =lock_stripe_add(rbio);fs/btrfs/volumes.c +8
-1@@ -5056,7 +5056,14 @@ int btrfs_num_copies(struct btrfs_fs_inf else if (map->type & BTRFS_BLOCK_GROUP_RAID5) ret = 2; else if (map->type & BTRFS_BLOCK_GROUP_RAID6) - ret =3 ; +/* +* There could be two corrupted data stripes, we need +* to loop retry in order to rebuild the correct data. +* +* Fail a stripe at a time on every retry except the +* stripe under reconstruction. +*/ + ret = map->num_stripes;else
ret = 1;
free_extent_map(em);
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 051/268] asm-generic: provide generic_pmdp_establish()
In reply to Greg Kroah-HartmanQuoted 17 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit
c58f0bb77ed8bf93dfdde762b01cb67eebbdfc29]Patch series "Do not lose dirty bit on THP pages", v4.
Vlastimil noted that
pmdp_invalidate()is not atomic and we can lose dirty and access bits if CPU sets them after pmdp dereference, but beforeset_pmd_at().The bug can lead to data loss, but the race window is tiny and I haven't seen any reports that suggested that it happens in reality. So I don't think it worth sending it to stable.
[...]
Quoted 6 lines
This patch (of 12):
This is an implementation of
pmdp_establish()that is only suitable for an architecture that doesn't have hardware dirty/accessed bits. In this case we can't race with CPU which sets these bits and non-atomic approach is fine.
[...]
There's no point in applying just this patch, since it adds a new function that nothing will call.
I tend to think that since this is fixing a potential data loss, the whole series should be backported. But the commit message here says it shouldn't.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 059/268] xen-netfront: Fix race between device setup and open
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
[ Upstream commit
f599c64fdf7d9c108e8717fb04bc41c680120da4]
[...]
Quoted 2 lines
drivers/net/xen-netfront.c +0
-0
[...]
drivers/net/xen-netfront.c static int talk_to_netback(struct xenbus · line 1824
Quoted 2 lines
drivers/net/xen-netfront.c +0
-0@@ -1839,6 +1824,7 @@ static int talk_to_netback(struct xenbus goto out;
This "goto out" is outside the locked section...
Quoted 21 lines
drivers/net/xen-netfront.c +0
-0}drivers/net/xen-netfront.c +1
-0+rtnl_lock ();if (
info->queues)
xennet_destroy_queues(info);drivers/net/xen-netfront.c +1
-0@@ -1849,6 +1835,7 @@ static int talk_to_netback(struct xenbus info->queues = NULL; goto out; } +rtnl_unlock ();
/* Create shared ring, alloc event channel -- for each queue */ for (i = 0; i <num_queues; ++i) {drivers/net/xen-netfront.c +0
-0@@ -1945,8 +1932,10 @@ abort_transaction_no_dev_fatal: xenbus_transaction_end(xbt, 1);
destroy_ring:
xennet_disconnect_backend(info);drivers/net/xen-netfront.c +1
-0+rtnl_lock ();
xennet_destroy_queues(info);
out:
drivers/net/xen-netfront.c
Quoted 1 line
drivers/net/xen-netfront.c +1
-0+rtnl_unlock ();
...so this will be an unmatched unlock.
You need to add another label below the rtnl_unlock().
Ben.
Quoted 3 lines
device_unregister(&dev->dev);
return err;
}
[...]
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomGreg Kroah-Hartman
maintainerRe: [PATCH 4.4 051/268] asm-generic: provide generic_pmdp_establish()
In reply to Ben HutchingsQuoted 25 lines · Ben Hutchings
Quoted 17 lines · Greg Kroah-Hartman
4.4-stable review patch.��If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit
c58f0bb77ed8bf93dfdde762b01cb67eebbdfc29]Patch series "Do not lose dirty bit on THP pages", v4.
Vlastimil noted that
pmdp_invalidate()is not atomic and we can lose dirty and access bits if CPU sets them after pmdp dereference, but beforeset_pmd_at().The bug can lead to data loss, but the race window is tiny and I haven't seen any reports that suggested that it happens in reality.��So I don't think it worth sending it to stable.
[...]
Quoted 6 lines
This patch (of 12):
This is an implementation of
pmdp_establish()that is only suitable for an architecture that doesn't have hardware dirty/accessed bits.��In this case we can't race with CPU which sets these bits and non-atomic approach is fine.
Quoted 8 lines
[...]
There's no point in applying just this patch, since it adds a new function that nothing will call.
I tend to think that since this is fixing a potential data loss, the whole series should be backported. But the commit message here says it shouldn't.
Hm, I thought there was some reason for this patch, as I thought it came up before. Sasha do you remember? Should I just revert it?
thanks,
greg k-h
Re: [PATCH 4.4 110/268] nvme-pci: Fix nvme queue cleanup if IRQ setup fails
In reply to Greg Kroah-HartmanQuoted 36 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianchao Wang <[email protected]>
[ Upstream commit
f25a2dfc20e3a3ed8fe6618c331799dd7bd01190]This patch fixes nvme queue cleanup if requesting an IRQ handler for the queue's vector fails. It does this by resetting the
cq_vectorto the uninitialized value of -1 so it is ignored for a controller reset.Signed-off-by Jianchao Wang <[email protected]>[changelog updates, removed misc whitespace changes]Signed-off-by Keith Busch <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/nvme/host/pci.c | 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/nvme/host/pci.c +1
-1@@ -1583,7 +1583,7 @@ static int nvme_create_queue(struct nvme nvmeq->cq_vector = qid - 1; result = adapter_alloc_cq(dev, qid, nvmeq); if (result < 0) -return result; + goto release_vector;
result =adapter_alloc_sq(dev, qid, nvmeq); if (result < 0)drivers/nvme/host/pci.c +0
-0@@ -1597,9 +1597,12 @@ static int nvme_create_queue(struct nvme return result;
release_sq:
drivers/nvme/host/pci.c static int nvme_create_queue(struct nvme · line 1600
Quoted 1 line
drivers/nvme/host/pci.c +1
-0+ dev->online_queues--;
This addition looks wrong. dev->online_queues is incremented by nvme_init_queue(), but this function only calls that at a point where it is sure to succeed. So why would a failure path need to decrement it?
Ben.
Quoted 11 lines
adapter_delete_sq(dev, qid);
release_cq:
adapter_delete_cq(dev, qid);
+release_vector:drivers/nvme/host/pci.c +1
-0+ nvmeq->cq_vector =-1 ;return result;
}
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 110/268] nvme-pci: Fix nvme queue cleanup if IRQ setup fails
Quoted 13 lines · Ben Hutchings
drivers/nvme/host/pci.c static int nvme_create_queue(struct nvme · line 1600
Quoted 7 lines · Greg Kroah-Hartman
result =
adapter_alloc_sq(dev, qid, nvmeq); if (result < 0)(quoted diff) +0
-0@@ -1597,9 +1597,12 @@ static int nvme_create_queue(struct nvme return result;
release_sq:drivers/nvme/host/pci.c +1
-0+ dev->online_queues--;This addition looks wrong.
dev->online_queuesis incremented bynvme_init_queue(), but this function only calls that at a point where it is sure to succeed. So why would a failure path need to decrement it?
Thank you very much the catching that. This particular patch is indeed not correct without the following:
161b8be2bd6ab ("nvme-pci: initialize queue memory before interrupts")
Re: [PATCH 4.4 110/268] nvme-pci: Fix nvme queue cleanup if IRQ setup fails
Quoted 15 lines · Keith Busch
Quoted 13 lines · Ben Hutchings
drivers/nvme/host/pci.c static int nvme_create_queue(struct nvme · line 1600
Quoted 7 lines · Greg Kroah-Hartman
result =
adapter_alloc_sq(dev, qid, nvmeq); if (result < 0)(quoted diff) +0
-0@@ -1597,9 +1597,12 @@ static int nvme_create_queue(struct nvme return result;
release_sq:drivers/nvme/host/pci.c +1
-0+ dev->online_queues--;This addition looks wrong. dev->online_queues is incremented by
nvme_init_queue(), but this function only calls that at a point where it is sure to succeed. So why would a failure path need to decrement it?
Quoted 4 lines
Thank you very much the catching that. This particular patch is indeed not correct without the following:
161b8be2bd6ab("nvme-pci: initialize queue memory before interrupts")
Oh, now I see. Do you think that commit is suitable for stable branches?
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 110/268] nvme-pci: Fix nvme queue cleanup if IRQ setup fails
Quoted 8 lines · Ben Hutchings
Quoted 4 lines · Keith Busch
Thank you very much the catching that. This particular patch is indeed not correct without the following:
�
161b8be2bd6ab("nvme-pci: initialize queue memory before interrupts")Oh, now I see. Do you think that commit is suitable for stable branches?
Yes, we can safely include that commit 4.4-stable. The scenario it fixes isn't very common in 4.4, but it could happen with quirky hardware or legacy interrupts.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 110/268] nvme-pci: Fix nvme queue cleanup if IRQ setup fails
Quoted 5 lines · Keith Busch
Quoted 4 lines · Ben Hutchings
Quoted 3 lines · Keith Busch
Thank you very much the catching that. This particular patch is indeed not correct without the following:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
�
161b8be2bd6ab("nvme-pci: initialize queue memory before interrupts")Oh, now I see. Do you think that commit is suitable for stable branches?
Yes, we can safely include that commit 4.4-stable. The scenario it fixes isn't very common in 4.4, but it could happen with quirky hardware or legacy interrupts.
It does not apply to 4.4.y right now, but it does apply to 4.9.y, so I've added it there. If it needs to get to 4.4.y, can someone do a backport?
thanks,
greg k-h
Re: [PATCH 4.4 128/268] scsi: sd: Keep disk read-only when re-reading partition
In reply to Greg Kroah-HartmanQuoted 11 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Cline <[email protected]>
[ Upstream commit
20bd1d026aacc5399464f8328f305985c493cde3]If the read-only flag is true on a SCSI disk, re-reading the partition table sets the flag back to false.
Quoted 8 lines
To observe this bug, you can run:
1. blockdev --setro
/dev/sda
2. blockdev --rereadpt/dev/sda
3. blockdev --getro/dev/sdaThis commit reads the disk's old state and combines it with the device disk-reported state rather than unconditionally marking it as RW.
It seems to me that this change is likely to cause a regression: if a SCSI device switches from read-only to read-write state then a subsequent rescan won't automatically change the block device to read- write state. The administrator will have to use the blockdev command too.
Even if this change in behaviour is acceptable, this commit does not implement it consistently. The function starts by clearing the ro flag and this commit only changes one of the three exit paths to preserve it. (The log message about Write Protect status also reports the underlying SCSI device flag and not the combined ro flag, but maybe that was intentional.)
I think this commit should be reverted, both in stable and upstream. A proper fix would involve splitting the ro flag into two flags—one controlled by user-space and one read from the device—with the effective read-only status being the logical-or of those two.
Ben.
Quoted 28 lines
Reported-by Li Ning <[email protected]>Signed-off-by Jeremy Cline <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/scsi/sd.c | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/scsi/sd.c +1
-0@@ -2395,6 +2395,7 @@ sd_read_write_protect_flag(struct scsi_d int res; struct scsi_device *sdp = sdkp->device; struct scsi_mode_data data; +int disk_ro =get_disk_ro (sdkp->disk); int old_wp = sdkp->write_prot;
set_disk_ro(sdkp->disk, 0);drivers/scsi/sd.c +1
-1@@ -2435,7 +2436,7 @@ sd_read_write_protect_flag(struct scsi_d "Test WP failed, assume Write Enabled\n"); } else { sdkp->write_prot = ((data.device_specific & 0x80) != 0); -set_disk_ro (sdkp->disk, sdkp->write_prot); +set_disk_ro (sdkp->disk, sdkp->write_prot || disk_ro); if (sdkp->first_scan || old_wp != sdkp->write_prot) { sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", sdkp->write_prot ? "on" : "off");
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomGreg Kroah-Hartman
maintainerRe: [PATCH 4.4 038/268] Btrfs: fix scrub to repair raid6 corruption
In reply to Ben HutchingsQuoted 7 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
4.4-stable review patch.��If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
Quoted 8 lines
Quoted 1 line
[ Upstream commit
762221f095e3932669093466aaf4b85ed9ad2ac1]The diff here is actually from commit
8810f7517a3b("Btrfs: make raid6 rebuild retry more", mentioned in this commit message). (Sasha, please try to work out why commit messages and descriptions are getting mixed up in your auto-selections.)Maybe stable branches should get the real commit
762221f095e3as well?
Ugh, not good. Sasha, can you fix this up and send me patches for it, separate from your pull requests?
thanks,
greg k-h
Re: [PATCH 4.4 128/268] scsi: sd: Keep disk read-only when re-reading partition
In reply to Ben HutchingsHi Ben,
Quoted 27 lines · Ben Hutchings
Quoted 11 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Cline <[email protected]>
[ Upstream commit
20bd1d026aacc5399464f8328f305985c493cde3]If the read-only flag is true on a SCSI disk, re-reading the partition table sets the flag back to false.
Quoted 8 lines
To observe this bug, you can run:
1. blockdev --setro
/dev/sda
2. blockdev --rereadpt/dev/sda
3. blockdev --getro/dev/sdaThis commit reads the disk's old state and combines it with the device disk-reported state rather than unconditionally marking it as RW.
It seems to me that this change is likely to cause a regression: if a SCSI device switches from read-only to read-write state then a subsequent rescan won't automatically change the block device to read- write state. The administrator will have to use the blockdev command too.
Quoted 6 lines
Even if this change in behaviour is acceptable, this commit does not implement it consistently. The function starts by clearing the ro flag and this commit only changes one of the three exit paths to preserve it. (The log message about Write Protect status also reports the underlying SCSI device flag and not the combined ro flag, but maybe that was intentional.)
Yes, it looks like I messed this up.
Quoted 5 lines
I think this commit should be reverted, both in stable and upstream. A proper fix would involve splitting the ro flag into two flags—one controlled by user-space and one read from the device—with the effective read-only status being the logical-or of those two.
This seems sensible to me, for whatever that's worth. I'm new to the kernel so I'm not certain I'll produce a reasonable patch, but I'm willing to give it a shot.
So the change would be something like:
1. Add a flag to the gendisk struct to indicate if the device is read-only. The driver sets this.
2. In hd_struct struct's policy flag is one that indicates the user-space setting and this gets set by BLKROSET ioctl/set_disk_ro.
3. The effective read-only status reported by the BLKROGET ioctl and bdev_read_only is the logical-or of the hd_struct policy flag and the gendisk device flag.
Maybe that doesn't make sense at all, though. Thoughts?
Thanks,
Jeremy
Re: [PATCH 4.4 173/268] sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
In reply to Greg Kroah-HartmanQuoted 38 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit
d29a20645d5e929aa7e8616f28e5d8e1c49263ec]While running rt-tests'
pi_stressprogram I got the following splat:
rq->clock_update_flags<RQCF_ACT_SKIPWARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20[...]
<IRQ> enqueue_top_rt_rq+0xf4/0x150 ? cpufreq_dbs_governor_start+0x170/0x170 sched_rt_rq_enqueue+0x65/0x80 sched_rt_period_timer+0x156/0x360 ? sched_rt_rq_enqueue+0x80/0x80 __hrtimer_run_queues+0xfa/0x260 hrtimer_interrupt+0xcb/0x220 smp_apic_timer_interrupt+0x62/0x120 apic_timer_interrupt+0xf/0x20 </IRQ>[...]
do_idle+0x183/0x1e0 cpu_startup_entry+0x5f/0x70 start_secondary+0x192/0x1d0 secondary_startup_64+0xa5/0xb0We can get rid of it be the "traditional" means of adding an
update_rq_clock()call after acquiring therq->lockindo_sched_rt_period_timer().
Quoted 6 lines
The case for the RT task throttling (which this workload also hits) can be ignored in that the
skip_updatecall is actually bogus and quite the contrary (the request bits are removed/reverted).By setting
RQCF_UPDATEDwe really don't care if the skip is happening or not and will therefore make theassert_clock_updated()check happy.
There is no such flag or assertion in 4.4 or 4.9, so does this change still make sense there?
Ben.
Quoted 31 lines
Signed-off-by Davidlohr Bueso <[email protected]>Reviewed-by Matt Fleming <[email protected]>Cc Linus Torvalds <[email protected]>Cc Mike Galbraith <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
kernel/sched/rt.c | 2 ++1 file changed, 2 insertions(+)kernel/sched/rt.c +0
-0@@ -822,6 +822,8 @@ static int do_sched_rt_period_timer(stru struct rq *rq = rq_of_rt_rq(rt_rq);
raw_spin_lock(&rq->lock);kernel/sched/rt.c +2
-0+update_rq_clock (rq); +if (
rt_rq->rt_time) {
u64 runtime;
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 173/268] sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
Quoted 43 lines · On Thu, 14 Jun 2018 22:55:56 +0100 Ben Hutchings…
Quoted 42 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit
d29a20645d5e929aa7e8616f28e5d8e1c49263ec]While running rt-tests'
pi_stressprogram I got the following splat:
rq->clock_update_flags<RQCF_ACT_SKIPWARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20[...]
<IRQ> enqueue_top_rt_rq+0xf4/0x150 ? cpufreq_dbs_governor_start+0x170/0x170 sched_rt_rq_enqueue+0x65/0x80 sched_rt_period_timer+0x156/0x360 ? sched_rt_rq_enqueue+0x80/0x80 __hrtimer_run_queues+0xfa/0x260 hrtimer_interrupt+0xcb/0x220 smp_apic_timer_interrupt+0x62/0x120 apic_timer_interrupt+0xf/0x20 </IRQ>[...]
do_idle+0x183/0x1e0 cpu_startup_entry+0x5f/0x70 start_secondary+0x192/0x1d0 secondary_startup_64+0xa5/0xb0We can get rid of it be the "traditional" means of adding an
update_rq_clock()call after acquiring therq->lockindo_sched_rt_period_timer().The case for the RT task throttling (which this workload also hits) can be ignored in that the
skip_updatecall is actually bogus and quite the contrary (the request bits are removed/reverted).
Quoted 5 lines
Quoted 2 lines
By setting
RQCF_UPDATEDwe really don't care if the skip is happening or not and will therefore make theassert_clock_updated()check happy.There is no such flag or assertion in 4.4 or 4.9, so does this change still make sense there?
I believe the assert was added to catch bugs like this.
Although the change log is a bit ambiguous in if it is fixing an actual miss update, or if it is just quieting a false positive.
Davidlohr?
-- Steve
Quoted 34 lines
Ben.
Quoted 31 lines
Signed-off-by Davidlohr Bueso <[email protected]>Reviewed-by Matt Fleming <[email protected]>Cc Linus Torvalds <[email protected]>Cc Mike Galbraith <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
kernel/sched/rt.c | 2 ++1 file changed, 2 insertions(+)kernel/sched/rt.c +0
-0@@ -822,6 +822,8 @@ static int do_sched_rt_period_timer(stru struct rq *rq = rq_of_rt_rq(rt_rq);
raw_spin_lock(&rq->lock);kernel/sched/rt.c +2
-0+update_rq_clock (rq); +if (
rt_rq->rt_time) {
u64 runtime;
Re: [PATCH 4.4 038/268] Btrfs: fix scrub to repair raid6 corruption
In reply to Greg Kroah-HartmanQuoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit
762221f095e3932669093466aaf4b85ed9ad2ac1]The diff here is actually from commit
8810f7517a3b("Btrfs: make raid6 rebuild retry more", mentioned in this commit message). (Sasha, please try to work out why commit messages and descriptions are getting mixed up in your auto-selections.)
Quoted 4 lines
Quoted 1 line
Maybe stable branches should get the real commit
762221f095e3as well?Ugh, not good. Sasha, can you fix this up and send me patches for it, separate from your pull requests?
Crap, I see what's wrong. I'll send fixes later tonight.
Re: [PATCH 4.4 128/268] scsi: sd: Keep disk read-only when re-reading partition
In reply to Ben HutchingsHi Ben,
Quoted 3 lines
(The log message about Write Protect status also reports the underlying SCSI device flag and not the combined ro flag, but maybe that was intentional.)
I'd prefer for the printk in question to reflect the device-reported state, not the state of the block device.
Quoted 4 lines
I think this commit should be reverted, both in stable and upstream. A proper fix would involve splitting the ro flag into two flags—one controlled by user-space and one read from the device—with the effective read-only status being the logical-or of those two.
I don't have a problem with distinguishing between current state and an override flag in the block layer. However, I think an incremental patch to fix that up is fine. SCSI devices don't typically switch write protection state on a whim.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 4.4 181/268] Btrfs: fix copy_items() return value when logging an inode
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit
8434ec46c6e3232cebc25a910363b29f5c617820]
Should stable branches also get a backport of commit 4ee3fad34a9cc2cf33303dfbd0cf554248651c86? It looks like 4.4 and 4.9 would need a minor change (inode->root to BTRFS_I(inode)->root) but I don't know whether that's really sufficient.
Ben.
Quoted 33 lines
When logging an inode, at tree-log.c:copy_items(), if we call
btrfs_next_leaf()at the loop which checks for the need to log holes, we need to make surecopy_items()returns the value 1 to its caller and not 0 (on success). This is because the path the caller passed was released and is now different from what is was before, and the caller expects a return value of 0 to mean both success and that the path has not changed, while a return value of 1 means both success and signals the caller that it can not reuse the path, it has to perform another tree search.Even though this is a case that should not be triggered on normal circumstances or very rare at least, its consequences can be very unpredictable (especially when replaying a log tree).
Fixes 16e7549f045d ("Btrfs: incompatible format change to remove hole extents")Signed-off-by Filipe Manana <[email protected]>Signed-off-by David Sterba <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
fs/btrfs/tree-log.c | 1 +1 file changed, 1 insertion(+)fs/btrfs/tree-log.c +1
-0@@ -3835,6 +3835,7 @@ fill_holes: ASSERT(ret == 0); src = src_path->nodes[0]; i = 0; + need_find_last_extent = true; }
btrfs_item_key_to_cpu(src, &key, i);
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 188/268] hwmon: (nct6775) Fix writing pwmX_mode
In reply to Greg Kroah-HartmanQuoted 13 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit
415eb2a1aaa4881cf85bd86c683356fdd8094a23]
pwmX_modeis defined in the ABI as 0=DC mode, 1=pwm mode. The chip register bit is set to 1 for DC mode. This got mixed up, and writing 1 intopwmX_moderesulted in DC mode enabled. Fix it up by using the ABI definition throughout the driver for consistency.
Quoted 4 lines
Fixes 77eb5b3703d99 ("hwmon: (nct6775) Add support for pwm, pwm_mode, ... ")Signed-off-by Guenter Roeck <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
[...]
The code changes look fine but the comment on the declaration of nct6775_data::pwm_mode is now incorrect.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 229/268] media: cx23885: Set subdev host data to clk_freq pointer
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
Quoted 7 lines
[ Upstream commit
5ceade1d97fc6687e050c44c257382c192f56276]Currently
clk_freqis ignored entirely, because the cx235840 driver configures the xtal at the chip defaults. This is an issue if a board is produced with a non-default frequency crystal. Ifclk_freqis not zero the cx25840 will attempt to use the setting provided, or fall back to defaults otherwise.
This depends on (at least):
commit 3ee9bc12342cf546313d300808ff47d7dbb8e7db
Author: Brad Love <[email protected]> Date: Tue Mar 6 14:15:34 2018 -0500
media: cx25840: Use subdev host data for PLL override
Ben.
Quoted 21 lines
Signed-off-by Brad Love <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/media/pci/cx23885/cx23885-cards.c | 4 ++++1 file changed, 4 insertions(+)drivers/media/pci/cx23885/cx23885-cards.c +4
-0@@ -2124,6 +2124,10 @@ void cx23885_card_setup(struct cx23885_d &dev->i2c_bus[2].i2c_adap, "cx25840", 0x88 >> 1, NULL); if (dev->sd_cx25840) { +/* set host data for clk_freq configuration */ +v4l2_set_subdev_hostdata (dev->sd_cx25840, + &dev->clk_freq); + dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; v4l2_subdev_call(dev->sd_cx25840, core, load_fw); }
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 234/268] enic: enable rq before updating rq descriptors
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit
e8588e268509292550634d9a35f2723a207683b2]
[...]
Quoted 2 lines
drivers/net/ethernet/cisco/enic/enic_main.c +0
-0
[...]
drivers/net/ethernet/cisco/enic/enic_main.c static int enic_open(struct net_device * · line 1771
Quoted 9 lines
drivers/net/ethernet/cisco/enic/enic_main.c +0
-0@@ -1765,8 +1765,12 @@ static int enic_open(struct net_device * > return 0;
err_out_free_rq:drivers/net/ethernet/cisco/enic/enic_main.c +4
-1-for (i =0 ; i < enic->rq_count; i++) +for (i =0 ; i < enic->rq_count; i++) { + err =vnic_rq_disable (&enic->rq[i]); +if (err) +return err;
This added code is wrong: it overwrites the error code that was previously in err. If vnic_rq_disable() succeeds, enic_open() will wrongly return 0. If vnic_rq_disable() fails, I still don't think it makes sense to skip the remaining cleanup actins.
Ben.
Quoted 8 lines
vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);drivers/net/ethernet/cisco/enic/enic_main.c +1
-0+ }
enic_dev_notify_unset(enic);
err_out_free_intr:
enic_unset_affinity_hint(enic);
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 246/268] media: cx25821: prevent out-of-bounds read on array card
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
Quoted 8 lines
[ Upstream commit
67300abdbe9f1717532aaf4e037222762716d0f6]Currently an out of range
dev->nris detected by just reporting the issue and later on an out-of-bounds read on array card occurs because of this. Fix this by checking the upper range ofdev->nrwith the size of array card (removes the hard coded size), move this check earlier and also exit with the error-ENOSYSto avoid the later out-of-bounds array read.
I don't think this is a correct fix.
The card[] array and module parameter appear to be completely redundant. Instead of arbitrarily limiting the number of cards that the driver can bind to, we should remove them.
Ben.
Quoted 37 lines
Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")
Fixes commit 02b20b0b4cde ("V4L/DVB (12730): Add conexant cx25821 driver")Signed-off-by Colin Ian King <[email protected]>Signed-off-by Hans Verkuil <[email protected]>[[email protected]: %ld -> %zd]Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/media/pci/cx25821/cx25821-core.c | 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/media/pci/cx25821/cx25821-core.c +0
-0@@ -871,6 +871,10 @@ static int cx25821_dev_setup(struct cx25 dev->nr = ++cx25821_devcount; sprintf(dev->name, "cx25821[%d]", dev->nr);drivers/media/pci/cx25821/cx25821-core.c +4
-0+if (dev->nr >=ARRAY_SIZE (card)) { +CX25821_INFO ("dev->nr >= %zd" ,ARRAY_SIZE (card)); +return -ENODEV ; + }if (
dev->pci->device!=0x8210) {
pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",__func__,dev->pci->device);drivers/media/pci/cx25821/cx25821-core.c +0
-0@@ -886,9 +890,6 @@ static int cx25821_dev_setup(struct cx25 dev->channels[i].sram_channels = &cx25821_sram_channels[i]; }drivers/media/pci/cx25821/cx25821-core.c +0
-3-if (dev->nr >1 ) -CX25821_INFO ("dev->nr > 1!" ); -/* board config */
dev->board= 1; /* card[dev->nr]; */
dev->_max_num_decoders=MAX_DECODERS;
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 234/268] enic: enable rq before updating rq descriptors
In reply to Ben HutchingsQuoted 18 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit
e8588e268509292550634d9a35f2723a207683b2][...]
Quoted 2 lines
drivers/net/ethernet/cisco/enic/enic_main.c +0
-0[...]
Quoted 4 lines
drivers/net/ethernet/cisco/enic/enic_main.c +0
-0@@ -1765,8 +1765,12 @@ static int enic_open(struct net_device * > return 0;
Quoted 11 lines
drivers/net/ethernet/cisco/enic/enic_main.c static int enic_open(struct net_device * · line 1771
Quoted 6 lines
drivers/net/ethernet/cisco/enic/enic_main.c +4
-1err_out_free_rq: -for (i =0 ; i < enic->rq_count; i++) +for (i =0 ; i < enic->rq_count; i++) { + err =vnic_rq_disable (&enic->rq[i]); +if (err) +return err;This added code is wrong: it overwrites the error code that was previously in err. If
vnic_rq_disable()succeeds,enic_open()will wrongly return 0. Ifvnic_rq_disable()fails, I still don't think it makes sense to skip the remaining cleanup actins.
Good catch. Fixing it.
Re: [PATCH 4.4 173/268] sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
In reply to Steven RostedtQuoted 5 lines · Steven Rostedt
Although the change log is a bit ambiguous in if it is fixing an actual miss update, or if it is just quieting a false positive.
Davidlohr?
It fixes an update, not a false positive.
Thanks,
Davidlohr
PATCH 1/1 nvme-pci: initialize queue memory before interrupts
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
commit 161b8be2bd6abad250d4b3f674bdd5480f15beeb upstream.
A spurious interrupt before the nvme driver has initialized the completion queue may inadvertently cause the driver to believe it has a completion to process. This may result in a NULL dereference since the nvmeq's tags are not set at this point.
The patch initializes the host's CQ memory so that a spurious interrupt isn't mistaken for a real completion.
--- drivers/nvme/host/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +2 -2
@@ -1589,11 +1589,11 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)if (result <0 ) goto release_cq; +nvme_init_queue (nvmeq, qid); result =queue_request_irq (dev, nvmeq, nvmeq->irqname);if (result <0 ) goto release_sq; -nvme_init_queue (nvmeq, qid);return result; release_sq:
@@ -1797,6 +1797,7 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) goto free_nvmeq; nvmeq->cq_vector =0 ; +nvme_init_queue (nvmeq,0 ); result =queue_request_irq (dev, nvmeq, nvmeq->irqname);if (result) { nvmeq->cq_vector =-1 ;
@@ -3165,7 +3166,6 @@ static void nvme_probe_work(struct work_struct *work) goto disable; } -nvme_init_queue (dev->queues[0 ],0 ); result =nvme_alloc_admin_tags (dev);if (result) goto disable;
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomRe: [PATCH 4.4 059/268] xen-netfront: Fix race between device setup and open
In reply to Ben HutchingsQuoted 42 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
[ Upstream commit
f599c64fdf7d9c108e8717fb04bc41c680120da4][...]
Quoted 2 lines
drivers/net/xen-netfront.c +0
-0[...]
drivers/net/xen-netfront.c static int talk_to_netback(struct xenbus · line 1824
Quoted 2 lines
drivers/net/xen-netfront.c +0
-0@@ -1839,6 +1824,7 @@ static int talk_to_netback(struct xenbus goto out;This "goto out" is outside the locked section...
Quoted 15 lines
drivers/net/xen-netfront.c +2
-0} +rtnl_lock (); if (info->queues) xennet_destroy_queues(info);@@ -1849,6 +1835,7 @@ static int talk_to_netback(struct xenbus info->queues = NULL; goto out; } +rtnl_unlock (); /* Create shared ring, alloc event channel -- for each queue */ for (i = 0; i < num_queues; ++i) {drivers/net/xen-netfront.c abort_transaction_no_dev_fatal: · line 1938
Quoted 7 lines
drivers/net/xen-netfront.c +2
-0@@ -1945,8 +1932,10 @@ abort_transaction_no_dev_fatal: xenbus_transaction_end(xbt, 1); destroy_ring: xennet_disconnect_backend(info); +rtnl_lock (); xennet_destroy_queues(info); out: +rtnl_unlock ();...so this will be an unmatched unlock.
Quoted 2 lines
You need to add another label below the
rtnl_unlock().
Thanks for spotting this. I've sent patches to the list to fix this and another issue with the original patch.
Regards,
Signature · 1 line
Ross Lagerwall
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4] nvme-pci: initialize queue memory before interrupts
In reply to Ben HutchingsQuoted 12 lines · Ben Hutchings
From: Keith Busch <[email protected]>
commit
161b8be2bd6abad250d4b3f674bdd5480f15beebupstream.A spurious interrupt before the nvme driver has initialized the completion queue may inadvertently cause the driver to believe it has a completion to process. This may result in a NULL dereference since the nvmeq's tags are not set at this point.
The patch initializes the host's CQ memory so that a spurious interrupt isn't mistaken for a real completion.
Quoted 8 lines
Signed-off-by Keith Busch <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>[bwh: Backported to 4.4: adjust context]Signed-off-by Jens Axboe <[email protected]>--- drivers/nvme/host/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Now applied, thanks.
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 229/268] media: cx23885: Set subdev host data to clk_freq pointer
In reply to Ben HutchingsQuoted 17 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
4.4-stable review patch.��If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
Quoted 7 lines
[ Upstream commit
5ceade1d97fc6687e050c44c257382c192f56276]Currently
clk_freqis ignored entirely, because the cx235840 driver configures the xtal at the chip defaults. This is an issue if a board is produced with a non-default frequency crystal. Ifclk_freqis not zero the cx25840 will attempt to use the setting provided, or fall back to defaults otherwise.This depends on (at least):
Quoted 7 lines
commit
3ee9bc12342cf546313d300808ff47d7dbb8e7dbAuthor: Brad Love <[email protected]> Date: Tue Mar 6 14:15:34 2018 -0500media: cx25840: Use subdev host data for PLL override
Ben.
Good catch, now queued up.
greg k-h