4.14.157-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 165/211 KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit a78986aae9b2988f8493f9f65a587ee433e83bc3 upstream.
Explicitly exempt ZONE_DEVICE pages from kvm_is_reserved_pfn() and instead manually handle ZONE_DEVICE on a case-by-case basis. For things like page refcounts, KVM needs to treat ZONE_DEVICE pages like normal pages, e.g. put pages grabbed via gup(). But for flows such as setting A/D bits or shifting refcounts for transparent huge pages, KVM needs to to avoid processing ZONE_DEVICE pages as the flows in question lack the underlying machinery for proper handling of ZONE_DEVICE pages.
This fixes a hang reported by Adam Borowski[*] in dev_pagemap_cleanup() when running a KVM guest backed with /dev/dax memory, as KVM straight up doesn't put any references to ZONE_DEVICE pages acquired by gup().
Note, Dan Williams proposed an alternative solution of doing put_page() on ZONE_DEVICE pages immediately after gup() in order to simplify the auditing needed to ensure is_zone_device_page() is called if and only if the backing device is pinned (via gup()). But that approach would break kvm_vcpu_{un}map() as KVM requires the page to be pinned from map() 'til unmap() when accessing guest memory, unlike KVM's secondary MMU, which coordinates with mmu_notifier invalidations to avoid creating stale page references, i.e. doesn't rely on pages being pinned.
[*] http://lkml.kernel.org/r/[email protected]
--- arch/x86/kvm/mmu.c | 8 ++++---- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 26 +++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu.c +4 -4
@@ -3177,7 +3177,7 @@ static void transparent_hugepage_adjust(* here. */ if (!is_error_noslot_pfn (pfn) && !kvm_is_reserved_pfn (pfn) && - level ==PT_PAGE_TABLE_LEVEL && + !kvm_is_zone_device_pfn (pfn) && level ==PT_PAGE_TABLE_LEVEL &&PageTransCompoundMap (pfn_to_page (pfn)) && !mmu_gfn_lpage_is_disallowed (vcpu, gfn,PT_DIRECTORY_LEVEL )) {unsigned long mask;
@@ -5344,9 +5344,9 @@ restart:* the guest, and the guest page table is using 4K page size * mapping if the indirect sp has level = 1. */ -if (sp->role.direct && - !kvm_is_reserved_pfn (pfn) && -PageTransCompoundMap (pfn_to_page (pfn))) { +if (sp->role.direct && !kvm_is_reserved_pfn (pfn) && + !kvm_is_zone_device_pfn (pfn) && +PageTransCompoundMap (pfn_to_page (pfn))) {drop_spte (kvm, sptep); need_tlb_flush =1 ; goto restart;
include/linux/kvm_host.h +1 -0
@@ -890,6 +890,7 @@ int kvm_cpu_has_pending_timer(struct kvmvoid kvm_vcpu_kick (struct kvm_vcpu *vcpu);bool kvm_is_reserved_pfn (kvm_pfn_t pfn); +bool kvm_is_zone_device_pfn (kvm_pfn_t pfn);struct kvm_irq_ack_notifier {struct hlist_node link;
virt/kvm/kvm_main.c +23 -3
@@ -142,10 +142,30 @@ __weak void kvm_arch_mmu_notifier_invali { } +bool kvm_is_zone_device_pfn (kvm_pfn_t pfn) +{ +/* +* The metadata used by is_zone_device_page() to determine whether or +* not a page is ZONE_DEVICE is guaranteed to be valid if and only if +* the device has been pinned, e.g. by get_user_pages(). WARN if the +* page_count() is zero to help detect bad usage of this helper. +*/ +if (!pfn_valid (pfn) ||WARN_ON_ONCE (!page_count (pfn_to_page (pfn)))) +return false; + +return is_zone_device_page (pfn_to_page (pfn)); +} +bool kvm_is_reserved_pfn (kvm_pfn_t pfn) { +/* +* ZONE_DEVICE pages currently set PG_reserved, but from a refcounting +* perspective they are "normal" pages, albeit with slightly different +* usage rules. +*/ if (pfn_valid (pfn)) -return PageReserved (pfn_to_page (pfn)); +return PageReserved (pfn_to_page (pfn)) && + !kvm_is_zone_device_pfn (pfn);return true; }
@@ -1730,7 +1750,7 @@ static void kvm_release_pfn_dirty(kvm_pfvoid kvm_set_pfn_dirty (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn)) { +if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn)) {struct page *page =pfn_to_page (pfn);if (!PageReserved (page))
@@ -1741,7 +1761,7 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty);void kvm_set_pfn_accessed (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn)) +if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn))mark_page_accessed (pfn_to_page (pfn)); }EXPORT_SYMBOL_GPL (kvm_set_pfn_accessed);
Greg Kroah-Hartman
maintainerPATCH 166/211 ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe
In reply to Greg Kroah-HartmanFrom: Hui Peng <[email protected]>
commit bfd6e6e6c5d2ee43a3d9902b36e01fc7527ebb27 upstream.
The ar_usb field of ath10k_usb_pipe_usb_pipe objects are initialized to point to the containing ath10k_usb object according to endpoint descriptors read from the device side, as shown below in ath10k_usb_setup_pipe_resources:
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
// get the address from endpoint descriptor
pipe_num = ath10k_usb_get_logical_pipe_num(ar_usb,
endpoint->bEndpointAddress,
&urbcount);
......
// select the pipe object
pipe = &ar_usb->pipes[pipe_num];
// initialize the ar_usb field
pipe->ar_usb = ar_usb;
}The driver assumes that the addresses reported in endpoint descriptors from device side to be complete. If a device is malicious and does not report complete addresses, it may trigger NULL-ptr-deref ath10k_usb_alloc_urb_from_pipe and ath10k_usb_free_urb_to_pipe.
This patch fixes the bug by preventing potential NULL-ptr-deref.
--- drivers/net/wireless/ath/ath10k/usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath10k/usb.c +8 -0
@@ -49,6 +49,10 @@ ath10k_usb_alloc_urb_from_pipe(struct atstruct ath10k_urb_context *urb_context =NULL ;unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return NULL ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags);if (!list_empty (&pipe->urb_list_head)) { urb_context = list_first_entry(&pipe->urb_list_head,
@@ -66,6 +70,10 @@ static void ath10k_usb_free_urb_to_pipe( {unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags); pipe->urb_cnt++;
Greg Kroah-Hartman
maintainerPATCH 167/211 ath9k_hw: fix uninitialized variable data
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit 80e84f36412e0c5172447b6947068dca0d04ee82 upstream.
Currently, data variable in ar9003_hw_thermo_cal_apply() could be uninitialized if ar9300_otp_read_word() will fail to read the value. Initialize data variable with 0 to prevent an undefined behavior. This will be enough to handle error case when ar9300_otp_read_word() fails.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -4116,7 +4116,7 @@ static void ar9003_hw_thermometer_apply(static void ar9003_hw_thermo_cal_apply (struct ath_hw *ah) { -u32 data, ko, kg; +u32 data =0 , ko, kg;if (!AR_SREV_9462_20_OR_LATER (ah))return ;
Greg Kroah-Hartman
maintainerPATCH 168/211 md/raid10: prevent access of uninitialized resync_pages offset
In reply to Greg Kroah-HartmanFrom: John Pittman <[email protected]>
commit 45422b704db392a6d79d07ee3e3670b11048bd53 upstream.
Due to unneeded multiplication in the out_free_pages portion of r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is possible to access a resync_pages offset that has not been initialized. This access translates into a crash of the system within resync_free_pages() while passing a bad pointer to put_page(). Remove the multiplication, preventing access to the uninitialized area.
--- drivers/md/raid10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid10.c +1 -1
@@ -226,7 +226,7 @@ static void * r10buf_pool_alloc(gfp_t gf out_free_pages:while (--j >=0 ) -resync_free_pages (&rps[j *2 ]); +resync_free_pages (&rps[j]); j =0 ; out_free_bio:
Greg Kroah-Hartman
maintainerPATCH 170/211 net: phy: dp83867: fix speed 10 in sgmii mode
In reply to Greg Kroah-HartmanFrom: Max Uvarov <[email protected]>
commit 333061b924539c0de081339643f45514f5f1c1e6 upstream.
For supporting 10Mps speed in SGMII mode DP83867_10M_SGMII_RATE_ADAPT bit of DP83867_10M_SGMII_CFG register has to be cleared by software. That does not affect speeds 100 and 1000 so can be done on init.
--- drivers/net/phy/dp83867.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/phy/dp83867.c +19 -0
@@ -37,6 +37,8 @@#define DP83867_STRAP_STS1 0x006E#define DP83867_RGMIIDCTL 0x0086#define DP83867_IO_MUX_CFG 0x0170 +#define DP83867_10M_SGMII_CFG 0x016F +#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7)#define DP83867_SW_RESET BIT(15)#define DP83867_SW_RESTART BIT(14)
@@ -283,6 +285,23 @@ static int dp83867_config_init(struct ph } } +if (phydev->interface ==PHY_INTERFACE_MODE_SGMII ) { +/* For support SPEED_10 in SGMII mode +* DP83867_10M_SGMII_RATE_ADAPT bit +* has to be cleared by software. That +* does not affect SPEED_100 and +* SPEED_1000. +*/ + val =phy_read_mmd (phydev,DP83867_DEVADDR , +DP83867_10M_SGMII_CFG ); + val &= ~DP83867_10M_SGMII_RATE_ADAPT_MASK ; + ret =phy_write_mmd (phydev,DP83867_DEVADDR , +DP83867_10M_SGMII_CFG , val); + +if (ret) +return ret; + } +/* Enable Interrupt output INT_OE in CFG3 register */ if (phy_interrupt_is_valid (phydev)) { val =phy_read (phydev,DP83867_CFG3 );
Greg Kroah-Hartman
maintainerPATCH 171/211 net: phy: dp83867: increase SGMII autoneg timer duration
In reply to Greg Kroah-HartmanFrom: Max Uvarov <[email protected]>
commit 1a97a477e666cbdededab93bd3754e508f0c09d7 upstream.
After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 are 01). That is not enough to finalize autonegatiation on some devices. Increase this timer duration to maximum supported 16ms.
--- drivers/net/phy/dp83867.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/phy/dp83867.c +18 -0
@@ -33,6 +33,12 @@/* Extended Registers */ #define DP83867_CFG4 0x0031 +#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6)) +#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5) +#define DP83867_RGMIICTL 0x0032#define DP83867_STRAP_STS1 0x006E#define DP83867_RGMIIDCTL 0x0086
@@ -300,6 +306,18 @@ static int dp83867_config_init(struct phif (ret)return ret; + +/* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 +* are 01). That is not enough to finalize autoneg on some +* devices. Increase this timer duration to maximum 16ms. +*/ + val =phy_read_mmd (phydev,DP83867_DEVADDR ,DP83867_CFG4 ); + val &= ~DP83867_CFG4_SGMII_ANEG_MASK ; + val |=DP83867_CFG4_SGMII_ANEG_TIMER_16MS ; + ret =phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_CFG4 , val); + +if (ret) +return ret; }/* Enable Interrupt output INT_OE in CFG3 register */
Greg Kroah-Hartman
maintainerPATCH 172/211 arm64: fix for bad_mode() handler to always result in panic
In reply to Greg Kroah-HartmanFrom: Hari Vyas <[email protected]>
commit e4ba15debcfd27f60d43da940a58108783bff2a6 upstream.
The bad_mode() handler is called if we encounter an uunknown exception, with the expectation that the subsequent call to panic() will halt the system. Unfortunately, if the exception calling bad_mode() is taken from EL0, then the call to die() can end up killing the current user task and calling schedule() instead of falling through to panic().
Remove the die() call altogether, since we really want to bring down the machine in this "impossible" case.
--- arch/arm64/kernel/traps.c | 1 - 1 file changed, 1 deletion(-)
arch/arm64/kernel/traps.c +0 -1
@@ -648,7 +648,6 @@ asmlinkage void bad_mode(struct pt_regs handler[reason],smp_processor_id (), esr, esr_get_class_string(esr)); -die ("Oops - bad mode" , regs,0 );local_irq_disable ();panic ("bad mode" ); }
Greg Kroah-Hartman
maintainerPATCH 173/211 cpufreq: Skip cpufreq resume if its not suspended
In reply to Greg Kroah-HartmanFrom: Bo Yan <[email protected]>
commit 703cbaa601ff3fb554d1246c336ba727cc083ea0 upstream.
cpufreq_resume can be called even without preceding cpufreq_suspend. This can happen in following scenario:
suspend_devices_and_enter
--> dpm_suspend_start
--> dpm_prepare
--> device_prepare : this function errors out
--> dpm_suspend: this is skipped due to dpm_prepare failure
this means cpufreq_suspend is skipped over
--> goto Recover_platform, due to previous error
--> goto Resume_devices
--> dpm_resume_end
--> dpm_resume
--> cpufreq_resumeIn case schedutil is used as frequency governor, cpufreq_resume will eventually call sugov_start, which does following:
memset(sg_cpu, 0, sizeof(*sg_cpu));
....This effectively erases function pointer for frequency update, causing crash later on. The function pointer would have been set correctly if subsequent cpufreq_add_update_util_hook runs successfully, but that function returns earlier because cpufreq_suspend was not called:
if (WARN_ON(per_cpu(cpufreq_update_util_data, cpu)))
return;
The fix is to check cpufreq_suspended first, if it's false, that means cpufreq_suspend was not called in the first place, so do not resume cpufreq.
--- drivers/cpufreq/cpufreq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/cpufreq/cpufreq.c +3 -0
@@ -1673,6 +1673,9 @@ void cpufreq_resume(void)if (!cpufreq_driver)return ; +if (unlikely (!cpufreq_suspended)) +return ; + cpufreq_suspended = false;if (!has_target () && !cpufreq_driver->resume)
Greg Kroah-Hartman
maintainerPATCH 174/211 ocfs2: remove ocfs2_is_o2cb_active()
In reply to Greg Kroah-HartmanFrom: Gang He <[email protected]>
commit a634644751c46238df58bbfe992e30c1668388db upstream.
Remove ocfs2_is_o2cb_active(). We have similar functions to identify which cluster stack is being used via osb->osb_cluster_stack.
Secondly, the current implementation of ocfs2_is_o2cb_active() is not totally safe. Based on the design of stackglue, we need to get ocfs2_stack_lock before using ocfs2_stack related data structures, and that active_stack pointer can be NULL in the case of mount failure.
--- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/stackglue.c | 6 ------ fs/ocfs2/stackglue.h | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-)
fs/ocfs2/dlmglue.c +1 -1
@@ -3422,7 +3422,7 @@ static int ocfs2_downconvert_lock(struct* we can recover correctly from node failure. Otherwise, we may get * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. */ -if (!ocfs2_is_o2cb_active () && +if (ocfs2_userspace_stack (osb) && lockres->l_ops->flags &LOCK_TYPE_USES_LVB ) lvb =1 ;
fs/ocfs2/stackglue.c +0 -6
@@ -48,12 +48,6 @@ static char ocfs2_hb_ctl_path[OCFS2_MAX_*/ static struct ocfs2_stack_plugin *active_stack; -inline int ocfs2_is_o2cb_active (void ) -{ -return !strcmp (active_stack->sp_name,OCFS2_STACK_PLUGIN_O2CB ); -} -EXPORT_SYMBOL_GPL (ocfs2_is_o2cb_active); -static struct ocfs2_stack_plugin *ocfs2_stack_lookup (const char *name) {struct ocfs2_stack_plugin *p;
fs/ocfs2/stackglue.h +0 -3
@@ -298,9 +298,6 @@ void ocfs2_stack_glue_set_max_proto_versint ocfs2_stack_glue_register (struct ocfs2_stack_plugin *plugin);void ocfs2_stack_glue_unregister (struct ocfs2_stack_plugin *plugin); -/* In ocfs2_downconvert_lock(), we need to know which stack we are using */ -int ocfs2_is_o2cb_active (void ); -extern struct kset *ocfs2_kset;#endif /* STACKGLUE_H */
Greg Kroah-Hartman
maintainerPATCH 175/211 ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary
In reply to Greg Kroah-HartmanFrom: Chester Lin <[email protected]>
commit 1d31999cf04c21709f72ceb17e65b54a401330da upstream.
adjust_lowmem_bounds() checks every memblocks in order to find the boundary between lowmem and highmem. However some memblocks could be marked as NOMAP so they are not used by kernel, which should be skipped while calculating the boundary.
--- arch/arm/mm/mmu.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mm/mmu.c +3 -0
@@ -1195,6 +1195,9 @@ void __init adjust_lowmem_bounds(void)phys_addr_t block_start = reg->base;phys_addr_t block_end = reg->base + reg->size; +if (memblock_is_nomap (reg)) +continue ; +if (reg->base < vmalloc_limit) {if (block_end > lowmem_limit)/*
Greg Kroah-Hartman
maintainerPATCH 176/211 ARC: perf: Accommodate big-endian CPU
In reply to Greg Kroah-HartmanFrom: Alexey Brodkin <[email protected]>
commit 5effc09c4907901f0e71e68e5f2e14211d9a203f upstream.
8-letter strings representing ARC perf events are stores in two 32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.
And the same order of bytes in the word is used regardless CPU endianness.
Which means in case of big-endian CPU core we need to swap bytes to get the same order as if it was on little-endian CPU.
Otherwise we're seeing the following error message on boot:
------------------------->8----------------------
ARC perf : 8 counters (32 bits), 40 conditions, [overflow IRQ support]
sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3 Stack Trace: arc_unwind_core+0xd4/0xfc dump_stack+0x64/0x80 sysfs_warn_dup+0x46/0x58 sysfs_add_file_mode_ns+0xb2/0x168 create_files+0x70/0x2a0 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 perf_event_sysfs_init+0x70/0xa0 Failed to register pmu: arc_pct, reason -17 Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3 Stack Trace: arc_unwind_core+0xd4/0xfc dump_stack+0x64/0x80 __warn+0x9c/0xd4 warn_slowpath_fmt+0x22/0x2c perf_event_sysfs_init+0x70/0xa0 ---[ end trace a75fb9a9837bd1ec ]---
------------------------->8----------------------
What happens here we're trying to register more than one raw perf event with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters and encoded into two 32-bit words. In this particular case we deal with 2 events:
* "IJMP____" which counts all jump & branch instructions
* "IJMPC___" which counts only conditional jumps & branches
Those strings are split in two 32-bit words this way "IJMP" + "____" & "IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core being big-endian then we read "PMJI" + "____" & "PMJI" + "___C".
And since we interpret read array of ASCII letters as a null-terminated string on big-endian CPU we end up with 2 events of the same name "PMJI".
--- arch/arc/kernel/perf_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/kernel/perf_event.c +2 -2
@@ -488,8 +488,8 @@ static int arc_pmu_device_probe(struct p/* loop thru all available h/w condition indexes */ for (j =0 ; j < cc_bcr.c; j++) {write_aux_reg (ARC_REG_CC_INDEX , j); - cc_name.indiv.word0 =read_aux_reg (ARC_REG_CC_NAME0 ); - cc_name.indiv.word1 =read_aux_reg (ARC_REG_CC_NAME1 ); + cc_name.indiv.word0 =le32_to_cpu (read_aux_reg (ARC_REG_CC_NAME0 )); + cc_name.indiv.word1 =le32_to_cpu (read_aux_reg (ARC_REG_CC_NAME1 ));/* See if it has been mapped to a perf event_id */ for (i =0 ; i <ARRAY_SIZE (arc_pmu_ev_hw_map); i++) {
Greg Kroah-Hartman
maintainerPATCH 177/211 x86/insn: Fix awk regexp warnings
In reply to Greg Kroah-HartmanFrom: Alexander Kapshuk <[email protected]>
commit 700c1018b86d0d4b3f1f2d459708c0cdf42b521d upstream.
gawk 5.0.1 generates the following regexp warnings:
GEN /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c
awk: ../arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
awk: ../arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=../arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is not a known regexp operator
Ealier versions of gawk are not known to generate these warnings. The gawk manual referenced below does not list characters ':' and '&' as needing escaping, so 'unescape' them. See
https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences.html
for more info.
Running diff on the output generated by the script before and after applying the patch reported no differences.
[ bp: Massage commit message. ]
--- arch/x86/tools/gen-insn-attr-x86.awk | 4 ++-- tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/tools/gen-insn-attr-x86.awk +2 -2
@@ -69,7 +69,7 @@ BEGIN { lprefix1_expr = "\\((66|!F3)\\)" lprefix2_expr = "\\(F3\\)" - lprefix3_expr = "\\((F2|!F3|66\\&F2)\\)" + lprefix3_expr = "\\((F2|!F3|66&F2)\\)" lprefix_expr = "\\((66|F2|F3)\\)" max_lprefix = 4
@@ -257,7 +257,7 @@ function convert_operands(count,opnd, return add_flags(imm, mod) } -/^[0-9a-f]+\:/ { +/^[0-9a-f]+:/ { if (NR == 1) next # get index
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk +2 -2
@@ -69,7 +69,7 @@ BEGIN { lprefix1_expr = "\\((66|!F3)\\)" lprefix2_expr = "\\(F3\\)" - lprefix3_expr = "\\((F2|!F3|66\\&F2)\\)" + lprefix3_expr = "\\((F2|!F3|66&F2)\\)" lprefix_expr = "\\((66|F2|F3)\\)" max_lprefix = 4
@@ -257,7 +257,7 @@ function convert_operands(count,opnd, return add_flags(imm, mod) } -/^[0-9a-f]+\:/ { +/^[0-9a-f]+:/ { if (NR == 1) next # get index
Greg Kroah-Hartman
maintainerPATCH 178/211 x86/speculation: Fix incorrect MDS/TAA mitigation status
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit 64870ed1b12e235cfca3f6c6da75b542c973ff78 upstream.
For MDS vulnerable processors with TSX support, enabling either MDS or TAA mitigations will enable the use of VERW to flush internal processor buffers at the right code path. IOW, they are either both mitigated or both not. However, if the command line options are inconsistent, the vulnerabilites sysfs files may not report the mitigation status correctly.
For example, with only the "mds=off" option:
vulnerabilities/mds:Vulnerable; SMT vulnerable vulnerabilities/tsx_async_abort:Mitigation: Clear CPU buffers; SMT vulnerable
The mds vulnerabilities file has wrong status in this case. Similarly, the taa vulnerability file will be wrong with mds mitigation on, but taa off.
Change taa_select_mitigation() to sync up the two mitigation status and have them turned off if both "mds=off" and "tsx_async_abort=off" are present.
Update documentation to emphasize the fact that both "mds=off" and "tsx_async_abort=off" have to be specified together for processors that are affected by both TAA and MDS to be effective.
[ bp: Massage and add kernel-parameters.txt change too. ]
--- Documentation/admin-guide/hw-vuln/mds.rst | 7 +++++-- Documentation/admin-guide/hw-vuln/tsx_async_abort.rst | 5 ++++- Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ arch/x86/kernel/cpu/bugs.c | 17 +++++++++++++++-- 4 files changed, 35 insertions(+), 5 deletions(-)
Documentation/admin-guide/hw-vuln/mds.rst +5 -2
@@ -265,8 +265,11 @@ time with the option "mds=". The valid a ============ ============================================================= -Not specifying this option is equivalent to "mds=full". - +Not specifying this option is equivalent to "mds=full". For processors +that are affected by both TAA (TSX Asynchronous Abort) and MDS, +specifying just "mds=off" without an accompanying "tsx_async_abort=off" +will have no effect as the same mitigation is used for both +vulnerabilities. Mitigation selection guide --------------------------
Documentation/admin-guide/hw-vuln/tsx_async_abort.rst +4 -1
@@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid CPU is not vulnerable to cross-thread TAA attacks. ============ ============================================================= -Not specifying this option is equivalent to "tsx_async_abort=full". +Not specifying this option is equivalent to "tsx_async_abort=full". For +processors that are affected by both TAA and MDS, specifying just +"tsx_async_abort=off" without an accompanying "mds=off" will have no +effect as the same mitigation is used for both vulnerabilities. The kernel command line also allows to control the TSX feature using the parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used
Documentation/admin-guide/kernel-parameters.txt +11 -0
@@ -2254,6 +2254,12 @@ SMT on vulnerable CPUs off - Unconditionally disable MDS mitigation + On TAA-affected machines, mds=off can be prevented by + an active TAA mitigation as both vulnerabilities are + mitigated with the same mechanism so in order to disable + this mitigation, you need to specify tsx_async_abort=off + too. + Not specifying this option is equivalent to mds=full.
@@ -4588,6 +4594,11 @@ vulnerable to cross-thread TAA attacks. off - Unconditionally disable TAA mitigation + On MDS-affected machines, tsx_async_abort=off can be + prevented by an active MDS mitigation as both vulnerabilities + are mitigated with the same mechanism so in order to disable + this mitigation, you need to specify mds=off too. + Not specifying this option is equivalent to tsx_async_abort=full. On CPUs which are MDS affected and deploy MDS mitigation, TAA mitigation is not
arch/x86/kernel/cpu/bugs.c +15 -2
@@ -304,8 +304,12 @@ static void __init taa_select_mitigationreturn ; } -/* TAA mitigation is turned off on the cmdline (tsx_async_abort=off) */ -if (taa_mitigation ==TAA_MITIGATION_OFF ) +/* +* TAA mitigation via VERW is turned off if both +* tsx_async_abort=off and mds=off are specified. +*/ +if (taa_mitigation ==TAA_MITIGATION_OFF && + mds_mitigation ==MDS_MITIGATION_OFF ) goto out;if (boot_cpu_has (X86_FEATURE_MD_CLEAR ))
@@ -339,6 +343,15 @@ static void __init taa_select_mitigationif (taa_nosmt ||cpu_mitigations_auto_nosmt ())cpu_smt_disable (false); +/* +* Update MDS mitigation, if necessary, as the mds_user_clear is +* now enabled for TAA mitigation. +*/ +if (mds_mitigation ==MDS_MITIGATION_OFF && +boot_cpu_has_bug (X86_BUG_MDS )) { + mds_mitigation =MDS_MITIGATION_FULL ; +mds_select_mitigation (); + } out:pr_info ("%s\n" , taa_strings[taa_mitigation]); }
Greg Kroah-Hartman
maintainerPATCH 179/211 x86/speculation: Fix redundant MDS mitigation message
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit cd5a2aa89e847bdda7b62029d94e95488d73f6b2 upstream.
Since MDS and TAA mitigations are inter-related for processors that are affected by both vulnerabilities, the followiing confusing messages can be printed in the kernel log:
MDS: Vulnerable
MDS: Mitigation: Clear CPU buffers
To avoid the first incorrect message, defer the printing of MDS mitigation after the TAA mitigation selection has been done. However, that has the side effect of printing TAA mitigation first before MDS mitigation.
[ bp: Check box is affected/mitigations are disabled first before
printing and massage. ]
--- arch/x86/kernel/cpu/bugs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/kernel/cpu/bugs.c +13 -0
@@ -39,6 +39,7 @@ static void __init spectre_v2_select_mitstatic void __init ssb_select_mitigation (void );static void __init l1tf_select_mitigation (void );static void __init mds_select_mitigation (void ); +static void __init mds_print_mitigation (void );static void __init taa_select_mitigation (void );/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
@@ -108,6 +109,12 @@ void __init check_bugs(void)mds_select_mitigation ();taa_select_mitigation (); +/* +* As MDS and TAA mitigations are inter-related, print MDS +* mitigation until after TAA mitigation selection is done. +*/ +mds_print_mitigation (); +arch_smt_update ();#ifdef CONFIG_X86_32
@@ -245,6 +252,12 @@ static void __init mds_select_mitigation (mds_nosmt || cpu_mitigations_auto_nosmt()))cpu_smt_disable (false); } +} + +static void __init mds_print_mitigation (void ) +{ +if (!boot_cpu_has_bug (X86_BUG_MDS ) ||cpu_mitigations_off ()) +return ;pr_info ("%s\n" , mds_strings[mds_mitigation]); }
Greg Kroah-Hartman
maintainerPATCH 180/211 nbd: prevent memory leak
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 03bf73c315edca28f47451913177e14cd040a216 upstream.
In nbd_add_socket when krealloc succeeds, if nsock's allocation fail the reallocted memory is leak. The correct behaviour should be assigning the reallocted memory to config->socks right after success.
--- drivers/block/nbd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/nbd.c +3 -2
@@ -970,14 +970,15 @@ static int nbd_add_socket(struct nbd_devsockfd_put (sock);return -ENOMEM ; } + + config->socks = socks; + nsock =kzalloc (sizeof (struct nbd_sock ),GFP_KERNEL );if (!nsock) {sockfd_put (sock);return -ENOMEM ; } - config->socks = socks; - nsock->fallback_index =-1 ; nsock->dead = false;mutex_init (&nsock->tx_lock);
Greg Kroah-Hartman
maintainerPATCH 181/211 x86/doublefault/32: Fix stack canaries in the double fault handler
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 3580d0b29cab08483f84a16ce6a1151a1013695f upstream.
The double fault TSS was missing GS setup, which is needed for stack canaries to work.
--- arch/x86/kernel/doublefault.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/doublefault.c +3 -0
@@ -65,6 +65,9 @@ struct x86_hw_tss doublefault_tss __cach .ss = __KERNEL_DS, .ds = __USER_DS, .fs = __KERNEL_PERCPU, +#ifndef CONFIG_X86_32_LAZY_GS + .gs = __KERNEL_STACK_CANARY, +#endif .__cr3 = __pa_nodebug(swapper_pg_dir), };
Greg Kroah-Hartman
maintainerPATCH 182/211 x86/cpu_entry_area: Add guard page for entry stack on 32bit
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 880a98c339961eaa074393e3a2117cbe9125b8bb upstream.
The entry stack in the cpu entry area is protected against overflow by the readonly GDT on 64-bit, but on 32-bit the GDT needs to be writeable and therefore does not trigger a fault on stack overflow.
Add a guard page.
--- arch/x86/include/asm/cpu_entry_area.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/include/asm/cpu_entry_area.h +5 -1
@@ -20,8 +20,12 @@ struct cpu_entry_area {/* * The GDT is just below entry_stack and thus serves (on x86_64) as -* a a read-only guard page. +* a read-only guard page. On 32-bit the GDT must be writeable, so +* it needs an extra guard page. */ +#ifdef CONFIG_X86_32 +char guard_entry_stack[PAGE_SIZE ]; +#endif struct entry_stack_page entry_stack_page;/*
Greg Kroah-Hartman
maintainerPATCH 183/211 selftests/x86/mov_ss_trap: Fix the SYSENTER test
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 8caa016bfc129f2c925d52da43022171d1d1de91 upstream.
For reasons that I haven't quite fully diagnosed, running mov_ss_trap_32 on a 32-bit kernel results in an infinite loop in userspace. This appears to be because the hacky SYSENTER test doesn't segfault as desired; instead it corrupts the program state such that it infinite loops.
Fix it by explicitly clearing EBP before doing SYSENTER. This will give a more reliable segfault.
--- tools/testing/selftests/x86/mov_ss_trap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/mov_ss_trap.c +2 -1
@@ -257,7 +257,8 @@ int main()err (1 ,"sigaltstack" );sethandler (SIGSEGV , handle_and_longjmp,SA_RESETHAND |SA_ONSTACK ); nr = SYS_getpid; - asmvolatile ("mov %[ss], %%ss; SYSENTER" :"+a" (nr) +/* Clear EBP first to make sure we segfault cleanly. */ + asmvolatile ("xorl %%ebp, %%ebp; mov %[ss], %%ss; SYSENTER" :"+a" (nr) : [ss]"m" (ss) :"flags" ,"rcx" #ifdef __x86_64__ , "r11"
Greg Kroah-Hartman
maintainerPATCH 184/211 selftests/x86/sigreturn/32: Invalidate DS and ES when abusing the kernel
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 4d2fa82d98d2d296043a04eb517d7dbade5b13b8 upstream.
If the kernel accidentally uses DS or ES while the user values are loaded, it will work fine for sane userspace. In the interest of simulating maximally insane userspace, make sigreturn_32 zero out DS and ES for the nasty parts so that inadvertent use of these segments will crash.
--- tools/testing/selftests/x86/sigreturn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
tools/testing/selftests/x86/sigreturn.c +13 -0
@@ -459,6 +459,19 @@ static void sigusr1(int sig, siginfo_t * ctx->uc_mcontext.gregs[REG_SP ] = (unsigned long )0x8badf00d5aadc0deULL ; ctx->uc_mcontext.gregs[REG_CX ] =0 ; +#ifdef __i386__ +/* +* Make sure the kernel doesn't inadvertently use DS or ES-relative +* accesses in a region where user DS or ES is loaded. +* +* Skip this for 64-bit builds because long mode doesn't care about +* DS and ES and skipping it increases test coverage a little bit, +* since 64-bit kernels can still run the 32-bit build. +*/ + ctx->uc_mcontext.gregs[REG_DS ] =0 ; + ctx->uc_mcontext.gregs[REG_ES ] =0 ; +#endif +memcpy (&requested_regs, &ctx->uc_mcontext.gregs,sizeof (gregset_t)); requested_regs[REG_CX ] = *ssptr (ctx);/* The asm code does this. */
Greg Kroah-Hartman
maintainerPATCH 185/211 x86/pti/32: Calculate the various PTI cpu_entry_area sizes correctly, make the CPU_ENTRY_AREA_PAGES assert precise
In reply to Greg Kroah-HartmanFrom: Ingo Molnar <[email protected]>
commit 05b042a1944322844eaae7ea596d5f154166d68a upstream.
When two recent commits that increased the size of the 'struct cpu_entry_area' were merged in -tip, the 32-bit defconfig build started failing on the following build time assert:
./include/linux/compiler.h:391:38: error: call to ‘__compiletime_assert_189’ declared with attribute error: BUILD_BUG_ON failed: CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE arch/x86/mm/cpu_entry_area.c:189:2: note: in expansion of macro ‘BUILD_BUG_ON’
In function ‘setup_cpu_entry_area_ptes’,
Which corresponds to the following build time assert:
BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);
The purpose of this assert is to sanity check the fixed-value definition of CPU_ENTRY_AREA_PAGES arch/x86/include/asm/pgtable_32_types.h:
#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 41)
The '41' is supposed to match sizeof(struct cpu_entry_area)/PAGE_SIZE, which value we didn't want to define in such a low level header, because it would cause dependency hell.
Every time the size of cpu_entry_area is changed, we have to adjust CPU_ENTRY_AREA_PAGES accordingly - and this assert is checking that constraint.
But the assert is both imprecise and buggy, primarily because it doesn't include the single readonly IDT page that is mapped at CPU_ENTRY_AREA_BASE (which begins at a PMD boundary).
This bug was hidden by the fact that by accident CPU_ENTRY_AREA_PAGES is defined too large upstream (v5.4-rc8):
#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40)
While 'struct cpu_entry_area' is 155648 bytes, or 38 pages. So we had two extra pages, which hid the bug.
The following commit (not yet upstream) increased the size to 40 pages:
x86/iopl: ("Restrict iopl() permission scope")
... but increased CPU_ENTRY_AREA_PAGES only 41 - i.e. shortening the gap to just 1 extra page.
Then another not-yet-upstream commit changed the size again:
880a98c33996: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")
Which increased the cpu_entry_area size from 38 to 39 pages, but didn't change CPU_ENTRY_AREA_PAGES (kept it at 40). This worked fine, because we still had a page left from the accidental 'reserve'.
But when these two commits were merged into the same tree, the combined size of cpu_entry_area grew from 38 to 40 pages, while CPU_ENTRY_AREA_PAGES finally caught up to 40 as well.
Which is fine in terms of functionality, but the assert broke:
BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);
because CPU_ENTRY_AREA_MAP_SIZE is the total size of the area, which is 1 page larger due to the IDT page.
To fix all this, change the assert to two precise asserts:
BUILD_BUG_ON((CPU_ENTRY_AREA_PAGES+1)*PAGE_SIZE != CPU_ENTRY_AREA_MAP_SIZE); BUILD_BUG_ON(CPU_ENTRY_AREA_TOTAL_SIZE != CPU_ENTRY_AREA_MAP_SIZE);
This takes the IDT page into account, and also connects the size-based define of CPU_ENTRY_AREA_TOTAL_SIZE with the address-subtraction based define of CPU_ENTRY_AREA_MAP_SIZE.
Also clean up some of the names which made it rather confusing:
- 'CPU_ENTRY_AREA_TOT_SIZE' wasn't actually the 'total' size of the cpu-entry-area, but the per-cpu array size, so rename this to CPU_ENTRY_AREA_ARRAY_SIZE.
- Introduce CPU_ENTRY_AREA_TOTAL_SIZE that _is_ the total mapping size, with the IDT included.
- Add comments where '+1' denotes the IDT mapping - it wasn't obvious and took me about 3 hours to decode...
Finally, because this particular commit is actually applied after this patch:
880a98c33996: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")
Fix the CPU_ENTRY_AREA_PAGES value from 40 pages to the correct 39 pages.
All future commits that change cpu_entry_area will have to adjust this value precisely.
As a side note, we should probably attempt to remove CPU_ENTRY_AREA_PAGES and derive its value directly from the structure, without causing header hell - but that is an adventure for another day! :-)
--- arch/x86/include/asm/cpu_entry_area.h | 12 +++++++----- arch/x86/include/asm/pgtable_32_types.h | 8 ++++---- arch/x86/mm/cpu_entry_area.c | 4 +++- 3 files changed, 14 insertions(+), 10 deletions(-)
arch/x86/include/asm/cpu_entry_area.h +7 -5
@@ -45,7 +45,6 @@ struct cpu_entry_area {*/ char exception_stacks[(N_EXCEPTION_STACKS -1 ) *EXCEPTION_STKSZ +DEBUG_STKSZ ];#endif -#ifdef CONFIG_CPU_SUP_INTEL /* * Per CPU debug store for Intel performance monitoring. Wastes a * full page at the moment.
@@ -56,24 +55,27 @@ struct cpu_entry_area {* Reserve enough fixmap PTEs. */ struct debug_store_buffers cpu_debug_buffers; -#endif }; -#define CPU_ENTRY_AREA_SIZE (sizeof(struct cpu_entry_area)) -#define CPU_ENTRY_AREA_TOT_SIZE (CPU_ENTRY_AREA_SIZE * NR_CPUS) +#define CPU_ENTRY_AREA_SIZE (sizeof(struct cpu_entry_area)) +#define CPU_ENTRY_AREA_ARRAY_SIZE (CPU_ENTRY_AREA_SIZE * NR_CPUS) + +/* Total size includes the readonly IDT mapping page as well: */ +#define CPU_ENTRY_AREA_TOTAL_SIZE (CPU_ENTRY_AREA_ARRAY_SIZE + PAGE_SIZE) DECLARE_PER_CPU(struct cpu_entry_area *, cpu_entry_area);extern void setup_cpu_entry_areas (void );extern void cea_set_pte (void *cea_vaddr,phys_addr_t pa,pgprot_t flags); +/* Single page reserved for the readonly IDT mapping: */ #define CPU_ENTRY_AREA_RO_IDT CPU_ENTRY_AREA_BASE#define CPU_ENTRY_AREA_PER_CPU (CPU_ENTRY_AREA_RO_IDT + PAGE_SIZE)#define CPU_ENTRY_AREA_RO_IDT_VADDR ((void *)CPU_ENTRY_AREA_RO_IDT)#define CPU_ENTRY_AREA_MAP_SIZE \ - (CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_TOT_SIZE - CPU_ENTRY_AREA_BASE) + (CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_ARRAY_SIZE - CPU_ENTRY_AREA_BASE)extern struct cpu_entry_area *get_cpu_entry_area (int cpu);
arch/x86/include/asm/pgtable_32_types.h +4 -4
@@ -42,11 +42,11 @@ extern bool __vmalloc_start_set; /* set* Define this here and validate with BUILD_BUG_ON() in pgtable_32.c * to avoid include recursion hell */ -#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40) +#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 39) -#define CPU_ENTRY_AREA_BASE \ - ((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) \ - & PMD_MASK) +/* The +1 is for the readonly IDT page: */ +#define CPU_ENTRY_AREA_BASE \ + ((FIXADDR_TOT_START - PAGE_SIZE*(CPU_ENTRY_AREA_PAGES+1)) & PMD_MASK)#define PKMAP_BASE \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
arch/x86/mm/cpu_entry_area.c +3 -1
@@ -143,7 +143,9 @@ static __init void setup_cpu_entry_area_#ifdef CONFIG_X86_32 unsigned long start, end; -BUILD_BUG_ON (CPU_ENTRY_AREA_PAGES *PAGE_SIZE <CPU_ENTRY_AREA_MAP_SIZE ); +/* The +1 is for the readonly IDT: */ +BUILD_BUG_ON ((CPU_ENTRY_AREA_PAGES +1 )*PAGE_SIZE !=CPU_ENTRY_AREA_MAP_SIZE ); +BUILD_BUG_ON (CPU_ENTRY_AREA_TOTAL_SIZE !=CPU_ENTRY_AREA_MAP_SIZE );BUG_ON (CPU_ENTRY_AREA_BASE & ~PMD_MASK ); start =CPU_ENTRY_AREA_BASE ;
Greg Kroah-Hartman
maintainerPATCH 186/211 nfc: port100: handle command failure cleanly
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 5f9f0b11f0816b35867f2cf71e54d95f53f03902 upstream.
If starting the transfer of a command suceeds but the transfer for the reply fails, it is not enough to initiate killing the transfer for the command may still be running. You need to wait for the killing to finish before you can reuse URB and buffer.
--- drivers/nfc/port100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/port100.c +1 -1
@@ -792,7 +792,7 @@ static int port100_send_frame_async(stru rc =port100_submit_urb_for_ack (dev,GFP_KERNEL );if (rc) -usb_unlink_urb (dev->out_urb); +usb_kill_urb (dev->out_urb); exit:mutex_unlock (&dev->out_urb_lock);
Greg Kroah-Hartman
maintainerPATCH 187/211 net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
In reply to Greg Kroah-HartmanFrom: Jouni Hogander <[email protected]>
commit b8eb718348b8fb30b5a7d0a8fce26fb3f4ac741b upstream.
kobject_init_and_add takes reference even when it fails. This has to be given up by the caller in error handling. Otherwise memory allocated by kobject_init_and_add is never freed. Originally found by Syzkaller:
BUG: memory leak
unreferenced object 0xffff8880679f8b08 (size 8):
comm "netdev_register", pid 269, jiffies 4294693094 (age 12.132s)
hex dump (first 8 bytes):
72 78 2d 30 00 36 20 d4 rx-0.6 .
backtrace:
[<000000008c93818e>] __kmalloc_track_caller+0x16e/0x290
[<000000001f2e4e49>] kvasprintf+0xb1/0x140
[<000000007f313394>] kvasprintf_const+0x56/0x160
[<00000000aeca11c8>] kobject_set_name_vargs+0x5b/0x140
[<0000000073a0367c>] kobject_init_and_add+0xd8/0x170
[<0000000088838e4b>] net_rx_queue_update_kobjects+0x152/0x560
[<000000006be5f104>] netdev_register_kobject+0x210/0x380
[<00000000e31dab9d>] register_netdevice+0xa1b/0xf00
[<00000000f68b2465>] __tun_chr_ioctl+0x20d5/0x3dd0
[<000000004c50599f>] tun_chr_ioctl+0x2f/0x40
[<00000000bbd4c317>] do_vfs_ioctl+0x1c7/0x1510
[<00000000d4c59e8f>] ksys_ioctl+0x99/0xb0
[<00000000946aea81>] __x64_sys_ioctl+0x78/0xb0
[<0000000038d946e5>] do_syscall_64+0x16f/0x580
[<00000000e0aa5d8f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[<00000000285b3d1a>] 0xffffffffffffffff--- net/core/net-sysfs.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
net/core/net-sysfs.c +13 -11
@@ -915,21 +915,23 @@ static int rx_queue_add_kobject(struct n error =kobject_init_and_add (kobj, &rx_queue_ktype,NULL ,"rx-%u" , index);if (error) -return error; + goto err;dev_hold (queue->dev);if (dev->sysfs_rx_queue_group) { error =sysfs_create_group (kobj, dev->sysfs_rx_queue_group); -if (error) { -kobject_put (kobj); -return error; - } +if (error) + goto err; }kobject_uevent (kobj,KOBJ_ADD );return error; + +err: +kobject_put (kobj); + return error; }#endif /* CONFIG_SYSFS */
@@ -1326,21 +1328,21 @@ static int netdev_queue_add_kobject(stru error =kobject_init_and_add (kobj, &netdev_queue_ktype,NULL ,"tx-%u" , index);if (error) -return error; + goto err;dev_hold (queue->dev);#ifdef CONFIG_BQL error =sysfs_create_group (kobj, &dql_group); -if (error) { -kobject_put (kobj); -return error; - } +if (error) + goto err;#endif kobject_uevent (kobj,KOBJ_ADD ); - return 0; +err: +kobject_put (kobj); + return error; }#endif /* CONFIG_SYSFS */
Greg Kroah-Hartman
maintainerPATCH 188/211 media: vivid: Set vid_cap_streaming and vid_out_streaming to true
In reply to Greg Kroah-HartmanFrom: Vandana BN <[email protected]>
commit b4add02d2236fd5f568db141cfd8eb4290972eb3 upstream.
When vbi stream is started, followed by video streaming,
the vid_cap_streaming and vid_out_streaming were not being set to true, which would cause the video stream to stop when vbi stream is stopped. This patch allows to set vid_cap_streaming and vid_out_streaming to true. According to Hans Verkuil it appears that these 'if (dev->kthread_vid_cap)' checks are a left-over from the original vivid development and should never have been there.
--- drivers/media/platform/vivid/vivid-vid-cap.c | 3 --- drivers/media/platform/vivid/vivid-vid-out.c | 3 --- 2 files changed, 6 deletions(-)
drivers/media/platform/vivid/vivid-vid-cap.c +0 -3
@@ -239,9 +239,6 @@ static int vid_cap_start_streaming(strucif (vb2_is_streaming (&dev->vb_vid_out_q)) dev->can_loop_video =vivid_vid_can_loop (dev); -if (dev->kthread_vid_cap) -return 0 ; - dev->vid_cap_seq_count =0 ;dprintk (dev,1 ,"%s\n" , __func__);for (i =0 ; i <VIDEO_MAX_FRAME ; i++)
drivers/media/platform/vivid/vivid-vid-out.c +0 -3
@@ -158,9 +158,6 @@ static int vid_out_start_streaming(strucif (vb2_is_streaming (&dev->vb_vid_cap_q)) dev->can_loop_video =vivid_vid_can_loop (dev); -if (dev->kthread_vid_out) -return 0 ; - dev->vid_out_seq_count =0 ;dprintk (dev,1 ,"%s\n" , __func__);if (dev->start_streaming_error) {
Greg Kroah-Hartman
maintainerPATCH 189/211 media: vivid: Fix wrong locking that causes race conditions on streaming stop
In reply to Greg Kroah-HartmanFrom: Alexander Popov <[email protected]>
commit 6dcd5d7a7a29c1e4b8016a06aed78cd650cd8c27 upstream.
There is the same incorrect approach to locking implemented in vivid_stop_generating_vid_cap(), vivid_stop_generating_vid_out() and sdr_cap_stop_streaming().
These functions are called during streaming stopping with vivid_dev.mutex locked. And they all do the same mistake while stopping their kthreads, which need to lock this mutex as well. See the example from vivid_stop_generating_vid_cap():
/* shutdown control thread */
vivid_grab_controls(dev, false);
mutex_unlock(&dev->mutex); kthread_stop(dev->kthread_vid_cap);
dev->kthread_vid_cap = NULL;
mutex_lock(&dev->mutex);
But when this mutex is unlocked, another vb2_fop_read() can lock it instead of vivid_thread_vid_cap() and manipulate the buffer queue. That causes a use-after-free access later.
To fix those issues let's:
1. avoid unlocking the mutex in vivid_stop_generating_vid_cap(),vivid_stop_generating_vid_out() and sdr_cap_stop_streaming();
2. use mutex_trylock() with schedule_timeout_uninterruptible() in
the loops of the vivid kthread handlers.
--- drivers/media/platform/vivid/vivid-kthread-cap.c | 8 +++++--- drivers/media/platform/vivid/vivid-kthread-out.c | 8 +++++--- drivers/media/platform/vivid/vivid-sdr-cap.c | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-)
drivers/media/platform/vivid/vivid-kthread-cap.c +5 -3
@@ -777,7 +777,11 @@ static int vivid_thread_vid_cap(void *daif (kthread_should_stop ())break ; -mutex_lock (&dev->mutex); +if (!mutex_trylock (&dev->mutex)) { +schedule_timeout_uninterruptible (1 ); +continue ; + } + cur_jiffies = jiffies;if (dev->cap_seq_resync) { dev->jiffies_vid_cap = cur_jiffies;
@@ -930,8 +934,6 @@ void vivid_stop_generating_vid_cap(struc/* shutdown control thread */ vivid_grab_controls (dev, false); -mutex_unlock (&dev->mutex);kthread_stop (dev->kthread_vid_cap); dev->kthread_vid_cap =NULL ; -mutex_lock (&dev->mutex); }
drivers/media/platform/vivid/vivid-kthread-out.c +5 -3
@@ -147,7 +147,11 @@ static int vivid_thread_vid_out(void *daif (kthread_should_stop ())break ; -mutex_lock (&dev->mutex); +if (!mutex_trylock (&dev->mutex)) { +schedule_timeout_uninterruptible (1 ); +continue ; + } + cur_jiffies = jiffies;if (dev->out_seq_resync) { dev->jiffies_vid_out = cur_jiffies;
@@ -301,8 +305,6 @@ void vivid_stop_generating_vid_out(struc/* shutdown control thread */ vivid_grab_controls (dev, false); -mutex_unlock (&dev->mutex);kthread_stop (dev->kthread_vid_out); dev->kthread_vid_out =NULL ; -mutex_lock (&dev->mutex); }
drivers/media/platform/vivid/vivid-sdr-cap.c +5 -3
@@ -149,7 +149,11 @@ static int vivid_thread_sdr_cap(void *daif (kthread_should_stop ())break ; -mutex_lock (&dev->mutex); +if (!mutex_trylock (&dev->mutex)) { +schedule_timeout_uninterruptible (1 ); +continue ; + } + cur_jiffies = jiffies;if (dev->sdr_cap_seq_resync) { dev->jiffies_sdr_cap = cur_jiffies;
@@ -309,10 +313,8 @@ static void sdr_cap_stop_streaming(struc }/* shutdown control thread */ -mutex_unlock (&dev->mutex);kthread_stop (dev->kthread_sdr_cap); dev->kthread_sdr_cap =NULL ; -mutex_lock (&dev->mutex); }const struct vb2_ops vivid_sdr_cap_qops = {
Greg Kroah-Hartman
maintainerPATCH 190/211 media: usbvision: Fix races among open, close, and disconnect
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 9e08117c9d4efc1e1bc6fce83dab856d9fd284b6 upstream.
Visual inspection of the usbvision driver shows that it suffers from three races between its open, close, and disconnect handlers. In particular, the driver is careful to update its usbvision->user and usbvision->remove_pending flags while holding the private mutex, but:
usbvision_v4l2_close() and usbvision_radio_close() don't hold the mutex while they check the value of usbvision->remove_pending;
usbvision_disconnect() doesn't hold the mutex while checking the value of usbvision->user; and
also, usbvision_v4l2_open() and usbvision_radio_open() don't check whether the device has been unplugged before allowing the user to open the device files.
Each of these can potentially lead to usbvision_release() being called twice and use-after-free errors.
This patch fixes the races by reading the flags while the mutex is still held and checking for pending removes before allowing an open to succeed.
--- drivers/media/usb/usbvision/usbvision-video.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/media/usb/usbvision/usbvision-video.c +18 -3
@@ -328,6 +328,10 @@ static int usbvision_v4l2_open(struct fiif (mutex_lock_interruptible (&usbvision->v4l2_lock))return -ERESTARTSYS ; +if (usbvision->remove_pending) { + err_code = -ENODEV ; + goto unlock; + }if (usbvision->user) { err_code = -EBUSY ; }else {
@@ -391,6 +395,7 @@ unlock:static int usbvision_v4l2_close (struct file *file) {struct usb_usbvision *usbvision =video_drvdata (file); +int r;PDEBUG (DBG_IO ,"close" );
@@ -405,9 +410,10 @@ static int usbvision_v4l2_close(struct fusbvision_scratch_free (usbvision); usbvision->user--; + r = usbvision->remove_pending;mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->remove_pending) { +if (r) {printk (KERN_INFO "%s: Final disconnect\n" , __func__);usbvision_release (usbvision);return 0 ;
@@ -1091,6 +1097,11 @@ static int usbvision_radio_open(struct fif (mutex_lock_interruptible (&usbvision->v4l2_lock))return -ERESTARTSYS ; + +if (usbvision->remove_pending) { + err_code = -ENODEV ; + goto out; + } err_code =v4l2_fh_open (file);if (err_code) goto out;
@@ -1123,6 +1134,7 @@ out:static int usbvision_radio_close (struct file *file) {struct usb_usbvision *usbvision =video_drvdata (file); +int r;PDEBUG (DBG_IO ,"" );
@@ -1135,9 +1147,10 @@ static int usbvision_radio_close(structusbvision_audio_off (usbvision); usbvision->radio =0 ; usbvision->user--; + r = usbvision->remove_pending;mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->remove_pending) { +if (r) {printk (KERN_INFO "%s: Final disconnect\n" , __func__);v4l2_fh_release (file);usbvision_release (usbvision);
@@ -1562,6 +1575,7 @@ err_usb:static void usbvision_disconnect (struct usb_interface *intf) {struct usb_usbvision *usbvision =to_usbvision (usb_get_intfdata (intf)); +int u;PDEBUG (DBG_PROBE ,"" );
@@ -1578,13 +1592,14 @@ static void usbvision_disconnect(structv4l2_device_disconnect (&usbvision->v4l2_dev);usbvision_i2c_unregister (usbvision); usbvision->remove_pending =1 ;/* Now all ISO data will be ignored */ + u = usbvision->user;usb_put_dev (usbvision->dev); usbvision->dev =NULL ;/* USB device is no more */ mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->user) { +if (u) {printk (KERN_INFO "%s: In use, disconnect pending\n" , __func__);wake_up_interruptible (&usbvision->wait_frame);
Greg Kroah-Hartman
maintainerPATCH 191/211 cpufreq: Add NULL checks to show() and store() methods of cpufreq
In reply to Greg Kroah-HartmanFrom: Kai Shen <[email protected]>
commit e6e8df07268c1f75dd9215536e2ce4587b70f977 upstream.
Add NULL checks to show() and store() in cpufreq.c to avoid attempts to invoke a NULL callback.
Though some interfaces of cpufreq are set as read-only, users can still get write permission using chmod which can lead to a kernel crash, as follows:
chmod +w /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
This bug was found in linux 4.19.
--- drivers/cpufreq/cpufreq.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/cpufreq/cpufreq.c +6 -0
@@ -911,6 +911,9 @@ static ssize_t show(struct kobject *kobjstruct freq_attr *fattr =to_attr (attr);ssize_t ret; +if (!fattr->show) +return -EIO ; +down_read (&policy->rwsem); ret = fattr->show (policy, buf);up_read (&policy->rwsem);
@@ -925,6 +928,9 @@ static ssize_t store(struct kobject *kobstruct freq_attr *fattr =to_attr (attr);ssize_t ret = -EINVAL ; +if (!fattr->store) +return -EIO ; +cpus_read_lock ();if (cpu_online (policy->cpu)) {
Greg Kroah-Hartman
maintainerPATCH 192/211 media: uvcvideo: Fix error path in control parsing failure
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
commit 8c279e9394cade640ed86ec6c6645a0e7df5e0b6 upstream.
When parsing the UVC control descriptors fails, the error path tries to cleanup a media device that hasn't been initialised, potentially resulting in a crash. Fix this by initialising the media device before the error handling path can be reached.
--- drivers/media/usb/uvc/uvc_driver.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +15 -13
@@ -2059,6 +2059,20 @@ static int uvc_probe(struct usb_interfac sizeof(dev->name) - len); } +/* Initialize the media device. */ +#ifdef CONFIG_MEDIA_CONTROLLER + dev->mdev.dev = &intf->dev; +strscpy (dev->mdev.model, dev->name,sizeof (dev->mdev.model)); +if (udev->serial) +strscpy (dev->mdev.serial, udev->serial, +sizeof (dev->mdev.serial)); +usb_make_path (udev, dev->mdev.bus_info,sizeof (dev->mdev.bus_info)); + dev->mdev.hw_revision =le16_to_cpu (udev->descriptor.bcdDevice); +media_device_init (&dev->mdev); + + dev->vdev.mdev = &dev->mdev; +#endif +/* Parse the Video Class control descriptor. */ if (uvc_parse_control (dev) <0 ) { uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
@@ -2079,19 +2093,7 @@ static int uvc_probe(struct usb_interfac "linux-uvc-devel mailing list.\n"); } -/* Initialize the media device and register the V4L2 device. */ -#ifdef CONFIG_MEDIA_CONTROLLER - dev->mdev.dev = &intf->dev; -strlcpy (dev->mdev.model, dev->name,sizeof (dev->mdev.model)); -if (udev->serial) -strlcpy (dev->mdev.serial, udev->serial, -sizeof (dev->mdev.serial)); -strcpy (dev->mdev.bus_info, udev->devpath); - dev->mdev.hw_revision =le16_to_cpu (udev->descriptor.bcdDevice); -media_device_init (&dev->mdev); - - dev->vdev.mdev = &dev->mdev; -#endif +/* Register the V4L2 device. */ if (v4l2_device_register (&intf->dev, &dev->vdev) <0 ) goto error;
Greg Kroah-Hartman
maintainerPATCH 193/211 media: b2c2-flexcop-usb: add sanity checking
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 1b976fc6d684e3282914cdbe7a8d68fdce19095c upstream.
The driver needs an isochronous endpoint to be present. It will oops in its absence. Add checking for it.
--- drivers/media/usb/b2c2/flexcop-usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/usb/b2c2/flexcop-usb.c +3 -0
@@ -537,6 +537,9 @@ static int flexcop_usb_probe(struct usb_struct flexcop_device *fc =NULL ;int ret; +if (intf->cur_altsetting->desc.bNumEndpoints <1 ) +return -ENODEV ; +if ((fc =flexcop_device_kmalloc (sizeof (struct flexcop_usb ))) ==NULL ) {err ("out of memory\n" );return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 194/211 media: cxusb: detect cxusb_ctrl_msg error in query
In reply to Greg Kroah-HartmanFrom: Vito Caputo <[email protected]>
commit ca8f245f284eeffa56f3b7a5eb6fc503159ee028 upstream.
Don't use uninitialized ircode[] in cxusb_rc_query() when cxusb_ctrl_msg() fails to populate its contents.
syzbot reported:
dvb-usb: bulk message failed: -22 (1/-30591)
=====================================================
BUG: KMSAN: uninit-value in ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline] BUG: KMSAN: uninit-value in rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline] BUG: KMSAN: uninit-value in rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816 CPU: 1 PID: 11436 Comm: kworker/1:2 Not tainted 5.3.0-rc7+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events dvb_usb_read_remote_control Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x191/0x1f0 lib/dump_stack.c:113 kmsan_report+0x13a/0x2b0 mm/kmsan/kmsan_report.c:108 __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:250 bsearch+0x1dd/0x250 lib/bsearch.c:41 ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline] rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline] rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:150 [inline] kmsan_internal_chain_origin+0xd2/0x170 mm/kmsan/kmsan.c:314 __msan_chain_origin+0x6b/0xe0 mm/kmsan/kmsan_instr.c:184 rc_g_keycode_from_table drivers/media/rc/rc-main.c:583 [inline] rc_keydown+0x2c4/0x6f0 drivers/media/rc/rc-main.c:816 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
Local variable description: ----ircode@cxusb_rc_query Variable was created at:
cxusb_rc_query+0x4d/0x360 drivers/media/usb/dvb-usb/cxusb.c:543 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261
--- drivers/media/usb/dvb-usb/cxusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb/cxusb.c +2 -1
@@ -455,7 +455,8 @@ static int cxusb_rc_query(struct dvb_usb {u8 ircode[4 ]; -cxusb_ctrl_msg (d,CMD_GET_IR_CODE ,NULL ,0 , ircode,4 ); +if (cxusb_ctrl_msg (d,CMD_GET_IR_CODE ,NULL ,0 , ircode,4 ) <0 ) +return 0 ;if (ircode[2 ] || ircode[3 ]) rc_keydown(d->rc_dev, RC_PROTO_NEC,
Greg Kroah-Hartman
maintainerPATCH 195/211 media: imon: invalid dereference in imon_touch_event
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit f3f5ba42c58d56d50f539854d8cc188944e96087 upstream.
The touch timer is set up in intf1. If the second interface does not exist, the timer and touch input device are not setup and we get the following error, when touch events are reported via intf0.
kernel BUG at kernel/time/timer.c:956!
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc1+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__mod_timer kernel/time/timer.c:956 [inline] RIP: 0010:__mod_timer kernel/time/timer.c:949 [inline] RIP: 0010:mod_timer+0x5a2/0xb50 kernel/time/timer.c:1100 Code: 45 10 c7 44 24 14 ff ff ff ff 48 89 44 24 08 48 8d 45 20 48 c7 44 24 18 00 00 00 00 48 89 04 24 e9 5a fc ff ff e8 ae ce 0e 00 <0f> 0b e8 a7 ce 0e 00 4c 89 74 24 20 e9 37 fe ff ff e8 98 ce 0e 00 RSP: 0018:ffff8881db209930 EFLAGS: 00010006 RAX: ffffffff86c2b200 RBX: 00000000ffffa688 RCX: ffffffff83efc583 RDX: 0000000000000100 RSI: ffffffff812f4d82 RDI: ffff8881d2356200 RBP: ffff8881d23561e8 R08: ffffffff86c2b200 R09: ffffed103a46abeb R10: ffffed103a46abea R11: ffff8881d2355f53 R12: dffffc0000000000 R13: 1ffff1103b64132d R14: ffff8881d2355f50 R15: 0000000000000006 FS: 0000000000000000(0000) GS:ffff8881db200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f75e2799000 CR3: 00000001d3b07000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> imon_touch_event drivers/media/rc/imon.c:1348 [inline] imon_incoming_packet.isra.0+0x2546/0x2f10 drivers/media/rc/imon.c:1603 usb_rx_callback_intf0+0x151/0x1e0 drivers/media/rc/imon.c:1734 __usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1654 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1719 dummy_timer+0x120f/0x2fa2 drivers/usb/gadget/udc/dummy_hcd.c:1965 call_timer_fn+0x179/0x650 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5e3/0x1490 kernel/time/timer.c:1786 __do_softirq+0x221/0x912 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x178/0x1a0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x12f/0x500 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 </IRQ> RIP: 0010:default_idle+0x28/0x2e0 arch/x86/kernel/process.c:581 Code: 90 90 41 56 41 55 65 44 8b 2d 44 3a 8f 7a 41 54 55 53 0f 1f 44 00 00 e8 36 ee d0 fb e9 07 00 00 00 0f 00 2d fa dd 4f 00 fb f4 <65> 44 8b 2d 20 3a 8f 7a 0f 1f 44 00 00 5b 5d 41 5c 41 5d 41 5e c3 RSP: 0018:ffffffff86c07da8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000007 RBX: ffffffff86c2b200 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffffff86c2ba4c RBP: fffffbfff0d85640 R08: ffffffff86c2b200 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x3b6/0x500 kernel/sched/idle.c:263 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:355 start_kernel+0x82a/0x864 init/main.c:784 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241 Modules linked in:
--- drivers/media/rc/imon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/rc/imon.c +1 -2
@@ -1737,8 +1737,7 @@ static void imon_incoming_scancode(strucspin_unlock_irqrestore (&ictx->kc_lock, flags);/* send touchscreen events through input subsystem if touchpad data */ -if (ictx->display_type ==IMON_DISPLAY_TYPE_VGA && len ==8 && - buf[7 ] ==0x86 ) { +if (ictx->touch && len ==8 && buf[7 ] ==0x86 ) {imon_touch_event (ictx, buf);return ;
Greg Kroah-Hartman
maintainerPATCH 196/211 virtio_ring: fix return code on DMA mapping fails
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
[ Upstream commit f7728002c1c7bfa787b276a31c3ef458739b8e7c ]
Commit 780bc7903a32 ("virtio_ring: Support DMA APIs") makes virtqueue_add() return -EIO when we fail to map our I/O buffers. This is a very realistic scenario for guests with encrypted memory, as swiotlb may run out of space, depending on it's size and the I/O load.
The virtio-blk driver interprets -EIO form virtqueue_add() as an IO error, despite the fact that swiotlb full is in absence of bugs a recoverable condition.
Let us change the return code to -ENOMEM, and make the block layer recover form these failures when virtio-blk encounters the condition described above.
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -432,7 +432,7 @@ unmap_release:kfree (desc);END_USE (vq); -return -EIO ; +return -ENOMEM ; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 197/211 usbip: tools: fix fd leakage in the function of read_attr_usbip_status
In reply to Greg Kroah-HartmanFrom: Hewenliang <[email protected]>
commit 26a4d4c00f85cb844dd11dd35e848b079c2f5e8f upstream.
We should close the fd before the return of read_attr_usbip_status.
--- tools/usb/usbip/libsrc/usbip_host_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/usb/usbip/libsrc/usbip_host_common.c +1 -1
@@ -69,7 +69,7 @@ static int32_t read_attr_usbip_status(st } value =atoi (status); - +close (fd);return value; }
Greg Kroah-Hartman
maintainerPATCH 198/211 usbip: Fix uninitialized symbol nents in stub_recv_cmd_submit()
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit 2a9125317b247f2cf35c196f968906dcf062ae2d upstream.
Smatch reported that nents is not initialized and used in stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc() and used to allocate multiple URBs when host controller doesn't support scatter-gather DMA. The use of uninitialized nents means that buf_len is zero and use_sg is true. But buffer length should not be zero when an URB uses scatter-gather DMA.
To prevent this situation, add the conditional that checks buf_len and use_sg. And move the use of nents right after the sgl_alloc() to avoid the use of uninitialized nents.
If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv will be released by stub event handler and connection will be shut down.
--- drivers/usb/usbip/stub_rx.c | 50 ++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-)
drivers/usb/usbip/stub_rx.c +32 -18
@@ -487,18 +487,50 @@ static void stub_recv_cmd_submit(structif (pipe ==-1 )return ; +/* +* Smatch reported the error case where use_sg is true and buf_len is 0. +* In this case, It adds SDEV_EVENT_ERROR_MALLOC and stub_priv will be +* released by stub event handler and connection will be shut down. +*/ priv =stub_priv_alloc (sdev, pdu);if (!priv)return ; buf_len = (unsigned long long )pdu->u.cmd_submit.transfer_buffer_length; +if (use_sg && !buf_len) { +dev_err (&udev->dev,"sg buffer with zero length\n" ); + goto err_malloc; + } +/* allocate urb transfer buffer, if needed */ if (buf_len) {if (use_sg) { sgl =sgl_alloc (buf_len,GFP_KERNEL , &nents);if (!sgl) goto err_malloc; + +/* Check if the server's HCD supports SG */ +if (!udev->bus->sg_tablesize) { +/* +* If the server's HCD doesn't support SG, break +* a single SG request into several URBs and map +* each SG list entry to corresponding URB +* buffer. The previously allocated SG list is +* stored in priv->sgl (If the server's HCD +* support SG, SG list is stored only in +* urb->sg) and it is used as an indicator that +* the server split single SG request into +* several URBs. Later, priv->sgl is used by +* stub_complete() and stub_send_ret_submit() to +* reassemble the divied URBs. +*/ + support_sg =0 ; + num_urbs = nents; + priv->completed_urbs =0 ; + pdu->u.cmd_submit.transfer_flags &= + ~URB_DMA_MAP_SG ; + } }else { buffer =kzalloc (buf_len,GFP_KERNEL );if (!buffer)
@@ -506,24 +538,6 @@ static void stub_recv_cmd_submit(struct } } -/* Check if the server's HCD supports SG */ -if (use_sg && !udev->bus->sg_tablesize) { -/* -* If the server's HCD doesn't support SG, break a single SG -* request into several URBs and map each SG list entry to -* corresponding URB buffer. The previously allocated SG -* list is stored in priv->sgl (If the server's HCD support SG, -* SG list is stored only in urb->sg) and it is used as an -* indicator that the server split single SG request into -* several URBs. Later, priv->sgl is used by stub_complete() and -* stub_send_ret_submit() to reassemble the divied URBs. -*/ - support_sg =0 ; - num_urbs = nents; - priv->completed_urbs =0 ; - pdu->u.cmd_submit.transfer_flags &= ~URB_DMA_MAP_SG ; - } -/* allocate urb array */ priv->num_urbs = num_urbs; priv->urbs =kmalloc_array (num_urbs,sizeof (*priv->urbs),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 199/211 usb-serial: cp201x: support Mark-10 digital force gauge
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 347bc8cb26388791c5881a3775cb14a3f765a674 upstream.
Add support for the Mark-10 digital force gauge device to the cp201x driver.
Based on a report and a larger patch from Joel Jennings
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -128,6 +128,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ + { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */ { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
Greg Kroah-Hartman
maintainerPATCH 200/211 USB: chaoskey: fix error case of a timeout
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 92aa5986f4f7b5a8bf282ca0f50967f4326559f5 upstream.
In case of a timeout or if a signal aborts a read communication with the device needs to be ended lest we overwrite an active URB the next time we do IO to the device, as the URB may still be active.
--- drivers/usb/misc/chaoskey.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/usb/misc/chaoskey.c +21 -3
@@ -396,13 +396,17 @@ static int _chaoskey_fill(struct chaoske !dev->reading, (started ? NAK_TIMEOUT : ALEA_FIRST_TIMEOUT) ); -if (result <0 ) +if (result <0 ) { +usb_kill_urb (dev->urb); goto out; + } -if (result ==0 ) +if (result ==0 ) { result = -ETIMEDOUT ; -else +usb_kill_urb (dev->urb); + }else { result = dev->valid; + } out:/* Let the device go back to sleep eventually */ usb_autopm_put_interface (dev->interface);
@@ -538,7 +542,21 @@ static int chaoskey_suspend(struct usb_istatic int chaoskey_resume (struct usb_interface *interface) { +struct chaoskey *dev; +struct usb_device *udev =interface_to_usbdev (interface); +usb_dbg (interface,"resume" ); + dev =usb_get_intfdata (interface); + +/* +* We may have lost power. +* In that case the device that needs a long time +* for the first requests needs an extended timeout +* again +*/ +if (le16_to_cpu (udev->descriptor.idVendor) ==ALEA_VENDOR_ID ) + dev->reads_started = false; +return 0 ; }#else
Greg Kroah-Hartman
maintainerPATCH 201/211 appledisplay: fix error handling in the scheduled work
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 91feb01596e5efc0cc922cc73f5583114dccf4d2 upstream.
The work item can operate on
1. stale memory left over from the last transfer the actual length of the data transfered needs to be checked
2. memory already freed
the error handling in appledisplay_probe() needs to cancel the work in that case
--- drivers/usb/misc/appledisplay.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/appledisplay.c +7 -1
@@ -182,7 +182,12 @@ static int appledisplay_bl_get_brightnes0 , pdata->msgdata,2 , ACD_USB_TIMEOUT); - brightness = pdata->msgdata[1 ]; +if (retval <2 ) { +if (retval >=0 ) + retval = -EMSGSIZE ; + }else { + brightness = pdata->msgdata[1 ]; + }mutex_unlock (&pdata->sysfslock);if (retval <0 )
@@ -317,6 +322,7 @@ error:if (pdata) {if (pdata->urb) {usb_kill_urb (pdata->urb); +cancel_delayed_work_sync (&pdata->work);if (pdata->urbdata)usb_free_coherent (pdata->udev,ACD_URB_BUFFER_LEN , pdata->urbdata, pdata->urb->transfer_dma);
Greg Kroah-Hartman
maintainerPATCH 202/211 USB: serial: mos7840: add USB ID to support Moxa UPort 2210
In reply to Greg Kroah-HartmanFrom: Pavel Löbl <[email protected]>
commit e696d00e65e81d46e911f24b12e441037bf11b38 upstream.
Add USB ID for MOXA UPort 2210. This device contains mos7820 but it passes GPIO0 check implemented by driver and it's detected as mos7840. Hence product id check is added to force mos7820 mode.
--- drivers/usb/serial/mos7840.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/serial/mos7840.c +11 -0
@@ -131,11 +131,15 @@/* This driver also supports * ATEN UC2324 device using Moschip MCS7840 * ATEN UC2322 device using Moschip MCS7820 +* MOXA UPort 2210 device using Moschip MCS7820 */ #define USB_VENDOR_ID_ATENINTL 0x0557#define ATENINTL_DEVICE_ID_UC2324 0x2011#define ATENINTL_DEVICE_ID_UC2322 0x7820 +#define USB_VENDOR_ID_MOXA 0x110a +#define MOXA_DEVICE_ID_2210 0x2210 +/* Interrupt Routine Defines */ #define SERIAL_IIR_RLS 0x06
@@ -206,6 +210,7 @@ static const struct usb_device_id id_tab {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, + {USB_DEVICE(USB_VENDOR_ID_MOXA, MOXA_DEVICE_ID_2210)}, {} /* terminating entry */ };MODULE_DEVICE_TABLE (usb, id_table);
@@ -2065,6 +2070,7 @@ static int mos7840_probe(struct usb_seri const struct usb_device_id *id) {u16 product =le16_to_cpu (serial->dev->descriptor.idProduct); +u16 vid =le16_to_cpu (serial->dev->descriptor.idVendor);u8 *buf;int device_type;
@@ -2074,6 +2080,11 @@ static int mos7840_probe(struct usb_seri goto out; } +if (vid ==USB_VENDOR_ID_MOXA && product ==MOXA_DEVICE_ID_2210 ) { + device_type =MOSCHIP_DEVICE_ID_7820 ; + goto out; + } + buf =kzalloc (VENDOR_READ_LENGTH ,GFP_KERNEL );if (!buf)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 203/211 USB: serial: mos7720: fix remote wakeup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit ea422312a462696093b5db59d294439796cba4ad upstream.
The driver was setting the device remote-wakeup feature during probe in violation of the USB specification (which says it should only be set just prior to suspending the device). This could potentially waste power during suspend as well as lead to spurious wakeups.
Note that USB core would clear the remote-wakeup feature at first resume.
--- drivers/usb/serial/mos7720.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/serial/mos7720.c +0 -4
@@ -1905,10 +1905,6 @@ static int mos7720_startup(struct usb_se product =le16_to_cpu (serial->dev->descriptor.idProduct); dev = serial->dev; -/* setting configuration feature to one */ -usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), - (__u8 )0x03 ,0x00 ,0x01 ,0x00 ,NULL ,0x00 ,5000 ); -if (product ==MOSCHIP_DEVICE_ID_7715 ) {struct urb *urb = serial->port[0 ]->interrupt_in_urb;
Greg Kroah-Hartman
maintainerPATCH 204/211 USB: serial: mos7840: fix remote wakeup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 92fe35fb9c70a00d8fbbf5bd6172c921dd9c7815 upstream.
The driver was setting the device remote-wakeup feature during probe in violation of the USB specification (which says it should only be set just prior to suspending the device). This could potentially waste power during suspend as well as lead to spurious wakeups.
Note that USB core would clear the remote-wakeup feature at first resume.
--- drivers/usb/serial/mos7840.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/usb/serial/mos7840.c +0 -5
@@ -2338,11 +2338,6 @@ out: goto error; }else dev_dbg (&port->dev,"ZLP_REG5 Writing success status%d\n" , status); - -/* setting configuration feature to one */ -usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), -0x03 ,0x00 ,0x01 ,0x00 ,NULL ,0x00 , -MOS_WDR_TIMEOUT ); }return 0 ; error:
Greg Kroah-Hartman
maintainerPATCH 205/211 USB: serial: option: add support for DW5821e with eSIM support
In reply to Greg Kroah-HartmanFrom: Aleksander Morgado <[email protected]>
commit 957c31ea082e3fe5196f46d5b04018b10de47400 upstream.
The device exposes AT, NMEA and DIAG ports in both USB configurations. Exactly same layout as the default DW5821e module, just a different vid/pid.
P: Vendor=413c ProdID=81e0 Rev=03.18 S: Manufacturer=Dell Inc. S: Product=DW5821e-eSIM Snapdragon X20 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
P: Vendor=413c ProdID=81e0 Rev=03.18 S: Manufacturer=Dell Inc. S: Product=DW5821e-eSIM Snapdragon X20 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -200,6 +200,7 @@ static void option_instat_callback(struc#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b/* Novatel E371 */ #define DELL_PRODUCT_5821E 0x81d7 +#define DELL_PRODUCT_5821E_ESIM 0x81e0#define KYOCERA_VENDOR_ID 0x0c88#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -1047,6 +1048,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) }, { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E), .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
Greg Kroah-Hartman
maintainerPATCH 206/211 USB: serial: option: add support for Foxconn T77W968 LTE modules
In reply to Greg Kroah-HartmanFrom: Aleksander Morgado <[email protected]>
commit f0797095423e6ea3b4be61134ee353c7f504d440 upstream.
These are the Foxconn-branded variants of the Dell DW5821e modules, same USB layout as those. The device exposes AT, NMEA and DIAG ports in both USB configurations.
P: Vendor=0489 ProdID=e0b4 Rev=03.18 S: Manufacturer=FII S: Product=T77W968 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
P: Vendor=0489 ProdID=e0b4 Rev=03.18 S: Manufacturer=FII S: Product=T77W968 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -1995,6 +1995,10 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x13) }, { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x14) }, { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x1b) }, + { USB_DEVICE(0x0489, 0xe0b4), /* Foxconn T77W968 */ + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 */ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */
Greg Kroah-Hartman
maintainerPATCH 207/211 staging: comedi: usbduxfast: usbduxfast_ai_cmdtest rounding error
In reply to Greg Kroah-HartmanFrom: Bernd Porr <[email protected]>
commit 5618332e5b955b4bff06d0b88146b971c8dd7b32 upstream.
The userspace comedilib function 'get_cmd_generic_timed' fills the cmd structure with an informed guess and then calls the function 'usbduxfast_ai_cmdtest' in this driver repeatedly while 'usbduxfast_ai_cmdtest' is modifying the cmd struct until it no longer changes. However, because of rounding errors this never converged because 'steps = (cmd->convert_arg * 30) / 1000' and then back to 'cmd->convert_arg = (steps * 1000) / 30' won't be the same because of rounding errors. 'Steps' should only be converted back to the 'convert_arg' if 'steps' has actually been modified. In addition the case of steps being 0 wasn't checked which is also now done.
--- drivers/staging/comedi/drivers/usbduxfast.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/staging/comedi/drivers/usbduxfast.c +14 -7
@@ -1,5 +1,5 @@/* -* Copyright (C) 2004-2014 Bernd Porr, [email protected] +* Copyright (C) 2004-2019 Bernd Porr, [email protected] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@* Description: University of Stirling USB DAQ & INCITE Technology Limited * Devices: [ITL] USB-DUX-FAST (usbduxfast) * Author: Bernd Porr <[email protected]> -* Updated: 10 Oct 2014 +* Updated: 16 Nov 2019 * Status: stable */
@@ -31,6 +31,7 @@* * * Revision history: +* 1.0: Fixed a rounding error in usbduxfast_ai_cmdtest * 0.9: Dropping the first data packet which seems to be from the last transfer. * Buffer overflows in the FX2 are handed over to comedi. * 0.92: Dropping now 4 packets. The quad buffer has to be emptied.
@@ -359,6 +360,7 @@ static int usbduxfast_ai_cmdtest(struct struct comedi_cmd *cmd) {int err =0 ; +int err2 =0 ;unsigned int steps;unsigned int arg;
@@ -408,11 +410,16 @@ static int usbduxfast_ai_cmdtest(struct*/ steps = (cmd->convert_arg *30 ) /1000 ;if (cmd->chanlist_len !=1 ) - err |=comedi_check_trigger_arg_min (&steps, -MIN_SAMPLING_PERIOD ); - err |=comedi_check_trigger_arg_max (&steps,MAX_SAMPLING_PERIOD ); - arg = (steps *1000 ) /30 ; - err |=comedi_check_trigger_arg_is (&cmd->convert_arg, arg); + err2 |=comedi_check_trigger_arg_min (&steps, +MIN_SAMPLING_PERIOD ); +else + err2 |=comedi_check_trigger_arg_min (&steps,1 ); + err2 |=comedi_check_trigger_arg_max (&steps,MAX_SAMPLING_PERIOD ); +if (err2) { + err |= err2; + arg = (steps *1000 ) /30 ; + err |=comedi_check_trigger_arg_is (&cmd->convert_arg, arg); + }if (cmd->stop_src ==TRIG_COUNT ) err |=comedi_check_trigger_arg_min (&cmd->stop_arg,1 );
Greg Kroah-Hartman
maintainerPATCH 208/211 powerpc/64s: support nospectre_v2 cmdline option
In reply to Greg Kroah-HartmanFrom: "Christopher M. Riedl" <[email protected]>
commit d8f0e0b073e1ec52a05f0c2a56318b47387d2f10 upstream.
Add support for disabling the kernel implemented spectre v2 mitigation (count cache flush on context switch) via the nospectre_v2 and mitigations=off cmdline options.
--- arch/powerpc/kernel/security.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
arch/powerpc/kernel/security.c +16 -3
@@ -28,7 +28,7 @@ static enum count_cache_flush_type countbool barrier_nospec_enabled;static bool no_nospec;static bool btb_flush_enabled; -#ifdef CONFIG_PPC_FSL_BOOK3E +#if defined(CONFIG_PPC_FSL_BOOK3E ) || defined(CONFIG_PPC_BOOK3S_64 )static bool no_spectrev2;#endif
@@ -106,7 +106,7 @@ static __init int barrier_nospec_debugfsdevice_initcall (barrier_nospec_debugfs_init);#endif /* CONFIG_DEBUG_FS */ -#ifdef CONFIG_PPC_FSL_BOOK3E +#if defined(CONFIG_PPC_FSL_BOOK3E ) || defined(CONFIG_PPC_BOOK3S_64 )static int __init handle_nospectre_v2 (char *p) { no_spectrev2 = true;
@@ -114,6 +114,9 @@ static int __init handle_nospectre_v2(chreturn 0 ; }early_param ("nospectre_v2" , handle_nospectre_v2); +#endif /* CONFIG_PPC_FSL_BOOK3E || CONFIG_PPC_BOOK3S_64 */ + +#ifdef CONFIG_PPC_FSL_BOOK3E void setup_spectre_v2 (void ) {if (no_spectrev2 ||cpu_mitigations_off ())
@@ -391,7 +394,17 @@ static void toggle_count_cache_flush(boovoid setup_count_cache_flush (void ) { -toggle_count_cache_flush (true); +bool enable = true; + +if (no_spectrev2 ||cpu_mitigations_off ()) { +if (security_ftr_enabled (SEC_FTR_BCCTRL_SERIALISED ) || +security_ftr_enabled (SEC_FTR_COUNT_CACHE_DISABLED )) +pr_warn ("Spectre v2 mitigations not under software control, can't disable\n" ); + + enable = false; + } + +toggle_count_cache_flush (enable); }#ifdef CONFIG_DEBUG_FS
Greg Kroah-Hartman
maintainerPATCH 209/211 powerpc/book3s64: Fix link stack flush on context switch
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 39e72bf96f5847ba87cc5bd7a3ce0fed813dc9ad upstream.
In commit ee13cb249fab ("powerpc/64s: Add support for software count cache flush"), I added support for software to flush the count cache (indirect branch cache) on context switch if firmware told us that was the required mitigation for Spectre v2.
As part of that code we also added a software flush of the link stack (return address stack), which protects against Spectre-RSB between user processes.
That is all correct for CPUs that activate that mitigation, which is currently Power9 Nimbus DD2.3.
What I got wrong is that on older CPUs, where firmware has disabled the count cache, we also need to flush the link stack on context switch.
To fix it we create a new feature bit which is not set by firmware, which tells us we need to flush the link stack. We set that when firmware tells us that either of the existing Spectre v2 mitigations are enabled.
Then we adjust the patching code so that if we see that feature bit we enable the link stack flush. If we're also told to flush the count cache in software then we fall through and do that also.
On the older CPUs we don't need to do do the software count cache flush, firmware has disabled it, so in that case we patch in an early return after the link stack flush.
The naming of some of the functions is awkward after this patch, because they're called "count cache" but they also do link stack. But we'll fix that up in a later commit to ease backporting.
This is the fix for CVE-2019-18660.
--- arch/powerpc/include/asm/asm-prototypes.h | 1 arch/powerpc/include/asm/security_features.h | 3 + arch/powerpc/kernel/entry_64.S | 6 +++ arch/powerpc/kernel/security.c | 48 ++++++++++++++++++++++++--- 4 files changed, 54 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/asm-prototypes.h +1 -0
@@ -129,6 +129,7 @@ unsigned long prepare_ftrace_return(unsi/* Patch sites */ extern s32 patch__call_flush_count_cache;extern s32 patch__flush_count_cache_return; +extern s32 patch__flush_link_stack_return;extern long flush_count_cache;
arch/powerpc/include/asm/security_features.h +3 -0
@@ -81,6 +81,9 @@ static inline bool security_ftr_enabled(// Software required to flush count cache on context switch #define SEC_FTR_FLUSH_COUNT_CACHE 0x0000000000000400ull +// Software required to flush link stack on context switch +#define SEC_FTR_FLUSH_LINK_STACK 0x0000000000001000ull +// Features enabled by default #define SEC_FTR_DEFAULT \
arch/powerpc/kernel/entry_64.S +6 -0
@@ -524,6 +524,7 @@ flush_count_cache: /* Save LR into r9 */ mflr r9 + // Flush the link stack .rept 64 bl .+4 .endr
@@ -533,6 +534,11 @@ flush_count_cache: .balign 32 /* Restore LR */ 1: mtlr r9 + + // If we're just flushing the link stack, return here +3: nop + patch_site 3b patch__flush_link_stack_return + li r9,0x7fff mtctr r9
arch/powerpc/kernel/security.c +44 -4
90 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 210/211 KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit af2e8c68b9c5403f77096969c516f742f5bb29e0 upstream.
On some systems that are vulnerable to Spectre v2, it is up to software to flush the link stack (return address stack), in order to protect against Spectre-RSB.
When exiting from a guest we do some house keeping and then potentially exit to C code which is several stack frames deep in the host kernel. We will then execute a series of returns without preceeding calls, opening up the possiblity that the guest could have poisoned the link stack, and direct speculative execution of the host to a gadget of some sort.
To prevent this we add a flush of the link stack on exit from a guest.
--- arch/powerpc/include/asm/asm-prototypes.h | 2 ++ arch/powerpc/kernel/security.c | 9 +++++++++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+)
arch/powerpc/include/asm/asm-prototypes.h +2 -0
@@ -130,7 +130,9 @@ unsigned long prepare_ftrace_return(unsiextern s32 patch__call_flush_count_cache;extern s32 patch__flush_count_cache_return;extern s32 patch__flush_link_stack_return; +extern s32 patch__call_kvm_flush_link_stack;extern long flush_count_cache; +extern long kvm_flush_link_stack;#endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */
arch/powerpc/kernel/security.c +9 -0
@@ -392,6 +392,9 @@ static void toggle_count_cache_flush(booif (!enable) {patch_instruction_site (&patch__call_flush_count_cache,PPC_INST_NOP ); +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE +patch_instruction_site (&patch__call_kvm_flush_link_stack,PPC_INST_NOP ); +#endif pr_info ("link-stack-flush: software flush disabled.\n" ); link_stack_flush_enabled = false;no_count_cache_flush ();
@@ -402,6 +405,12 @@ static void toggle_count_cache_flush(boopatch_branch_site (&patch__call_flush_count_cache, (u64)&flush_count_cache,BRANCH_SET_LINK ); +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE +// This enables the branch from guest_exit_cont to kvm_flush_link_stack +patch_branch_site (&patch__call_kvm_flush_link_stack, + (u64)&kvm_flush_link_stack,BRANCH_SET_LINK ); +#endif +pr_info ("link-stack-flush: software flush enabled.\n" ); link_stack_flush_enabled = true;
arch/powerpc/kvm/book3s_hv_rmhandlers.S +27 -0
@@ -18,6 +18,7 @@ */ #include <asm/ppc_asm.h> +#include <asm/code-patching-asm.h> #include <asm/kvm_asm.h> #include <asm/reg.h> #include <asm/mmu.h>
@@ -1445,6 +1446,10 @@ mc_cont: 1: #endif /* CONFIG_KVM_XICS */ + /* Possibly flush the link stack here. */ +1: nop + patch_site 1b patch__call_kvm_flush_link_stack + stw r12, STACK_SLOT_TRAP(r1) mr r3, r12 /* Increment exit count, poke other threads to exit */
@@ -1957,6 +1962,28 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_R mtlr r0 blr +.balign 32 +.global kvm_flush_link_stack +kvm_flush_link_stack: + /* Save LR into r0 */ + mflr r0 + + /* Flush the link stack. On Power8 it's up to 32 entries in size. */ + .rept 32 + bl .+4 + .endr + + /* And on Power9 it's up to 64. */ +BEGIN_FTR_SECTION + .rept 32 + bl .+4 + .endr +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) + + /* Restore LR */ + mtlr r0 + blr + /* * Check whether an HDSI is an HPTE not found fault or something else. * If it is an HPTE not found fault that is due to the guest accessing
Greg Kroah-Hartman
maintainerPATCH 211/211 x86/hyperv: mark hyperv_init as __init function
In reply to Greg Kroah-HartmanFrom: Sasha Levin <[email protected]>
This change was done upstream as part of 6b48cb5f8347 ("X86/Hyper-V:
Enlighten APIC access"), but that commit introduced a lot of new functionality we don't want to backport.
This change eliminates a build warning.
--- arch/x86/hyperv/hv_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +1 -1
@@ -125,7 +125,7 @@ static int __init hv_pci_init(void)* 1. Setup the hypercall page. * 2. Register Hyper-V specific clocksource. */ -void hyperv_init (void ) +void __init hyperv_init (void ) {u64 guest_id, required_msrs;union hv_x64_msr_hypercall_contents hypercall_msr;
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. 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.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
This patch causing build failure for x86 32bit on stable-rc 4.14 and stable-rc-4.19
Quoted 2 lines
Thomas Gleixner <[email protected]>
x86/cpu_entry_area: Add guard page for entry stack on 32bit
In file included from include/linux/kernel.h:10:0,
from include/linux/list.h:9,
from include/linux/preempt.h:11,
from include/linux/spinlock.h:51,
from arch/x86/mm/cpu_entry_area.c:3:
In function 'setup_cpu_entry_area_ptes',
inlined from 'setup_cpu_entry_areas' at arch/x86/mm/cpu_entry_area.c:164:2:include/linux/compiler.h:334:38: error: call to '__compiletime_assert_147' declared with attribute error: BUILD_BUG_ON
failed: (CPU_ENTRY_AREA_PAGES+1)*PAGE_SIZE != CPU_ENTRY_AREA_MAP_SIZE
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:314:4: note: in definition of macro
'__compiletime_assert'
prefix ## suffix(); \
^~~~~~include/linux/compiler.h:334:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^~~~~~~~~~~~~~~~arch/x86/mm/cpu_entry_area.c:147:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((CPU_ENTRY_AREA_PAGES+1)*PAGE_SIZE != CPU_ENTRY_AREA_MAP_SIZE); ^~~~~~~~~~~~
--
Linaro LKFT
https://lkft.linaro.org
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Kernel BUG noticed on x86_64 device while booting 4.14.157-rc1 kernel.
Summary
------------------------------------------------------------------------
kernel: 4.14.157-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 3ecb26dddb12a0368baea19c0778c267e215edff
git describe: v4.14.156-212-g3ecb26dddb12
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe-sanity/build/v4.14.156-212-g3ecb26dddb12
kernel-config: http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/intel-corei7-64/lkft/linux-stable-rc-4.14/655/config
Regressions (compared to build v4.14.156)
[ 2.777657] BUG: unable to handle kernel NULL pointer dereference at 0000000000000090 [ 2.785487] IP: kernfs_find_ns+0x18/0xf0 [ 2.789408] PGD 0 P4D 0 [ 2.791941] Oops: 0000 [#1] SMP PTI [ 2.795424] Modules linked in: [ 2.798474] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.157-rc1 #1 [ 2.804906] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 2.812288] task: ffff8e09ee250000 task.stack: ffffa0f900028000 [ 2.818200] RIP: 0010:kernfs_find_ns+0x18/0xf0 [ 2.822636] RSP: 0000:ffffa0f90002bc48 EFLAGS: 00010286 [ 2.827854] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff9e6fb326 [ 2.834978] RDX: 0000000000000000 RSI: ffffffff9e7b9c81 RDI: 0000000000000000 [ 2.842102] RBP: ffffffff9e7b9c81 R08: ffffffff9d718df0 R09: 00000000000020b0 [ 2.849225] R10: ffffa0f90002bc80 R11: ffffffff9f8cfc40 R12: 0000000000000000 [ 2.856351] R13: 0000000000000000 R14: ffffffff9e7b9c81 R15: 0000000000000004 [ 2.863475] FS: 0000000000000000(0000) GS:ffff8e09f7880000(0000) knlGS:0000000000000000 [ 2.871550] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2.877288] CR2: 0000000000000090 CR3: 000000014f41e001 CR4: 00000000003606e0 [ 2.884411] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.891536] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2.898659] Call Trace: [ 2.901106] kernfs_find_and_get_ns+0x2e/0x50 [ 2.905463] sysfs_remove_group+0x25/0x80 [ 2.909468] netdev_queue_update_kobjects+0xbe/0x150 [ 2.914426] netif_set_real_num_tx_queues+0x71/0x200 [ 2.919393] __igb_open+0x19a/0x5c0 [ 2.922885] __dev_open+0xa7/0x130 [ 2.926290] ? __dev_change_flags+0x7c/0x190 [ 2.930554] __dev_change_flags+0x153/0x190 [ 2.934739] ? set_debug_rodata+0x11/0x11 [ 2.938744] dev_change_flags+0x23/0x60 [ 2.942575] ip_auto_config+0x202/0xe4e [ 2.946415] ? set_debug_rodata+0x11/0x11 [ 2.950424] ? root_nfs_parse_addr+0x9e/0x9e [ 2.954690] ? do_one_initcall+0x3e/0x154 [ 2.958691] do_one_initcall+0x3e/0x154 [ 2.962524] kernel_init_freeable+0x1b1/0x238 [ 2.966875] ? rest_init+0x190/0x190 [ 2.970444] kernel_init+0xa/0x100 [ 2.973844] ret_from_fork+0x3a/0x50 [ 2.977422] Code: 85 a5 fe ff ff e9 3c fe ff ff 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 49 89 f6 41 55 41 54 49 89 fd 55 53 49 89 d4 <0f> b7 af 90 00 00 00 8b 05 cb ab 3b 01 48 8b 5f 68 66 83 e5 20 [ 2.996288] RIP: kernfs_find_ns+0x18/0xf0 RSP: ffffa0f90002bc48 [ 3.002199] CR2: 0000000000000090 [ 3.005512] ---[ end trace 93a0e1285ce8e359 ]--- [ 3.010131] BUG: sleeping function called from invalid context at /usr/src/kernel/include/linux/percpu-rwsem.h:34 [ 3.020381] in_atomic(): 0, irqs_disabled(): 1, pid: 1, name: swapper/0 [ 3.026984] INFO: lockdep is turned off. [ 3.030901] irq event stamp: 912954 [ 3.034388] hardirqs last enabled at (912953): [<ffffffff9dfa6502>] _raw_spin_unlock_irqrestore+0x32/0x50 [ 3.044064] hardirqs last disabled at (912954): [<ffffffff9e00159e>] error_entry+0x7e/0x100 [ 3.052415] softirqs last enabled at (910778): [<ffffffff9e20037b>] __do_softirq+0x37b/0x4fa [ 3.060933] softirqs last disabled at (910771): [<ffffffff9d4d6731>] irq_exit+0xd1/0xe0 [ 3.068922] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G D 4.14.157-rc1 #1 [ 3.076567] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 3.083949] Call Trace: [ 3.086397] dump_stack+0x71/0xa5 [ 3.089716] ___might_sleep+0x149/0x230 [ 3.093555] exit_signals+0x20/0x210 [ 3.097124] do_exit+0xa0/0xd00 [ 3.100263] ? kernel_init_freeable+0x1b1/0x238 [ 3.104796] rewind_stack_do_exit+0x17/0x20 [ 3.108995] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 3.108995] [ 3.118161] Kernel Offset: 0x1c400000 from 0xffffffff81000000
(relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Full test log,
https://lkft.validation.linaro.org/scheduler/job/1026224#L793
--
Linaro LKFT
https://lkft.linaro.org
Hi Greg,
Quoted 1 line
Kernel BUG noticed on x86_64 device while booting 4.14.157-rc1 kernel.
The problematic patch is,
Quoted 2 lines
Quoted 2 lines
Jouni Hogander <[email protected]>
net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
And this kernel panic is been fixed by below patch,
commit 48a322b6f9965b2f1e4ce81af972f0e287b07ed0
Author: Eric Dumazet <[email protected]> Date: Wed Nov 20 19:19:07 2019 -0800
net-sysfs: fix netdev_queue_add_kobject() breakage
kobject_put() should only be called in error path.
rx|netdev_queue_add_kobject")
Quoted 13 lines
Regressions (compared to build v4.14.156)
[ 2.777657] BUG: unable to handle kernel NULL pointer dereference at 0000000000000090 [ 2.785487] IP: kernfs_find_ns+0x18/0xf0 [ 2.789408] PGD 0 P4D 0 [ 2.791941] Oops: 0000 [#1] SMP PTI [ 2.795424] Modules linked in: [ 2.798474] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.157-rc1 #1 [ 2.804906] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 2.812288] task: ffff8e09ee250000 task.stack: ffffa0f900028000 [ 2.818200] RIP: 0010:kernfs_find_ns+0x18/0xf0
<trim>
Quoted 9 lines
[ 3.108995] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 3.108995] [ 3.118161] Kernel Offset: 0x1c400000 from 0xffffffff81000000(relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Full test log,
https://lkft.validation.linaro.org/scheduler/job/1026224#L793
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Hi Greg,
Quoted 1 line
Kernel BUG noticed on x86_64 device while booting 4.14.157-rc1 kernel.The problematic patch is,
Quoted 2 lines
Quoted 2 lines
Jouni Hogander <[email protected]>
net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobjectAnd this kernel panic is been fixed by below patch,
commit
48a322b6f9965b2f1e4ce81af972f0e287b07ed0Author: Eric Dumazet <[email protected]> Date: Wed Nov 20 19:19:07 2019 -0800net-sysfs: fix
netdev_queue_add_kobject()breakage
Quoted 7 lines
kobject_put()should only be called in error path.Fixes b8eb718348b8 ("net-sysfs: Fix reference count leak inrx|netdev_queue_add_kobject")
Signed-off-by Eric Dumazet <[email protected]>Cc Jouni Hogander <[email protected]>Signed-off-by David S. Miller <[email protected]>
Thanks for the report, will go queue it up now.
greg k-h
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.157-rc2-gc9b009c3c595
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 167 fail: 5 Failed builds: i386:defconfig i386:allyesconfig i386:allmodconfig i386:allnoconfig i386:tinyconfig Qemu test results: total: 372 pass: 347 fail: 25 Failed tests: <all i386>
As already reported.
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. 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.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
rc2 doesn't boot. I am seeing a different panic. I didn't get a chance to bisect yet.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
I have released a -rc3 version now:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gz
that should have the i386 issues fixed, as well as all other reported issues.
thanks,
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.157 release. There are 211 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 Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
Quoted 8 lines
Quoted 5 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.I have released a -rc3 version now:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gz
you mean -rc3 link,
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc3.gz
Quoted 2 lines
that should have the i386 issues fixed, as well as all other reported issues.
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.157-rc3
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 36dea990ac35ede053b2c69d91cc480b19fbb7dd
git describe: v4.14.156-205-g36dea990ac35
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.156-205-g36dea990ac35
No regressions (compared to build v4.14.156)
No fixes (compared to build v4.14.156)
Ran 24559 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-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-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org