···184184API for programming an FPGA185185---------------------------186186187187+FPGA Manager flags188188+189189+.. kernel-doc:: include/linux/fpga/fpga-mgr.h190190+ :doc: FPGA Manager flags191191+187192.. kernel-doc:: include/linux/fpga/fpga-mgr.h188193 :functions: fpga_image_info189194
+3-2
Documentation/fb/uvesafb.txt
···1515arches.16161717v86d source code can be downloaded from the following website:1818- http://dev.gentoo.org/~spock/projects/uvesafb1818+1919+ https://github.com/mjanusz/v86d19202021Please refer to the v86d documentation for detailed configuration and2122installation instructions.···178177179178--180179 Michal Januszewski <spock@gentoo.org>181181- Last updated: 2009-03-30180180+ Last updated: 2017-10-10182181183182 Documentation of the uvesafb options is loosely based on vesafb.txt.184183
+1-1
Documentation/networking/ip-sysctl.txt
···425425 1 - Disabled by default, enabled when an ICMP black hole detected426426 2 - Always enabled, use initial MSS of tcp_base_mss.427427428428-tcp_probe_interval - INTEGER428428+tcp_probe_interval - UNSIGNED INTEGER429429 Controls how often to start TCP Packetization-Layer Path MTU430430 Discovery reprobe. The default is reprobing every 10 minutes as431431 per RFC4821.
···413413396 common pkey_free sys_pkey_free414414397 common statx sys_statx415415398 common rseq sys_rseq416416+399 common io_pgetevents sys_io_pgetevents
+54-1
arch/arm64/kvm/guest.c
···5757 return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);5858}59596060+static int validate_core_offset(const struct kvm_one_reg *reg)6161+{6262+ u64 off = core_reg_offset_from_id(reg->id);6363+ int size;6464+6565+ switch (off) {6666+ case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...6767+ KVM_REG_ARM_CORE_REG(regs.regs[30]):6868+ case KVM_REG_ARM_CORE_REG(regs.sp):6969+ case KVM_REG_ARM_CORE_REG(regs.pc):7070+ case KVM_REG_ARM_CORE_REG(regs.pstate):7171+ case KVM_REG_ARM_CORE_REG(sp_el1):7272+ case KVM_REG_ARM_CORE_REG(elr_el1):7373+ case KVM_REG_ARM_CORE_REG(spsr[0]) ...7474+ KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):7575+ size = sizeof(__u64);7676+ break;7777+7878+ case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...7979+ KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):8080+ size = sizeof(__uint128_t);8181+ break;8282+8383+ case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):8484+ case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):8585+ size = sizeof(__u32);8686+ break;8787+8888+ default:8989+ return -EINVAL;9090+ }9191+9292+ if (KVM_REG_SIZE(reg->id) == size &&9393+ IS_ALIGNED(off, size / sizeof(__u32)))9494+ return 0;9595+9696+ return -EINVAL;9797+}9898+6099static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)61100{62101 /*···11475 if (off >= nr_regs ||11576 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)11677 return -ENOENT;7878+7979+ if (validate_core_offset(reg))8080+ return -EINVAL;1178111882 if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))11983 return -EFAULT;···14098 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)14199 return -ENOENT;142100101101+ if (validate_core_offset(reg))102102+ return -EINVAL;103103+143104 if (KVM_REG_SIZE(reg->id) > sizeof(tmp))144105 return -EINVAL;145106···152107 }153108154109 if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {155155- u32 mode = (*(u32 *)valp) & PSR_AA32_MODE_MASK;110110+ u64 mode = (*(u64 *)valp) & PSR_AA32_MODE_MASK;156111 switch (mode) {157112 case PSR_AA32_MODE_USR:113113+ if (!system_supports_32bit_el0())114114+ return -EINVAL;115115+ break;158116 case PSR_AA32_MODE_FIQ:159117 case PSR_AA32_MODE_IRQ:160118 case PSR_AA32_MODE_SVC:161119 case PSR_AA32_MODE_ABT:162120 case PSR_AA32_MODE_UND:121121+ if (!vcpu_el1_is_32bit(vcpu))122122+ return -EINVAL;123123+ break;163124 case PSR_MODE_EL0t:164125 case PSR_MODE_EL1t:165126 case PSR_MODE_EL1h:127127+ if (vcpu_el1_is_32bit(vcpu))128128+ return -EINVAL;166129 break;167130 default:168131 err = -EINVAL;
+44-8
arch/arm64/mm/hugetlbpage.c
···117117118118 /*119119 * If HW_AFDBM is enabled, then the HW could turn on120120- * the dirty bit for any page in the set, so check121121- * them all. All hugetlb entries are already young.120120+ * the dirty or accessed bit for any page in the set,121121+ * so check them all.122122 */123123 if (pte_dirty(pte))124124 orig_pte = pte_mkdirty(orig_pte);125125+126126+ if (pte_young(pte))127127+ orig_pte = pte_mkyoung(orig_pte);125128 }126129127130 if (valid) {···323320 return get_clear_flush(mm, addr, ptep, pgsize, ncontig);324321}325322323323+/*324324+ * huge_ptep_set_access_flags will update access flags (dirty, accesssed)325325+ * and write permission.326326+ *327327+ * For a contiguous huge pte range we need to check whether or not write328328+ * permission has to change only on the first pte in the set. Then for329329+ * all the contiguous ptes we need to check whether or not there is a330330+ * discrepancy between dirty or young.331331+ */332332+static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)333333+{334334+ int i;335335+336336+ if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))337337+ return 1;338338+339339+ for (i = 0; i < ncontig; i++) {340340+ pte_t orig_pte = huge_ptep_get(ptep + i);341341+342342+ if (pte_dirty(pte) != pte_dirty(orig_pte))343343+ return 1;344344+345345+ if (pte_young(pte) != pte_young(orig_pte))346346+ return 1;347347+ }348348+349349+ return 0;350350+}351351+326352int huge_ptep_set_access_flags(struct vm_area_struct *vma,327353 unsigned long addr, pte_t *ptep,328354 pte_t pte, int dirty)329355{330330- int ncontig, i, changed = 0;356356+ int ncontig, i;331357 size_t pgsize = 0;332358 unsigned long pfn = pte_pfn(pte), dpfn;333359 pgprot_t hugeprot;···368336 ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize);369337 dpfn = pgsize >> PAGE_SHIFT;370338371371- orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig);372372- if (!pte_same(orig_pte, pte))373373- changed = 1;339339+ if (!__cont_access_flags_changed(ptep, pte, ncontig))340340+ return 0;374341375375- /* Make sure we don't lose the dirty state */342342+ orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig);343343+344344+ /* Make sure we don't lose the dirty or young state */376345 if (pte_dirty(orig_pte))377346 pte = pte_mkdirty(pte);347347+348348+ if (pte_young(orig_pte))349349+ pte = pte_mkyoung(pte);378350379351 hugeprot = pte_pgprot(pte);380352 for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn)381353 set_pte_at(vma->vm_mm, addr, ptep, pfn_pte(pfn, hugeprot));382354383383- return changed;355355+ return 1;384356}385357386358void huge_ptep_set_wrprotect(struct mm_struct *mm,
+10
arch/powerpc/kernel/process.c
···1306130613071307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));1308130813091309+ /*13101310+ * Make sure the NIP points at userspace, not kernel text/data or13111311+ * elsewhere.13121312+ */13131313+ if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {13141314+ pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",13151315+ current->comm, current->pid);13161316+ return;13171317+ }13181318+13091319 pr_info("%s[%d]: code: ", current->comm, current->pid);1310132013111321 for (i = 0; i < instructions_to_print; i++) {
+10
arch/powerpc/kvm/book3s_64_mmu_radix.c
···646646 */647647 local_irq_disable();648648 ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);649649+ /*650650+ * If the PTE disappeared temporarily due to a THP651651+ * collapse, just return and let the guest try again.652652+ */653653+ if (!ptep) {654654+ local_irq_enable();655655+ if (page)656656+ put_page(page);657657+ return RESUME_GUEST;658658+ }649659 pte = *ptep;650660 local_irq_enable();651661
+12-8
arch/powerpc/lib/code-patching.c
···2828{2929 int err;30303131- /* Make sure we aren't patching a freed init section */3232- if (init_mem_is_free && init_section_contains(exec_addr, 4)) {3333- pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);3434- return 0;3535- }3636-3731 __put_user_size(instr, patch_addr, 4, err);3832 if (err)3933 return err;···142148 return 0;143149}144150145145-int patch_instruction(unsigned int *addr, unsigned int instr)151151+static int do_patch_instruction(unsigned int *addr, unsigned int instr)146152{147153 int err;148154 unsigned int *patch_addr = NULL;···182188}183189#else /* !CONFIG_STRICT_KERNEL_RWX */184190185185-int patch_instruction(unsigned int *addr, unsigned int instr)191191+static int do_patch_instruction(unsigned int *addr, unsigned int instr)186192{187193 return raw_patch_instruction(addr, instr);188194}189195190196#endif /* CONFIG_STRICT_KERNEL_RWX */197197+198198+int patch_instruction(unsigned int *addr, unsigned int instr)199199+{200200+ /* Make sure we aren't patching a freed init section */201201+ if (init_mem_is_free && init_section_contains(addr, 4)) {202202+ pr_debug("Skipping init section patching addr: 0x%px\n", addr);203203+ return 0;204204+ }205205+ return do_patch_instruction(addr, instr);206206+}191207NOKPROBE_SYMBOL(patch_instruction);192208193209int patch_branch(unsigned int *addr, unsigned long target, int flags)
+3-2
arch/powerpc/mm/numa.c
···12171217 * Need to ensure that NODE_DATA is initialized for a node from12181218 * available memory (see memblock_alloc_try_nid). If unable to12191219 * init the node, then default to nearest node that has memory12201220- * installed.12201220+ * installed. Skip onlining a node if the subsystems are not12211221+ * yet initialized.12211222 */12221222- if (try_online_node(new_nid))12231223+ if (!topology_inited || try_online_node(new_nid))12231224 new_nid = first_online_node;12241225#else12251226 /*
···36363737static int num_counters_llc;3838static int num_counters_nb;3939+static bool l3_mask;39404041static HLIST_HEAD(uncore_unused_list);4142···209208 /* and we do not enable counter overflow interrupts */210209 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;211210 hwc->idx = -1;211211+212212+ /*213213+ * SliceMask and ThreadMask need to be set for certain L3 events in214214+ * Family 17h. For other events, the two fields do not affect the count.215215+ */216216+ if (l3_mask)217217+ hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);212218213219 if (event->cpu < 0)214220 return -EINVAL;···533525 amd_llc_pmu.name = "amd_l3";534526 format_attr_event_df.show = &event_show_df;535527 format_attr_event_l3.show = &event_show_l3;528528+ l3_mask = true;536529 } else {537530 num_counters_nb = NUM_COUNTERS_NB;538531 num_counters_llc = NUM_COUNTERS_L2;···541532 amd_llc_pmu.name = "amd_l2";542533 format_attr_event_df = format_attr_event;543534 format_attr_event_l3 = format_attr_event;535535+ l3_mask = false;544536 }545537546538 amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
···922922static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)923923{924924 /* AMD errata T13 (order #21922) */925925- if ((c->x86 == 6)) {925925+ if (c->x86 == 6) {926926 /* Duron Rev A0 */927927 if (c->x86_model == 3 && c->x86_stepping == 0)928928 size = 64;
+4
arch/x86/kernel/tsc.c
···2626#include <asm/apic.h>2727#include <asm/intel-family.h>2828#include <asm/i8259.h>2929+#include <asm/uv/uv.h>29303031unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */3132EXPORT_SYMBOL(cpu_khz);···14331432void __init tsc_early_init(void)14341433{14351434 if (!boot_cpu_has(X86_FEATURE_TSC))14351435+ return;14361436+ /* Don't change UV TSC multi-chassis synchronization */14371437+ if (is_early_uv_system())14361438 return;14371439 if (!determine_cpu_tsc_frequencies(true))14381440 return;
+20-4
arch/x86/kvm/mmu.c
···249249 */250250static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;251251252252+/*253253+ * In some cases, we need to preserve the GFN of a non-present or reserved254254+ * SPTE when we usurp the upper five bits of the physical address space to255255+ * defend against L1TF, e.g. for MMIO SPTEs. To preserve the GFN, we'll256256+ * shift bits of the GFN that overlap with shadow_nonpresent_or_rsvd_mask257257+ * left into the reserved bits, i.e. the GFN in the SPTE will be split into258258+ * high and low parts. This mask covers the lower bits of the GFN.259259+ */260260+static u64 __read_mostly shadow_nonpresent_or_rsvd_lower_gfn_mask;261261+262262+252263static void mmu_spte_set(u64 *sptep, u64 spte);253264static union kvm_mmu_page_role254265kvm_mmu_calc_root_page_role(struct kvm_vcpu *vcpu);···368357369358static gfn_t get_mmio_spte_gfn(u64 spte)370359{371371- u64 mask = generation_mmio_spte_mask(MMIO_GEN_MASK) | shadow_mmio_mask |372372- shadow_nonpresent_or_rsvd_mask;373373- u64 gpa = spte & ~mask;360360+ u64 gpa = spte & shadow_nonpresent_or_rsvd_lower_gfn_mask;374361375362 gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len)376363 & shadow_nonpresent_or_rsvd_mask;···432423433424static void kvm_mmu_reset_all_pte_masks(void)434425{426426+ u8 low_phys_bits;427427+435428 shadow_user_mask = 0;436429 shadow_accessed_mask = 0;437430 shadow_dirty_mask = 0;···448437 * appropriate mask to guard against L1TF attacks. Otherwise, it is449438 * assumed that the CPU is not vulnerable to L1TF.450439 */440440+ low_phys_bits = boot_cpu_data.x86_phys_bits;451441 if (boot_cpu_data.x86_phys_bits <452452- 52 - shadow_nonpresent_or_rsvd_mask_len)442442+ 52 - shadow_nonpresent_or_rsvd_mask_len) {453443 shadow_nonpresent_or_rsvd_mask =454444 rsvd_bits(boot_cpu_data.x86_phys_bits -455445 shadow_nonpresent_or_rsvd_mask_len,456446 boot_cpu_data.x86_phys_bits - 1);447447+ low_phys_bits -= shadow_nonpresent_or_rsvd_mask_len;448448+ }449449+ shadow_nonpresent_or_rsvd_lower_gfn_mask =450450+ GENMASK_ULL(low_phys_bits - 1, PAGE_SHIFT);457451}458452459453static int is_cpuid_PSE36(void)
+75-60
arch/x86/kvm/vmx.c
···121121122122#define MSR_BITMAP_MODE_X2APIC 1123123#define MSR_BITMAP_MODE_X2APIC_APICV 2124124-#define MSR_BITMAP_MODE_LM 4125124126125#define KVM_VMX_TSC_MULTIPLIER_MAX 0xffffffffffffffffULL127126···856857857858 /* to migrate it to L2 if VM_ENTRY_LOAD_DEBUG_CONTROLS is off */858859 u64 vmcs01_debugctl;860860+ u64 vmcs01_guest_bndcfgs;859861860862 u16 vpid02;861863 u16 last_vpid;···28992899 vmx->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);29002900 }2901290129022902- if (is_long_mode(&vmx->vcpu))29032903- wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);29022902+ wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);29042903#else29052904 savesegment(fs, fs_sel);29062905 savesegment(gs, gs_sel);···29502951 vmx->loaded_cpu_state = NULL;2951295229522953#ifdef CONFIG_X86_6429532953- if (is_long_mode(&vmx->vcpu))29542954- rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);29542954+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);29552955#endif29562956 if (host_state->ldt_sel || (host_state->gs_sel & 7)) {29572957 kvm_load_ldt(host_state->ldt_sel);···29782980#ifdef CONFIG_X86_6429792981static u64 vmx_read_guest_kernel_gs_base(struct vcpu_vmx *vmx)29802982{29812981- if (is_long_mode(&vmx->vcpu)) {29822982- preempt_disable();29832983- if (vmx->loaded_cpu_state)29842984- rdmsrl(MSR_KERNEL_GS_BASE,29852985- vmx->msr_guest_kernel_gs_base);29862986- preempt_enable();29872987- }29832983+ preempt_disable();29842984+ if (vmx->loaded_cpu_state)29852985+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);29862986+ preempt_enable();29882987 return vmx->msr_guest_kernel_gs_base;29892988}2990298929912990static void vmx_write_guest_kernel_gs_base(struct vcpu_vmx *vmx, u64 data)29922991{29932993- if (is_long_mode(&vmx->vcpu)) {29942994- preempt_disable();29952995- if (vmx->loaded_cpu_state)29962996- wrmsrl(MSR_KERNEL_GS_BASE, data);29972997- preempt_enable();29982998- }29922992+ preempt_disable();29932993+ if (vmx->loaded_cpu_state)29942994+ wrmsrl(MSR_KERNEL_GS_BASE, data);29952995+ preempt_enable();29992996 vmx->msr_guest_kernel_gs_base = data;30002997}30012998#endif···35263533 VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER |35273534 VM_EXIT_SAVE_VMX_PREEMPTION_TIMER | VM_EXIT_ACK_INTR_ON_EXIT;3528353535293529- if (kvm_mpx_supported())35303530- msrs->exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS;35313531-35323536 /* We support free control of debug control saving. */35333537 msrs->exit_ctls_low &= ~VM_EXIT_SAVE_DEBUG_CONTROLS;35343538···35423552 VM_ENTRY_LOAD_IA32_PAT;35433553 msrs->entry_ctls_high |=35443554 (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR | VM_ENTRY_LOAD_IA32_EFER);35453545- if (kvm_mpx_supported())35463546- msrs->entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS;3547355535483556 /* We support free control of debug control loading. */35493557 msrs->entry_ctls_low &= ~VM_ENTRY_LOAD_DEBUG_CONTROLS;···35893601 msrs->secondary_ctls_high);35903602 msrs->secondary_ctls_low = 0;35913603 msrs->secondary_ctls_high &=35923592- SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |35933604 SECONDARY_EXEC_DESC |35943605 SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |35953606 SECONDARY_EXEC_APIC_REGISTER_VIRT |35963607 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |35973608 SECONDARY_EXEC_WBINVD_EXITING;36093609+35983610 /*35993611 * We can emulate "VMCS shadowing," even if the hardware36003612 * doesn't support it.···36503662 if (enable_unrestricted_guest)36513663 msrs->secondary_ctls_high |=36523664 SECONDARY_EXEC_UNRESTRICTED_GUEST;36653665+36663666+ if (flexpriority_enabled)36673667+ msrs->secondary_ctls_high |=36683668+ SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;3653366936543670 /* miscellaneous data */36553671 rdmsr(MSR_IA32_VMX_MISC,···50655073 if (!msr)50665074 return;5067507550685068- /*50695069- * MSR_KERNEL_GS_BASE is not intercepted when the guest is in50705070- * 64-bit mode as a 64-bit kernel may frequently access the50715071- * MSR. This means we need to manually save/restore the MSR50725072- * when switching between guest and host state, but only if50735073- * the guest is in 64-bit mode. Sync our cached value if the50745074- * guest is transitioning to 32-bit mode and the CPU contains50755075- * guest state, i.e. the cache is stale.50765076- */50775077-#ifdef CONFIG_X86_6450785078- if (!(efer & EFER_LMA))50795079- (void)vmx_read_guest_kernel_gs_base(vmx);50805080-#endif50815076 vcpu->arch.efer = efer;50825077 if (efer & EFER_LMA) {50835078 vm_entry_controls_setbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);···60576078 mode |= MSR_BITMAP_MODE_X2APIC_APICV;60586079 }6059608060606060- if (is_long_mode(vcpu))60616061- mode |= MSR_BITMAP_MODE_LM;60626062-60636081 return mode;60646082}60656083···6096612060976121 if (!changed)60986122 return;60996099-61006100- vmx_set_intercept_for_msr(msr_bitmap, MSR_KERNEL_GS_BASE, MSR_TYPE_RW,61016101- !(mode & MSR_BITMAP_MODE_LM));6102612361036124 if (changed & (MSR_BITMAP_MODE_X2APIC | MSR_BITMAP_MODE_X2APIC_APICV))61046125 vmx_update_msr_bitmap_x2apic(msr_bitmap, mode);···61626189 nested_mark_vmcs12_pages_dirty(vcpu);61636190}6164619161926192+static u8 vmx_get_rvi(void)61936193+{61946194+ return vmcs_read16(GUEST_INTR_STATUS) & 0xff;61956195+}61966196+61656197static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)61666198{61676199 struct vcpu_vmx *vmx = to_vmx(vcpu);···61796201 WARN_ON_ONCE(!vmx->nested.virtual_apic_page))61806202 return false;6181620361826182- rvi = vmcs_read16(GUEST_INTR_STATUS) & 0xff;62046204+ rvi = vmx_get_rvi();6183620561846206 vapic_page = kmap(vmx->nested.virtual_apic_page);61856207 vppr = *((u32 *)(vapic_page + APIC_PROCPRI));···1022310245 if (!lapic_in_kernel(vcpu))1022410246 return;10225102471024810248+ if (!flexpriority_enabled &&1024910249+ !cpu_has_vmx_virtualize_x2apic_mode())1025010250+ return;1025110251+1022610252 /* Postpone execution until vmcs01 is the current VMCS. */1022710253 if (is_guest_mode(vcpu)) {1022810254 to_vmx(vcpu)->nested.change_vmcs01_virtual_apic_mode = true;1022910255 return;1023010256 }1023110231-1023210232- if (!cpu_need_tpr_shadow(vcpu))1023310233- return;10234102571023510258 sec_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);1023610259 sec_exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |···1035210373 }1035310374 vmx_hwapic_irr_update(vcpu, max_irr);1035410375 return max_irr;1037610376+}1037710377+1037810378+static u8 vmx_has_apicv_interrupt(struct kvm_vcpu *vcpu)1037910379+{1038010380+ u8 rvi = vmx_get_rvi();1038110381+ u8 vppr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_PROCPRI);1038210382+1038310383+ return ((rvi & 0xf0) > (vppr & 0xf0));1035510384}10356103851035710386static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)···1125111264#undef cr4_fixed1_update1125211265}11253112661126711267+static void nested_vmx_entry_exit_ctls_update(struct kvm_vcpu *vcpu)1126811268+{1126911269+ struct vcpu_vmx *vmx = to_vmx(vcpu);1127011270+1127111271+ if (kvm_mpx_supported()) {1127211272+ bool mpx_enabled = guest_cpuid_has(vcpu, X86_FEATURE_MPX);1127311273+1127411274+ if (mpx_enabled) {1127511275+ vmx->nested.msrs.entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS;1127611276+ vmx->nested.msrs.exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS;1127711277+ } else {1127811278+ vmx->nested.msrs.entry_ctls_high &= ~VM_ENTRY_LOAD_BNDCFGS;1127911279+ vmx->nested.msrs.exit_ctls_high &= ~VM_EXIT_CLEAR_BNDCFGS;1128011280+ }1128111281+ }1128211282+}1128311283+1125411284static void vmx_cpuid_update(struct kvm_vcpu *vcpu)1125511285{1125611286 struct vcpu_vmx *vmx = to_vmx(vcpu);···1128411280 to_vmx(vcpu)->msr_ia32_feature_control_valid_bits &=1128511281 ~FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;11286112821128711287- if (nested_vmx_allowed(vcpu))1128311283+ if (nested_vmx_allowed(vcpu)) {1128811284 nested_vmx_cr_fixed1_bits_update(vcpu);1128511285+ nested_vmx_entry_exit_ctls_update(vcpu);1128611286+ }1128911287}11290112881129111289static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)···12055120491205612050 set_cr4_guest_host_mask(vmx);12057120511205812058- if (vmx_mpx_supported())1205912059- vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);1205212052+ if (kvm_mpx_supported()) {1205312053+ if (vmx->nested.nested_run_pending &&1205412054+ (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))1205512055+ vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);1205612056+ else1205712057+ vmcs_write64(GUEST_BNDCFGS, vmx->nested.vmcs01_guest_bndcfgs);1205812058+ }12060120591206112060 if (enable_vpid) {1206212061 if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)···1260612595 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);1260712596 bool from_vmentry = !!exit_qual;1260812597 u32 dummy_exit_qual;1260912609- u32 vmcs01_cpu_exec_ctrl;1259812598+ bool evaluate_pending_interrupts;1261012599 int r = 0;12611126001261212612- vmcs01_cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);1260112601+ evaluate_pending_interrupts = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) &1260212602+ (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING);1260312603+ if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_active(vcpu))1260412604+ evaluate_pending_interrupts |= vmx_has_apicv_interrupt(vcpu);12613126051261412606 enter_guest_mode(vcpu);12615126071261612608 if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS))1261712609 vmx->nested.vmcs01_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);1261012610+ if (kvm_mpx_supported() &&1261112611+ !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))1261212612+ vmx->nested.vmcs01_guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);12618126131261912614 vmx_switch_vmcs(vcpu, &vmx->nested.vmcs02);1262012615 vmx_segment_cache_clear(vmx);···1266012643 * to L1 or delivered directly to L2 (e.g. In case L1 don't1266112644 * intercept EXTERNAL_INTERRUPT).1266212645 *1266312663- * Usually this would be handled by L0 requesting a1266412664- * IRQ/NMI window by setting VMCS accordingly. However,1266512665- * this setting was done on VMCS01 and now VMCS02 is active1266612666- * instead. Thus, we force L0 to perform pending event1266712667- * evaluation by requesting a KVM_REQ_EVENT.1264612646+ * Usually this would be handled by the processor noticing an1264712647+ * IRQ/NMI window request, or checking RVI during evaluation of1264812648+ * pending virtual interrupts. However, this setting was done1264912649+ * on VMCS01 and now VMCS02 is active instead. Thus, we force L01265012650+ * to perform pending event evaluation by requesting a KVM_REQ_EVENT.1266812651 */1266912669- if (vmcs01_cpu_exec_ctrl &1267012670- (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING)) {1265212652+ if (unlikely(evaluate_pending_interrupts))1267112653 kvm_make_request(KVM_REQ_EVENT, vcpu);1267212672- }12673126541267412655 /*1267512656 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
···358358 struct queue *q,359359 struct qcm_process_device *qpd)360360{361361- int retval;362361 struct mqd_manager *mqd_mgr;362362+ int retval;363363364364 mqd_mgr = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE);365365 if (!mqd_mgr)···387387 if (!q->properties.is_active)388388 return 0;389389390390- retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,391391- &q->properties, q->process->mm);390390+ if (WARN(q->process->mm != current->mm,391391+ "should only run in user thread"))392392+ retval = -EFAULT;393393+ else394394+ retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,395395+ &q->properties, current->mm);392396 if (retval)393397 goto out_uninit_mqd;394398···549545 retval = map_queues_cpsch(dqm);550546 else if (q->properties.is_active &&551547 (q->properties.type == KFD_QUEUE_TYPE_COMPUTE ||552552- q->properties.type == KFD_QUEUE_TYPE_SDMA))553553- retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,554554- &q->properties, q->process->mm);548548+ q->properties.type == KFD_QUEUE_TYPE_SDMA)) {549549+ if (WARN(q->process->mm != current->mm,550550+ "should only run in user thread"))551551+ retval = -EFAULT;552552+ else553553+ retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd,554554+ q->pipe, q->queue,555555+ &q->properties, current->mm);556556+ }555557556558out_unlock:557559 dqm_unlock(dqm);···663653static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,664654 struct qcm_process_device *qpd)665655{656656+ struct mm_struct *mm = NULL;666657 struct queue *q;667658 struct mqd_manager *mqd_mgr;668659 struct kfd_process_device *pdd;···697686 kfd_flush_tlb(pdd);698687 }699688689689+ /* Take a safe reference to the mm_struct, which may otherwise690690+ * disappear even while the kfd_process is still referenced.691691+ */692692+ mm = get_task_mm(pdd->process->lead_thread);693693+ if (!mm) {694694+ retval = -EFAULT;695695+ goto out;696696+ }697697+700698 /* activate all active queues on the qpd */701699 list_for_each_entry(q, &qpd->queues_list, list) {702700 if (!q->properties.is_evicted)···720700 q->properties.is_evicted = false;721701 q->properties.is_active = true;722702 retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe,723723- q->queue, &q->properties,724724- q->process->mm);703703+ q->queue, &q->properties, mm);725704 if (retval)726705 goto out;727706 dqm->queue_count++;728707 }729708 qpd->evicted = 0;730709out:710710+ if (mm)711711+ mmput(mm);731712 dqm_unlock(dqm);732713 return retval;733714}
+8-2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
···46334633 }46344634 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);4635463546364636- /* Signal HW programming completion */46374637- drm_atomic_helper_commit_hw_done(state);4638463646394637 if (wait_for_vblank)46404638 drm_atomic_helper_wait_for_flip_done(dev, state);46394639+46404640+ /*46414641+ * FIXME:46424642+ * Delay hw_done() until flip_done() is signaled. This is to block46434643+ * another commit from freeing the CRTC state while we're still46444644+ * waiting on flip_done.46454645+ */46464646+ drm_atomic_helper_commit_hw_done(state);4641464746424648 drm_atomic_helper_cleanup_planes(dev, state);46434649
+26-9
drivers/gpu/drm/drm_client.c
···6363EXPORT_SYMBOL(drm_client_close);64646565/**6666- * drm_client_new - Create a DRM client6666+ * drm_client_init - Initialise a DRM client6767 * @dev: DRM device6868 * @client: DRM client6969 * @name: Client name7070 * @funcs: DRM client functions (optional)7171 *7272+ * This initialises the client and opens a &drm_file. Use drm_client_add() to complete the process.7273 * The caller needs to hold a reference on @dev before calling this function.7374 * The client is freed when the &drm_device is unregistered. See drm_client_release().7475 *7576 * Returns:7677 * Zero on success or negative error code on failure.7778 */7878-int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,7979- const char *name, const struct drm_client_funcs *funcs)7979+int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,8080+ const char *name, const struct drm_client_funcs *funcs)8081{8182 int ret;8283···9695 if (ret)9796 goto err_put_module;98979999- mutex_lock(&dev->clientlist_mutex);100100- list_add(&client->list, &dev->clientlist);101101- mutex_unlock(&dev->clientlist_mutex);102102-10398 drm_dev_get(dev);10499105100 return 0;···106109107110 return ret;108111}109109-EXPORT_SYMBOL(drm_client_new);112112+EXPORT_SYMBOL(drm_client_init);113113+114114+/**115115+ * drm_client_add - Add client to the device list116116+ * @client: DRM client117117+ *118118+ * Add the client to the &drm_device client list to activate its callbacks.119119+ * @client must be initialized by a call to drm_client_init(). After120120+ * drm_client_add() it is no longer permissible to call drm_client_release()121121+ * directly (outside the unregister callback), instead cleanup will happen122122+ * automatically on driver unload.123123+ */124124+void drm_client_add(struct drm_client_dev *client)125125+{126126+ struct drm_device *dev = client->dev;127127+128128+ mutex_lock(&dev->clientlist_mutex);129129+ list_add(&client->list, &dev->clientlist);130130+ mutex_unlock(&dev->clientlist_mutex);131131+}132132+EXPORT_SYMBOL(drm_client_add);110133111134/**112135 * drm_client_release - Release DRM client resources113136 * @client: DRM client114137 *115115- * Releases resources by closing the &drm_file that was opened by drm_client_new().138138+ * Releases resources by closing the &drm_file that was opened by drm_client_init().116139 * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set.117140 *118141 * This function should only be called from the unregister callback. An exception
+3-1
drivers/gpu/drm/drm_fb_cma_helper.c
···160160161161 fb_helper = &fbdev_cma->fb_helper;162162163163- ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL);163163+ ret = drm_client_init(dev, &fb_helper->client, "fbdev", NULL);164164 if (ret)165165 goto err_free;166166···168168 preferred_bpp, max_conn_count);169169 if (ret)170170 goto err_client_put;171171+172172+ drm_client_add(&fb_helper->client);171173172174 return fbdev_cma;173175
+3-1
drivers/gpu/drm/drm_fb_helper.c
···32183218 if (!fb_helper)32193219 return -ENOMEM;3220322032213221- ret = drm_client_new(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);32213221+ ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);32223222 if (ret) {32233223 kfree(fb_helper);32243224 return ret;32253225 }32263226+32273227+ drm_client_add(&fb_helper->client);3226322832273229 fb_helper->preferred_bpp = preferred_bpp;32283230
+3-3
drivers/gpu/drm/drm_lease.c
···566566 lessee_priv->is_master = 1;567567 lessee_priv->authenticated = 1;568568569569- /* Hook up the fd */570570- fd_install(fd, lessee_file);571571-572569 /* Pass fd back to userspace */573570 DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);574571 cl->fd = fd;575572 cl->lessee_id = lessee->lessee_id;573573+574574+ /* Hook up the fd */575575+ fd_install(fd, lessee_file);576576577577 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");578578 return 0;
+6-28
drivers/gpu/drm/exynos/exynos_drm_iommu.h
···5555static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv,5656 unsigned long start, unsigned long size)5757{5858- struct iommu_domain *domain;5959- int ret;6060-6161- domain = iommu_domain_alloc(priv->dma_dev->bus);6262- if (!domain)6363- return -ENOMEM;6464-6565- ret = iommu_get_dma_cookie(domain);6666- if (ret)6767- goto free_domain;6868-6969- ret = iommu_dma_init_domain(domain, start, size, NULL);7070- if (ret)7171- goto put_cookie;7272-7373- priv->mapping = domain;5858+ priv->mapping = iommu_get_domain_for_dev(priv->dma_dev);7459 return 0;7575-7676-put_cookie:7777- iommu_put_dma_cookie(domain);7878-free_domain:7979- iommu_domain_free(domain);8080- return ret;8160}82618362static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv)8463{8585- struct iommu_domain *domain = priv->mapping;8686-8787- iommu_put_dma_cookie(domain);8888- iommu_domain_free(domain);8964 priv->mapping = NULL;9065}9166···6994{7095 struct iommu_domain *domain = priv->mapping;71967272- return iommu_attach_device(domain, dev);9797+ if (dev != priv->dma_dev)9898+ return iommu_attach_device(domain, dev);9999+ return 0;73100}7410175102static inline void __exynos_iommu_detach(struct exynos_drm_private *priv,···79102{80103 struct iommu_domain *domain = priv->mapping;811048282- iommu_detach_device(domain, dev);105105+ if (dev != priv->dma_dev)106106+ iommu_detach_device(domain, dev);83107}84108#else85109#error Unsupported architecture and IOMMU/DMA-mapping glue code
+3-2
drivers/gpu/drm/i2c/tda9950.c
···191191 break;192192 }193193 /* TDA9950 executes all retries for us */194194- tx_status |= CEC_TX_STATUS_MAX_RETRIES;194194+ if (tx_status != CEC_TX_STATUS_OK)195195+ tx_status |= CEC_TX_STATUS_MAX_RETRIES;195196 cec_transmit_done(priv->adap, tx_status, arb_lost_cnt,196197 nack_cnt, 0, err_cnt);197198 break;···311310 /* Wait up to .5s for it to signal non-busy */312311 do {313312 csr = tda9950_read(client, REG_CSR);314314- if (!(csr & CSR_BUSY) || --timeout)313313+ if (!(csr & CSR_BUSY) || !--timeout)315314 break;316315 msleep(10);317316 } while (1);
+63-25
drivers/gpu/drm/i915/i915_gpu_error.c
···232232 return true;233233}234234235235+static void *compress_next_page(struct drm_i915_error_object *dst)236236+{237237+ unsigned long page;238238+239239+ if (dst->page_count >= dst->num_pages)240240+ return ERR_PTR(-ENOSPC);241241+242242+ page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);243243+ if (!page)244244+ return ERR_PTR(-ENOMEM);245245+246246+ return dst->pages[dst->page_count++] = (void *)page;247247+}248248+235249static int compress_page(struct compress *c,236250 void *src,237251 struct drm_i915_error_object *dst)···259245260246 do {261247 if (zstream->avail_out == 0) {262262- unsigned long page;248248+ zstream->next_out = compress_next_page(dst);249249+ if (IS_ERR(zstream->next_out))250250+ return PTR_ERR(zstream->next_out);263251264264- page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);265265- if (!page)266266- return -ENOMEM;267267-268268- dst->pages[dst->page_count++] = (void *)page;269269-270270- zstream->next_out = (void *)page;271252 zstream->avail_out = PAGE_SIZE;272253 }273254274274- if (zlib_deflate(zstream, Z_SYNC_FLUSH) != Z_OK)255255+ if (zlib_deflate(zstream, Z_NO_FLUSH) != Z_OK)275256 return -EIO;276257 } while (zstream->avail_in);277258···277268 return 0;278269}279270271271+static int compress_flush(struct compress *c,272272+ struct drm_i915_error_object *dst)273273+{274274+ struct z_stream_s *zstream = &c->zstream;275275+276276+ do {277277+ switch (zlib_deflate(zstream, Z_FINISH)) {278278+ case Z_OK: /* more space requested */279279+ zstream->next_out = compress_next_page(dst);280280+ if (IS_ERR(zstream->next_out))281281+ return PTR_ERR(zstream->next_out);282282+283283+ zstream->avail_out = PAGE_SIZE;284284+ break;285285+286286+ case Z_STREAM_END:287287+ goto end;288288+289289+ default: /* any error */290290+ return -EIO;291291+ }292292+ } while (1);293293+294294+end:295295+ memset(zstream->next_out, 0, zstream->avail_out);296296+ dst->unused = zstream->avail_out;297297+ return 0;298298+}299299+280300static void compress_fini(struct compress *c,281301 struct drm_i915_error_object *dst)282302{283303 struct z_stream_s *zstream = &c->zstream;284304285285- if (dst) {286286- zlib_deflate(zstream, Z_FINISH);287287- dst->unused = zstream->avail_out;288288- }289289-290305 zlib_deflateEnd(zstream);291306 kfree(zstream->workspace);292292-293307 if (c->tmp)294308 free_page((unsigned long)c->tmp);295309}···348316 memcpy(ptr, src, PAGE_SIZE);349317 dst->pages[dst->page_count++] = ptr;350318319319+ return 0;320320+}321321+322322+static int compress_flush(struct compress *c,323323+ struct drm_i915_error_object *dst)324324+{351325 return 0;352326}353327···955917 unsigned long num_pages;956918 struct sgt_iter iter;957919 dma_addr_t dma;920920+ int ret;958921959922 if (!vma)960923 return NULL;···969930970931 dst->gtt_offset = vma->node.start;971932 dst->gtt_size = vma->node.size;933933+ dst->num_pages = num_pages;972934 dst->page_count = 0;973935 dst->unused = 0;974936···978938 return NULL;979939 }980940941941+ ret = -EINVAL;981942 for_each_sgt_dma(dma, iter, vma->pages) {982943 void __iomem *s;983983- int ret;984944985945 ggtt->vm.insert_page(&ggtt->vm, dma, slot, I915_CACHE_NONE, 0);986946987947 s = io_mapping_map_atomic_wc(&ggtt->iomap, slot);988948 ret = compress_page(&compress, (void __force *)s, dst);989949 io_mapping_unmap_atomic(s);990990-991950 if (ret)992992- goto unwind;951951+ break;993952 }994994- goto out;995953996996-unwind:997997- while (dst->page_count--)998998- free_page((unsigned long)dst->pages[dst->page_count]);999999- kfree(dst);10001000- dst = NULL;954954+ if (ret || compress_flush(&compress, dst)) {955955+ while (dst->page_count--)956956+ free_page((unsigned long)dst->pages[dst->page_count]);957957+ kfree(dst);958958+ dst = NULL;959959+ }100196010021002-out:1003961 compress_fini(&compress, dst);1004962 ggtt->vm.clear_range(&ggtt->vm, slot, PAGE_SIZE);1005963 return dst;
+1
drivers/gpu/drm/i915/i915_gpu_error.h
···135135 struct drm_i915_error_object {136136 u64 gtt_offset;137137 u64 gtt_size;138138+ int num_pages;138139 int page_count;139140 int unused;140141 u32 *pages[0];
···4747/* quirks to control the device */4848#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)4949#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)5050-#define I2C_HID_QUIRK_RESEND_REPORT_DESCR BIT(2)5050+#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)51515252/* flags */5353#define I2C_HID_STARTED 0···169169 { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,170170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },171171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,172172- I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },173173- { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,174174- I2C_HID_QUIRK_RESEND_REPORT_DESCR },172172+ I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |173173+ I2C_HID_QUIRK_NO_RUNTIME_PM },175174 { 0, 0 }176175};177176···11041105 goto err_mem_free;11051106 }1106110711071107- pm_runtime_put(&client->dev);11081108+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))11091109+ pm_runtime_put(&client->dev);11101110+11081111 return 0;1109111211101113err_mem_free:···11311130 struct i2c_hid *ihid = i2c_get_clientdata(client);11321131 struct hid_device *hid;1133113211341134- pm_runtime_get_sync(&client->dev);11331133+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))11341134+ pm_runtime_get_sync(&client->dev);11351135 pm_runtime_disable(&client->dev);11361136 pm_runtime_set_suspended(&client->dev);11371137 pm_runtime_put_noidle(&client->dev);···1238123612391237 /* Instead of resetting device, simply powers the device on. This12401238 * solves "incomplete reports" on Raydium devices 2386:3118 and12411241- * 2386:4B3312391239+ * 2386:4B33 and fixes various SIS touchscreens no longer sending12401240+ * data after a suspend/resume.12421241 */12431242 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);12441243 if (ret)12451244 return ret;12461246-12471247- /* Some devices need to re-send report descr cmd12481248- * after resume, after this it will be back normal.12491249- * otherwise it issues too many incomplete reports.12501250- */12511251- if (ihid->quirks & I2C_HID_QUIRK_RESEND_REPORT_DESCR) {12521252- ret = i2c_hid_command(client, &hid_report_descr_cmd, NULL, 0);12531253- if (ret)12541254- return ret;12551255- }1256124512571246 if (hid->driver && hid->driver->reset_resume) {12581247 ret = hid->driver->reset_resume(hid);
···7676 __u32 version)7777{7878 int ret = 0;7979+ unsigned int cur_cpu;7980 struct vmbus_channel_initiate_contact *msg;8081 unsigned long flags;8182···119118 * the CPU attempting to connect may not be CPU 0.120119 */121120 if (version >= VERSION_WIN8_1) {122122- msg->target_vcpu =123123- hv_cpu_number_to_vp_number(smp_processor_id());124124- vmbus_connection.connect_cpu = smp_processor_id();121121+ cur_cpu = get_cpu();122122+ msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);123123+ vmbus_connection.connect_cpu = cur_cpu;124124+ put_cpu();125125 } else {126126 msg->target_vcpu = 0;127127 vmbus_connection.connect_cpu = 0;
+3-1
drivers/i2c/busses/i2c-designware-master.c
···34343535static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)3636{3737- u32 ic_clk = i2c_dw_clk_rate(dev);3837 const char *mode_str, *fp_str = "";3938 u32 comp_param1;4039 u32 sda_falling_time, scl_falling_time;4140 struct i2c_timings *t = &dev->timings;4141+ u32 ic_clk;4242 int ret;43434444 ret = i2c_dw_acquire_lock(dev);···53535454 /* Calculate SCL timing parameters for standard mode if not set */5555 if (!dev->ss_hcnt || !dev->ss_lcnt) {5656+ ic_clk = i2c_dw_clk_rate(dev);5657 dev->ss_hcnt =5758 i2c_dw_scl_hcnt(ic_clk,5859 4000, /* tHD;STA = tHIGH = 4.0 us */···9089 * needed also in high speed mode.9190 */9291 if (!dev->fs_hcnt || !dev->fs_lcnt) {9292+ ic_clk = i2c_dw_clk_rate(dev);9393 dev->fs_hcnt =9494 i2c_dw_scl_hcnt(ic_clk,9595 600, /* tHD;STA = tHIGH = 0.6 us */
+1-1
drivers/i2c/busses/i2c-isch.c
···164164 * run ~75 kHz instead which should do no harm.165165 */166166 dev_notice(&sch_adapter.dev,167167- "Clock divider unitialized. Setting defaults\n");167167+ "Clock divider uninitialized. Setting defaults\n");168168 outw(backbone_speed / (4 * 100), SMBHSTCLK);169169 }170170
···14551455 if (hints_valid) {14561456 r = dm_array_cursor_next(&cmd->hint_cursor);14571457 if (r) {14581458- DMERR("dm_array_cursor_next for hint failed");14591459- goto out;14581458+ dm_array_cursor_end(&cmd->hint_cursor);14591459+ hints_valid = false;14601460 }14611461 }14621462
+7-2
drivers/md/dm-cache-target.c
···3009300930103010static bool can_resize(struct cache *cache, dm_cblock_t new_size)30113011{30123012- if (from_cblock(new_size) > from_cblock(cache->cache_size))30133013- return true;30123012+ if (from_cblock(new_size) > from_cblock(cache->cache_size)) {30133013+ if (cache->sized) {30143014+ DMERR("%s: unable to extend cache due to missing cache table reload",30153015+ cache_device_name(cache));30163016+ return false;30173017+ }30183018+ }3014301930153020 /*30163021 * We can't drop a dirty block when shrinking the cache.
+8-6
drivers/md/dm-mpath.c
···806806}807807808808static int setup_scsi_dh(struct block_device *bdev, struct multipath *m,809809- const char *attached_handler_name, char **error)809809+ const char **attached_handler_name, char **error)810810{811811 struct request_queue *q = bdev_get_queue(bdev);812812 int r;813813814814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) {815815retain:816816- if (attached_handler_name) {816816+ if (*attached_handler_name) {817817 /*818818 * Clear any hw_handler_params associated with a819819 * handler that isn't already attached.820820 */821821- if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) {821821+ if (m->hw_handler_name && strcmp(*attached_handler_name, m->hw_handler_name)) {822822 kfree(m->hw_handler_params);823823 m->hw_handler_params = NULL;824824 }···830830 * handler instead of the original table passed in.831831 */832832 kfree(m->hw_handler_name);833833- m->hw_handler_name = attached_handler_name;833833+ m->hw_handler_name = *attached_handler_name;834834+ *attached_handler_name = NULL;834835 }835836 }836837···868867 struct pgpath *p;869868 struct multipath *m = ti->private;870869 struct request_queue *q;871871- const char *attached_handler_name;870870+ const char *attached_handler_name = NULL;872871873872 /* we need at least a path arg */874873 if (as->argc < 1) {···891890 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);892891 if (attached_handler_name || m->hw_handler_name) {893892 INIT_DELAYED_WORK(&p->activate_path, activate_path_work);894894- r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error);893893+ r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error);895894 if (r) {896895 dm_put_device(ti, p->path.dev);897896 goto bad;···906905907906 return p;908907 bad:908908+ kfree(attached_handler_name);909909 free_pgpath(p);910910 return ERR_PTR(r);911911}
+1-1
drivers/md/dm-raid.c
···33533353};3354335433553355/* Return enum sync_state for @mddev derived from @recovery flags */33563356-static const enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)33563356+static enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)33573357{33583358 if (test_bit(MD_RECOVERY_FROZEN, &recovery))33593359 return st_frozen;
+2-4
drivers/md/dm-thin-metadata.c
···832832 if (r) {833833 DMERR("could not get size of metadata device");834834 pmd->metadata_reserve = max_blocks;835835- } else {836836- sector_div(total, 10);837837- pmd->metadata_reserve = min(max_blocks, total);838838- }835835+ } else836836+ pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));839837}840838841839struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
+20-18
drivers/media/v4l2-core/v4l2-event.c
···115115 if (sev == NULL)116116 return;117117118118- /*119119- * If the event has been added to the fh->subscribed list, but its120120- * add op has not completed yet elems will be 0, treat this as121121- * not being subscribed.122122- */123123- if (!sev->elems)124124- return;125125-126118 /* Increase event sequence number on fh. */127119 fh->sequence++;128120···200208 struct v4l2_subscribed_event *sev, *found_ev;201209 unsigned long flags;202210 unsigned i;211211+ int ret = 0;203212204213 if (sub->type == V4L2_EVENT_ALL)205214 return -EINVAL;···218225 sev->flags = sub->flags;219226 sev->fh = fh;220227 sev->ops = ops;228228+ sev->elems = elems;229229+230230+ mutex_lock(&fh->subscribe_lock);221231222232 spin_lock_irqsave(&fh->vdev->fh_lock, flags);223233 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);224224- if (!found_ev)225225- list_add(&sev->list, &fh->subscribed);226234 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);227235228236 if (found_ev) {237237+ /* Already listening */229238 kvfree(sev);230230- return 0; /* Already listening */239239+ goto out_unlock;231240 }232241233242 if (sev->ops && sev->ops->add) {234234- int ret = sev->ops->add(sev, elems);243243+ ret = sev->ops->add(sev, elems);235244 if (ret) {236236- sev->ops = NULL;237237- v4l2_event_unsubscribe(fh, sub);238238- return ret;245245+ kvfree(sev);246246+ goto out_unlock;239247 }240248 }241249242242- /* Mark as ready for use */243243- sev->elems = elems;250250+ spin_lock_irqsave(&fh->vdev->fh_lock, flags);251251+ list_add(&sev->list, &fh->subscribed);252252+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);244253245245- return 0;254254+out_unlock:255255+ mutex_unlock(&fh->subscribe_lock);256256+257257+ return ret;246258}247259EXPORT_SYMBOL_GPL(v4l2_event_subscribe);248260···286288 return 0;287289 }288290291291+ mutex_lock(&fh->subscribe_lock);292292+289293 spin_lock_irqsave(&fh->vdev->fh_lock, flags);290294291295 sev = v4l2_event_subscribed(fh, sub->type, sub->id);···304304305305 if (sev && sev->ops && sev->ops->del)306306 sev->ops->del(sev);307307+308308+ mutex_unlock(&fh->subscribe_lock);307309308310 kvfree(sev);309311
···235235 host->caps |= MMC_CAP_NEEDS_POLL;236236237237 ret = mmc_gpiod_request_cd(host, "cd", 0, true,238238- cd_debounce_delay_ms,238238+ cd_debounce_delay_ms * 1000,239239 &cd_gpio_invert);240240 if (!ret)241241 dev_info(host->parent, "Got CD GPIO\n");
+1-1
drivers/mmc/core/slot-gpio.c
···271271 if (debounce) {272272 ret = gpiod_set_debounce(desc, debounce);273273 if (ret < 0)274274- ctx->cd_debounce_delay_ms = debounce;274274+ ctx->cd_debounce_delay_ms = debounce / 1000;275275 }276276277277 if (gpio_invert)
+2-1
drivers/mmc/host/renesas_sdhi_sys_dmac.c
···498498499499static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)500500{501501- if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible &&501501+ if ((of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible ||502502+ of_device_get_match_data(&pdev->dev) == &of_rcar_r8a7795_compatible) &&502503 !soc_device_match(gen3_soc_whitelist))503504 return -ENODEV;504505
+37-28
drivers/net/bonding/bond_main.c
···210210static void bond_slave_arr_handler(struct work_struct *work);211211static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,212212 int mod);213213+static void bond_netdev_notify_work(struct work_struct *work);213214214215/*---------------------------- General routines -----------------------------*/215216···11711170 }11721171 }1173117211741174- /* don't change skb->dev for link-local packets */11751175- if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))11731173+ /* Link-local multicast packets should be passed to the11741174+ * stack on the link they arrive as well as pass them to the11751175+ * bond-master device. These packets are mostly usable when11761176+ * stack receives it with the link on which they arrive11771177+ * (e.g. LLDP) they also must be available on master. Some of11781178+ * the use cases include (but are not limited to): LLDP agents11791179+ * that must be able to operate both on enslaved interfaces as11801180+ * well as on bonds themselves; linux bridges that must be able11811181+ * to process/pass BPDUs from attached bonds when any kind of11821182+ * STP version is enabled on the network.11831183+ */11841184+ if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) {11851185+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);11861186+11871187+ if (nskb) {11881188+ nskb->dev = bond->dev;11891189+ nskb->queue_mapping = 0;11901190+ netif_rx(nskb);11911191+ }11761192 return RX_HANDLER_PASS;11931193+ }11771194 if (bond_should_deliver_exact_match(skb, slave, bond))11781195 return RX_HANDLER_EXACT;11791196···12881269 return NULL;12891270 }12901271 }12721272+ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);12731273+12911274 return slave;12921275}12931276···12971276{12981277 struct bonding *bond = bond_get_bond_by_slave(slave);1299127812791279+ cancel_delayed_work_sync(&slave->notify_work);13001280 if (BOND_MODE(bond) == BOND_MODE_8023AD)13011281 kfree(SLAVE_AD_INFO(slave));13021282···13191297 info->link_failure_count = slave->link_failure_count;13201298}1321129913221322-static void bond_netdev_notify(struct net_device *dev,13231323- struct netdev_bonding_info *info)13241324-{13251325- rtnl_lock();13261326- netdev_bonding_info_change(dev, info);13271327- rtnl_unlock();13281328-}13291329-13301300static void bond_netdev_notify_work(struct work_struct *_work)13311301{13321332- struct netdev_notify_work *w =13331333- container_of(_work, struct netdev_notify_work, work.work);13021302+ struct slave *slave = container_of(_work, struct slave,13031303+ notify_work.work);1334130413351335- bond_netdev_notify(w->dev, &w->bonding_info);13361336- dev_put(w->dev);13371337- kfree(w);13051305+ if (rtnl_trylock()) {13061306+ struct netdev_bonding_info binfo;13071307+13081308+ bond_fill_ifslave(slave, &binfo.slave);13091309+ bond_fill_ifbond(slave->bond, &binfo.master);13101310+ netdev_bonding_info_change(slave->dev, &binfo);13111311+ rtnl_unlock();13121312+ } else {13131313+ queue_delayed_work(slave->bond->wq, &slave->notify_work, 1);13141314+ }13381315}1339131613401317void bond_queue_slave_event(struct slave *slave)13411318{13421342- struct bonding *bond = slave->bond;13431343- struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC);13441344-13451345- if (!nnw)13461346- return;13471347-13481348- dev_hold(slave->dev);13491349- nnw->dev = slave->dev;13501350- bond_fill_ifslave(slave, &nnw->bonding_info.slave);13511351- bond_fill_ifbond(bond, &nnw->bonding_info.master);13521352- INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work);13531353-13541354- queue_delayed_work(slave->bond->wq, &nnw->work, 0);13191319+ queue_delayed_work(slave->bond->wq, &slave->notify_work, 0);13551320}1356132113571322void bond_lower_state_changed(struct slave *slave)
···11581158 napi_disable(&fep->napi);11591159 netif_tx_lock_bh(ndev);11601160 fec_restart(ndev);11611161- netif_wake_queue(ndev);11611161+ netif_tx_wake_all_queues(ndev);11621162 netif_tx_unlock_bh(ndev);11631163 napi_enable(&fep->napi);11641164 }···1273127312741274 /* Since we have freed up a buffer, the ring is no longer full12751275 */12761276- if (netif_queue_stopped(ndev)) {12761276+ if (netif_tx_queue_stopped(nq)) {12771277 entries_free = fec_enet_get_free_txdesc_num(txq);12781278 if (entries_free >= txq->tx_wake_threshold)12791279 netif_tx_wake_queue(nq);···17461746 napi_disable(&fep->napi);17471747 netif_tx_lock_bh(ndev);17481748 fec_restart(ndev);17491749- netif_wake_queue(ndev);17491749+ netif_tx_wake_all_queues(ndev);17501750 netif_tx_unlock_bh(ndev);17511751 napi_enable(&fep->napi);17521752 }···22472247 napi_disable(&fep->napi);22482248 netif_tx_lock_bh(ndev);22492249 fec_restart(ndev);22502250- netif_wake_queue(ndev);22502250+ netif_tx_wake_all_queues(ndev);22512251 netif_tx_unlock_bh(ndev);22522252 napi_enable(&fep->napi);22532253 }
+1-1
drivers/net/ethernet/hisilicon/hns/hnae.c
···8484 if (cb->type == DESC_TYPE_SKB)8585 dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length,8686 ring_to_dma_dir(ring));8787- else8787+ else if (cb->length)8888 dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length,8989 ring_to_dma_dir(ring));9090}
+19-29
drivers/net/ethernet/hisilicon/hns/hns_enet.c
···4040#define SKB_TMP_LEN(SKB) \4141 (((SKB)->transport_header - (SKB)->mac_header) + tcp_hdrlen(SKB))42424343-static void fill_v2_desc(struct hnae_ring *ring, void *priv,4444- int size, dma_addr_t dma, int frag_end,4545- int buf_num, enum hns_desc_type type, int mtu)4343+static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size,4444+ int send_sz, dma_addr_t dma, int frag_end,4545+ int buf_num, enum hns_desc_type type, int mtu)4646{4747 struct hnae_desc *desc = &ring->desc[ring->next_to_use];4848 struct hnae_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use];···6464 desc_cb->type = type;65656666 desc->addr = cpu_to_le64(dma);6767- desc->tx.send_size = cpu_to_le16((u16)size);6767+ desc->tx.send_size = cpu_to_le16((u16)send_sz);68686969 /* config bd buffer end */7070 hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1);···131131 desc->tx.ra_ri_cs_fe_vld = rrcfv;132132133133 ring_ptr_move_fw(ring, next_to_use);134134+}135135+136136+static void fill_v2_desc(struct hnae_ring *ring, void *priv,137137+ int size, dma_addr_t dma, int frag_end,138138+ int buf_num, enum hns_desc_type type, int mtu)139139+{140140+ fill_v2_desc_hw(ring, priv, size, size, dma, frag_end,141141+ buf_num, type, mtu);134142}135143136144static const struct acpi_device_id hns_enet_acpi_match[] = {···297289298290 /* when the frag size is bigger than hardware, split this frag */299291 for (k = 0; k < frag_buf_num; k++)300300- fill_v2_desc(ring, priv,301301- (k == frag_buf_num - 1) ?292292+ fill_v2_desc_hw(ring, priv, k == 0 ? size : 0,293293+ (k == frag_buf_num - 1) ?302294 sizeoflast : BD_MAX_SEND_SIZE,303303- dma + BD_MAX_SEND_SIZE * k,304304- frag_end && (k == frag_buf_num - 1) ? 1 : 0,305305- buf_num,306306- (type == DESC_TYPE_SKB && !k) ?295295+ dma + BD_MAX_SEND_SIZE * k,296296+ frag_end && (k == frag_buf_num - 1) ? 1 : 0,297297+ buf_num,298298+ (type == DESC_TYPE_SKB && !k) ?307299 DESC_TYPE_SKB : DESC_TYPE_PAGE,308308- mtu);300300+ mtu);309301}310302311303netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev,···15031495 return phy_mii_ioctl(phy_dev, ifr, cmd);15041496}1505149715061506-/* use only for netconsole to poll with the device without interrupt */15071507-#ifdef CONFIG_NET_POLL_CONTROLLER15081508-static void hns_nic_poll_controller(struct net_device *ndev)15091509-{15101510- struct hns_nic_priv *priv = netdev_priv(ndev);15111511- unsigned long flags;15121512- int i;15131513-15141514- local_irq_save(flags);15151515- for (i = 0; i < priv->ae_handle->q_num * 2; i++)15161516- napi_schedule(&priv->ring_data[i].napi);15171517- local_irq_restore(flags);15181518-}15191519-#endif15201520-15211498static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb,15221499 struct net_device *ndev)15231500{···19551962 .ndo_set_features = hns_nic_set_features,19561963 .ndo_fix_features = hns_nic_fix_features,19571964 .ndo_get_stats64 = hns_nic_get_stats64,19581958-#ifdef CONFIG_NET_POLL_CONTROLLER19591959- .ndo_poll_controller = hns_nic_poll_controller,19601960-#endif19611965 .ndo_set_rx_mode = hns_nic_set_rx_mode,19621966 .ndo_select_queue = hns_nic_select_queue,19631967};
···20002000 u32 max_guarantee = 0;20012001 int i;2002200220032003- for (i = 0; i <= esw->total_vports; i++) {20032003+ for (i = 0; i < esw->total_vports; i++) {20042004 evport = &esw->vports[i];20052005 if (!evport->enabled || evport->info.min_rate < max_guarantee)20062006 continue;···20202020 int err;20212021 int i;2022202220232023- for (i = 0; i <= esw->total_vports; i++) {20232023+ for (i = 0; i < esw->total_vports; i++) {20242024 evport = &esw->vports[i];20252025 if (!evport->enabled)20262026 continue;
···113113 struct sk_buff *skbn;114114115115 if (skb->dev->type == ARPHRD_ETHER) {116116- if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_KERNEL)) {116116+ if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_ATOMIC)) {117117 kfree_skb(skb);118118 return;119119 }···147147 }148148149149 if (skb_headroom(skb) < required_headroom) {150150- if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL))150150+ if (pskb_expand_head(skb, required_headroom, 0, GFP_ATOMIC))151151 return -ENOMEM;152152 }153153···188188189189 if (!skb)190190 goto done;191191+192192+ if (skb->pkt_type == PACKET_LOOPBACK)193193+ return RX_HANDLER_PASS;191194192195 dev = skb->dev;193196 port = rmnet_get_port(dev);
+16-16
drivers/net/ethernet/realtek/r8169.c
···4072407240734073 genphy_soft_reset(dev->phydev);4074407440754075- /* It was reported that chip version 33 ends up with 10MBit/Half on a40754075+ /* It was reported that several chips end up with 10MBit/Half on a40764076 * 1GBit link after resuming from S3. For whatever reason the PHY on40774077- * this chip doesn't properly start a renegotiation when soft-reset.40774077+ * these chips doesn't properly start a renegotiation when soft-reset.40784078 * Explicitly requesting a renegotiation fixes this.40794079 */40804080- if (tp->mac_version == RTL_GIGA_MAC_VER_33 &&40814081- dev->phydev->autoneg == AUTONEG_ENABLE)40804080+ if (dev->phydev->autoneg == AUTONEG_ENABLE)40824081 phy_restart_aneg(dev->phydev);40834082}40844083···4535453645364537static void rtl_set_tx_config_registers(struct rtl8169_private *tp)45374538{45384538- /* Set DMA burst size and Interframe Gap Time */45394539- RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) |45404540- (InterFrameGap << TxInterFrameGapShift));45394539+ u32 val = TX_DMA_BURST << TxDMAShift |45404540+ InterFrameGap << TxInterFrameGapShift;45414541+45424542+ if (tp->mac_version >= RTL_GIGA_MAC_VER_34 &&45434543+ tp->mac_version != RTL_GIGA_MAC_VER_39)45444544+ val |= TXCFG_AUTO_FIFO;45454545+45464546+ RTL_W32(tp, TxConfig, val);45414547}4542454845434549static void rtl_set_rx_max_size(struct rtl8169_private *tp)···5037503350385034 rtl_disable_clock_request(tp);5039503550405040- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);50415036 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);5042503750435038 /* Adjust EEE LED frequency */···5070506750715068 rtl_disable_clock_request(tp);5072506950735073- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);50745070 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);50755071 RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN);50765072 RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN);···5114511251155113static void rtl_hw_start_8168g(struct rtl8169_private *tp)51165114{51175117- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);51185118-51195115 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC);51205116 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC);51215117 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC);···52115211 rtl_hw_aspm_clkreq_enable(tp, false);52125212 rtl_ephy_init(tp, e_info_8168h_1, ARRAY_SIZE(e_info_8168h_1));5213521352145214- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);52155215-52165214 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);52175215 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC);52185216 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC);···52925294static void rtl_hw_start_8168ep(struct rtl8169_private *tp)52935295{52945296 rtl8168ep_stop_cmac(tp);52955295-52965296- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);5297529752985298 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);52995299 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x2f, ERIAR_EXGMAC);···56145618 /* Force LAN exit from ASPM if Rx/Tx are not idle */56155619 RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800);5616562056175617- RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);56185621 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);5619562256205623 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402));···68646869{68656870 struct pci_dev *pdev = to_pci_dev(device);68666871 struct net_device *dev = pci_get_drvdata(pdev);68726872+ struct rtl8169_private *tp = netdev_priv(dev);6867687368686874 rtl8169_net_suspend(dev);68756875+ clk_disable_unprepare(tp->clk);6869687668706877 return 0;68716878}···68956898{68966899 struct pci_dev *pdev = to_pci_dev(device);68976900 struct net_device *dev = pci_get_drvdata(pdev);69016901+ struct rtl8169_private *tp = netdev_priv(dev);69026902+69036903+ clk_prepare_enable(tp->clk);6898690468996905 if (netif_running(dev))69006906 __rtl8169_resume(dev);
-26
drivers/net/ethernet/sfc/efx.c
···2208220822092209/**************************************************************************22102210 *22112211- * Kernel netpoll interface22122212- *22132213- *************************************************************************/22142214-22152215-#ifdef CONFIG_NET_POLL_CONTROLLER22162216-22172217-/* Although in the common case interrupts will be disabled, this is not22182218- * guaranteed. However, all our work happens inside the NAPI callback,22192219- * so no locking is required.22202220- */22212221-static void efx_netpoll(struct net_device *net_dev)22222222-{22232223- struct efx_nic *efx = netdev_priv(net_dev);22242224- struct efx_channel *channel;22252225-22262226- efx_for_each_channel(channel, efx)22272227- efx_schedule_channel(channel);22282228-}22292229-22302230-#endif22312231-22322232-/**************************************************************************22332233- *22342211 * Kernel net device interface22352212 *22362213 *************************************************************************/···24862509#endif24872510 .ndo_get_phys_port_id = efx_get_phys_port_id,24882511 .ndo_get_phys_port_name = efx_get_phys_port_name,24892489-#ifdef CONFIG_NET_POLL_CONTROLLER24902490- .ndo_poll_controller = efx_netpoll,24912491-#endif24922512 .ndo_setup_tc = efx_setup_tc,24932513#ifdef CONFIG_RFS_ACCEL24942514 .ndo_rx_flow_steer = efx_filter_rfs,
-26
drivers/net/ethernet/sfc/falcon/efx.c
···2054205420552055/**************************************************************************20562056 *20572057- * Kernel netpoll interface20582058- *20592059- *************************************************************************/20602060-20612061-#ifdef CONFIG_NET_POLL_CONTROLLER20622062-20632063-/* Although in the common case interrupts will be disabled, this is not20642064- * guaranteed. However, all our work happens inside the NAPI callback,20652065- * so no locking is required.20662066- */20672067-static void ef4_netpoll(struct net_device *net_dev)20682068-{20692069- struct ef4_nic *efx = netdev_priv(net_dev);20702070- struct ef4_channel *channel;20712071-20722072- ef4_for_each_channel(channel, efx)20732073- ef4_schedule_channel(channel);20742074-}20752075-20762076-#endif20772077-20782078-/**************************************************************************20792079- *20802057 * Kernel net device interface20812058 *20822059 *************************************************************************/···22272250 .ndo_set_mac_address = ef4_set_mac_address,22282251 .ndo_set_rx_mode = ef4_set_rx_mode,22292252 .ndo_set_features = ef4_set_features,22302230-#ifdef CONFIG_NET_POLL_CONTROLLER22312231- .ndo_poll_controller = ef4_netpoll,22322232-#endif22332253 .ndo_setup_tc = ef4_setup_tc,22342254#ifdef CONFIG_RFS_ACCEL22352255 .ndo_rx_flow_steer = ef4_filter_rfs,
+4
drivers/net/hamradio/yam.c
···966966 sizeof(struct yamdrv_ioctl_mcs));967967 if (IS_ERR(ym))968968 return PTR_ERR(ym);969969+ if (ym->cmd != SIOCYAMSMCS)970970+ return -EINVAL;969971 if (ym->bitrate > YAM_MAXBITRATE) {970972 kfree(ym);971973 return -EINVAL;···983981 if (copy_from_user(&yi, ifr->ifr_data, sizeof(struct yamdrv_ioctl_cfg)))984982 return -EFAULT;985983984984+ if (yi.cmd != SIOCYAMSCFG)985985+ return -EINVAL;986986 if ((yi.cfg.mask & YAM_IOBASE) && netif_running(dev))987987 return -EINVAL; /* Cannot change this parameter when up */988988 if ((yi.cfg.mask & YAM_IRQ) && netif_running(dev))
···634634 for (i = 0; i < len; i++)635635 dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]);636636637637- fifo_buffer = kmalloc(len, GFP_KERNEL);637637+ fifo_buffer = kmemdup(buf, len, GFP_KERNEL);638638 if (!fifo_buffer)639639 return -ENOMEM;640640- memcpy(fifo_buffer, buf, len);641640 kfifo_in(&test->up_fifo, &fifo_buffer, 4);642641 wake_up_interruptible(&priv->test.readq);643642···30433044{30443045 struct ca8210_test *test = &priv->test;3045304630463046- if (!IS_ERR(test->ca8210_dfs_spi_int))30473047- debugfs_remove(test->ca8210_dfs_spi_int);30473047+ debugfs_remove(test->ca8210_dfs_spi_int);30483048 kfifo_free(&test->up_fifo);30493049 dev_info(&priv->spi->dev, "Test interface removed\n");30503050}
+4-4
drivers/net/ieee802154/mcr20a.c
···903903904904 switch (seq_state) {905905 /* TX IRQ, RX IRQ and SEQ IRQ */906906- case (0x03):906906+ case (DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ):907907 if (lp->is_tx) {908908 lp->is_tx = 0;909909 dev_dbg(printdev(lp), "TX is done. No ACK\n");910910 mcr20a_handle_tx_complete(lp);911911 }912912 break;913913- case (0x05):913913+ case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ):914914 /* rx is starting */915915 dev_dbg(printdev(lp), "RX is starting\n");916916 mcr20a_handle_rx(lp);917917 break;918918- case (0x07):918918+ case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ):919919 if (lp->is_tx) {920920 /* tx is done */921921 lp->is_tx = 0;···927927 mcr20a_handle_rx(lp);928928 }929929 break;930930- case (0x01):930930+ case (DAR_IRQSTS1_SEQIRQ):931931 if (lp->is_tx) {932932 dev_dbg(printdev(lp), "TX is starting\n");933933 mcr20a_handle_tx(lp);
+9-3
drivers/net/phy/phy_device.c
···9393 if (!netdev)9494 return !phydev->suspended;95959696- /* Don't suspend PHY if the attached netdev parent may wakeup.9696+ if (netdev->wol_enabled)9797+ return false;9898+9999+ /* As long as not all affected network drivers support the100100+ * wol_enabled flag, let's check for hints that WoL is enabled.101101+ * Don't suspend PHY if the attached netdev parent may wake up.97102 * The parent may point to a PCI device, as in tg3 driver.98103 */99104 if (netdev->dev.parent && device_may_wakeup(netdev->dev.parent))···11371132 sysfs_remove_link(&dev->dev.kobj, "phydev");11381133 sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");11391134 }11351135+ phy_suspend(phydev);11401136 phydev->attached_dev->phydev = NULL;11411137 phydev->attached_dev = NULL;11421142- phy_suspend(phydev);11431138 phydev->phylink = NULL;1144113911451140 phy_led_triggers_unregister(phydev);···11731168int phy_suspend(struct phy_device *phydev)11741169{11751170 struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);11711171+ struct net_device *netdev = phydev->attached_dev;11761172 struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };11771173 int ret = 0;1178117411791175 /* If the device has WOL enabled, we cannot suspend the PHY */11801176 phy_ethtool_get_wol(phydev, &wol);11811181- if (wol.wolopts)11771177+ if (wol.wolopts || (netdev && netdev->wol_enabled))11821178 return -EBUSY;1183117911841180 if (phydev->drv && phydrv->suspend)
+28-20
drivers/net/phy/phylink.c
···717717 return 0;718718}719719720720+static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy,721721+ phy_interface_t interface)722722+{723723+ int ret;724724+725725+ if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||726726+ (pl->link_an_mode == MLO_AN_INBAND &&727727+ phy_interface_mode_is_8023z(interface))))728728+ return -EINVAL;729729+730730+ if (pl->phydev)731731+ return -EBUSY;732732+733733+ ret = phy_attach_direct(pl->netdev, phy, 0, interface);734734+ if (ret)735735+ return ret;736736+737737+ ret = phylink_bringup_phy(pl, phy);738738+ if (ret)739739+ phy_detach(phy);740740+741741+ return ret;742742+}743743+720744/**721745 * phylink_connect_phy() - connect a PHY to the phylink instance722746 * @pl: a pointer to a &struct phylink returned from phylink_create()···758734 */759735int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)760736{761761- int ret;762762-763763- if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||764764- (pl->link_an_mode == MLO_AN_INBAND &&765765- phy_interface_mode_is_8023z(pl->link_interface))))766766- return -EINVAL;767767-768768- if (pl->phydev)769769- return -EBUSY;770770-771737 /* Use PHY device/driver interface */772738 if (pl->link_interface == PHY_INTERFACE_MODE_NA) {773739 pl->link_interface = phy->interface;774740 pl->link_config.interface = pl->link_interface;775741 }776742777777- ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);778778- if (ret)779779- return ret;780780-781781- ret = phylink_bringup_phy(pl, phy);782782- if (ret)783783- phy_detach(phy);784784-785785- return ret;743743+ return __phylink_connect_phy(pl, phy, pl->link_interface);786744}787745EXPORT_SYMBOL_GPL(phylink_connect_phy);788746···1678167216791673static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)16801674{16811681- return phylink_connect_phy(upstream, phy);16751675+ struct phylink *pl = upstream;16761676+16771677+ return __phylink_connect_phy(upstream, phy, pl->link_config.interface);16821678}1683167916841680static void phylink_sfp_disconnect_phy(void *upstream)
+5-2
drivers/net/phy/sfp.c
···1098109810991099static void sfp_hwmon_remove(struct sfp *sfp)11001100{11011101- hwmon_device_unregister(sfp->hwmon_dev);11021102- kfree(sfp->hwmon_name);11011101+ if (!IS_ERR_OR_NULL(sfp->hwmon_dev)) {11021102+ hwmon_device_unregister(sfp->hwmon_dev);11031103+ sfp->hwmon_dev = NULL;11041104+ kfree(sfp->hwmon_name);11051105+ }11031106}11041107#else11051108static int sfp_hwmon_insert(struct sfp *sfp)
+6
drivers/net/team/team.c
···11671167 return -EBUSY;11681168 }1169116911701170+ if (dev == port_dev) {11711171+ NL_SET_ERR_MSG(extack, "Cannot enslave team device to itself");11721172+ netdev_err(dev, "Cannot enslave team device to itself\n");11731173+ return -EINVAL;11741174+ }11751175+11701176 if (port_dev->features & NETIF_F_VLAN_CHALLENGED &&11711177 vlan_uses_dev(dev)) {11721178 NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up");
···607607 struct usbnet *dev = netdev_priv(net);608608 u8 opt = 0;609609610610+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))611611+ return -EINVAL;612612+610613 if (wolinfo->wolopts & WAKE_PHY)611614 opt |= AX_MONITOR_LINK;612615 if (wolinfo->wolopts & WAKE_MAGIC)
+3
drivers/net/usb/ax88179_178a.c
···566566 struct usbnet *dev = netdev_priv(net);567567 u8 opt = 0;568568569569+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))570570+ return -EINVAL;571571+569572 if (wolinfo->wolopts & WAKE_PHY)570573 opt |= AX_MONITOR_MODE_RWLC;571574 if (wolinfo->wolopts & WAKE_MAGIC)
+4-13
drivers/net/usb/lan78xx.c
···14011401 if (ret < 0)14021402 return ret;1403140314041404- pdata->wol = 0;14051405- if (wol->wolopts & WAKE_UCAST)14061406- pdata->wol |= WAKE_UCAST;14071407- if (wol->wolopts & WAKE_MCAST)14081408- pdata->wol |= WAKE_MCAST;14091409- if (wol->wolopts & WAKE_BCAST)14101410- pdata->wol |= WAKE_BCAST;14111411- if (wol->wolopts & WAKE_MAGIC)14121412- pdata->wol |= WAKE_MAGIC;14131413- if (wol->wolopts & WAKE_PHY)14141414- pdata->wol |= WAKE_PHY;14151415- if (wol->wolopts & WAKE_ARP)14161416- pdata->wol |= WAKE_ARP;14041404+ if (wol->wolopts & ~WAKE_ALL)14051405+ return -EINVAL;14061406+14071407+ pdata->wol = wol->wolopts;1417140814181409 device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);14191410
+3
drivers/net/usb/r8152.c
···45064506 if (!rtl_can_wakeup(tp))45074507 return -EOPNOTSUPP;4508450845094509+ if (wol->wolopts & ~WAKE_ANY)45104510+ return -EINVAL;45114511+45094512 ret = usb_autopm_get_interface(tp->intf);45104513 if (ret < 0)45114514 goto out_set_wol;
···15181518 }15191519 } else {15201520 /* More than a single header/data pair were missed.15211521- * Report this error, and reset the controller to15211521+ * Report this error. If running with open-source15221522+ * firmware, then reset the controller to15221523 * revive operation.15231524 */15241525 b43dbg(dev->wl,15251526 "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n",15261527 ring->index, firstused, slot);15271527- b43_controller_restart(dev, "Out of order TX");15281528+ if (dev->fw.opensource)15291529+ b43_controller_restart(dev, "Out of order TX");15281530 return;15291531 }15301532 }
···11451145{11461146 struct device *dev = &pcie->pdev->dev;11471147 struct device_node *np = dev->of_node;11481148- unsigned int i;11491148 int ret;1150114911511150 INIT_LIST_HEAD(&pcie->resources);···11781179 resource_size(&pcie->io) - 1);11791180 pcie->realio.name = "PCI I/O";1180118111811181- for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)11821182- pci_ioremap_io(i, pcie->io.start + i);11831183-11841182 pci_add_resource(&pcie->resources, &pcie->realio);11851183 }1186118411871185 return devm_request_pci_bus_resources(dev, &pcie->resources);11861186+}11871187+11881188+/*11891189+ * This is a copy of pci_host_probe(), except that it does the I/O11901190+ * remap as the last step, once we are sure we won't fail.11911191+ *11921192+ * It should be removed once the I/O remap error handling issue has11931193+ * been sorted out.11941194+ */11951195+static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)11961196+{11971197+ struct mvebu_pcie *pcie;11981198+ struct pci_bus *bus, *child;11991199+ int ret;12001200+12011201+ ret = pci_scan_root_bus_bridge(bridge);12021202+ if (ret < 0) {12031203+ dev_err(bridge->dev.parent, "Scanning root bridge failed");12041204+ return ret;12051205+ }12061206+12071207+ pcie = pci_host_bridge_priv(bridge);12081208+ if (resource_size(&pcie->io) != 0) {12091209+ unsigned int i;12101210+12111211+ for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)12121212+ pci_ioremap_io(i, pcie->io.start + i);12131213+ }12141214+12151215+ bus = bridge->bus;12161216+12171217+ /*12181218+ * We insert PCI resources into the iomem_resource and12191219+ * ioport_resource trees in either pci_bus_claim_resources()12201220+ * or pci_bus_assign_resources().12211221+ */12221222+ if (pci_has_flag(PCI_PROBE_ONLY)) {12231223+ pci_bus_claim_resources(bus);12241224+ } else {12251225+ pci_bus_size_bridges(bus);12261226+ pci_bus_assign_resources(bus);12271227+12281228+ list_for_each_entry(child, &bus->children, node)12291229+ pcie_bus_configure_settings(child);12301230+ }12311231+12321232+ pci_bus_add_devices(bus);12331233+ return 0;11881234}1189123511901236static int mvebu_pcie_probe(struct platform_device *pdev)···13121268 bridge->align_resource = mvebu_pcie_align_resource;13131269 bridge->msi = pcie->msi;1314127013151315- return pci_host_probe(bridge);12711271+ return mvebu_pci_host_probe(bridge);13161272}1317127313181274static const struct of_device_id mvebu_pcie_of_match_table[] = {
+19-8
drivers/pci/pci.c
···12891289EXPORT_SYMBOL(pci_save_state);1290129012911291static void pci_restore_config_dword(struct pci_dev *pdev, int offset,12921292- u32 saved_val, int retry)12921292+ u32 saved_val, int retry, bool force)12931293{12941294 u32 val;1295129512961296 pci_read_config_dword(pdev, offset, &val);12971297- if (val == saved_val)12971297+ if (!force && val == saved_val)12981298 return;1299129913001300 for (;;) {···13131313}1314131413151315static void pci_restore_config_space_range(struct pci_dev *pdev,13161316- int start, int end, int retry)13161316+ int start, int end, int retry,13171317+ bool force)13171318{13181319 int index;1319132013201321 for (index = end; index >= start; index--)13211322 pci_restore_config_dword(pdev, 4 * index,13221323 pdev->saved_config_space[index],13231323- retry);13241324+ retry, force);13241325}1325132613261327static void pci_restore_config_space(struct pci_dev *pdev)13271328{13281329 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {13291329- pci_restore_config_space_range(pdev, 10, 15, 0);13301330+ pci_restore_config_space_range(pdev, 10, 15, 0, false);13301331 /* Restore BARs before the command register. */13311331- pci_restore_config_space_range(pdev, 4, 9, 10);13321332- pci_restore_config_space_range(pdev, 0, 3, 0);13321332+ pci_restore_config_space_range(pdev, 4, 9, 10, false);13331333+ pci_restore_config_space_range(pdev, 0, 3, 0, false);13341334+ } else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {13351335+ pci_restore_config_space_range(pdev, 12, 15, 0, false);13361336+13371337+ /*13381338+ * Force rewriting of prefetch registers to avoid S3 resume13391339+ * issues on Intel PCI bridges that occur when these13401340+ * registers are not explicitly written.13411341+ */13421342+ pci_restore_config_space_range(pdev, 9, 11, 0, true);13431343+ pci_restore_config_space_range(pdev, 0, 8, 0, false);13331344 } else {13341334- pci_restore_config_space_range(pdev, 0, 15, 0);13451345+ pci_restore_config_space_range(pdev, 0, 15, 0, false);13351346 }13361347}13371348
+1-1
drivers/s390/net/qeth_core_main.c
···610610static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc,611611 struct qeth_card *card)612612{613613- char *ipa_name;613613+ const char *ipa_name;614614 int com = cmd->hdr.command;615615 ipa_name = qeth_get_ipa_cmd_name(com);616616 if (rc)
+16-17
drivers/s390/net/qeth_core_mpc.c
···148148149149struct ipa_rc_msg {150150 enum qeth_ipa_return_codes rc;151151- char *msg;151151+ const char *msg;152152};153153154154-static struct ipa_rc_msg qeth_ipa_rc_msg[] = {154154+static const struct ipa_rc_msg qeth_ipa_rc_msg[] = {155155 {IPA_RC_SUCCESS, "success"},156156 {IPA_RC_NOTSUPP, "Command not supported"},157157 {IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"},···219219220220221221222222-char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)222222+const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)223223{224224- int x = 0;225225- qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /226226- sizeof(struct ipa_rc_msg) - 1].rc = rc;227227- while (qeth_ipa_rc_msg[x].rc != rc)228228- x++;224224+ int x;225225+226226+ for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_msg) - 1; x++)227227+ if (qeth_ipa_rc_msg[x].rc == rc)228228+ return qeth_ipa_rc_msg[x].msg;229229 return qeth_ipa_rc_msg[x].msg;230230}231231232232233233struct ipa_cmd_names {234234 enum qeth_ipa_cmds cmd;235235- char *name;235235+ const char *name;236236};237237238238-static struct ipa_cmd_names qeth_ipa_cmd_names[] = {238238+static const struct ipa_cmd_names qeth_ipa_cmd_names[] = {239239 {IPA_CMD_STARTLAN, "startlan"},240240 {IPA_CMD_STOPLAN, "stoplan"},241241 {IPA_CMD_SETVMAC, "setvmac"},···267267 {IPA_CMD_UNKNOWN, "unknown"},268268};269269270270-char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)270270+const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)271271{272272- int x = 0;273273- qeth_ipa_cmd_names[274274- sizeof(qeth_ipa_cmd_names) /275275- sizeof(struct ipa_cmd_names)-1].cmd = cmd;276276- while (qeth_ipa_cmd_names[x].cmd != cmd)277277- x++;272272+ int x;273273+274274+ for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++)275275+ if (qeth_ipa_cmd_names[x].cmd == cmd)276276+ return qeth_ipa_cmd_names[x].name;278277 return qeth_ipa_cmd_names[x].name;279278}
···735735 u8 link, depth;736736 u64 route;737737738738- /*739739- * After NVM upgrade adding root switch device fails because we740740- * initiated reset. During that time ICM might still send741741- * XDomain connected message which we ignore here.742742- */743743- if (!tb->root_switch)744744- return;745745-746738 link = pkg->link_info & ICM_LINK_INFO_LINK_MASK;747739 depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>748740 ICM_LINK_INFO_DEPTH_SHIFT;···10241032 * packet for now.10251033 */10261034 if (pkg->hdr.packet_id)10271027- return;10281028-10291029- /*10301030- * After NVM upgrade adding root switch device fails because we10311031- * initiated reset. During that time ICM might still send device10321032- * connected message which we ignore here.10331033- */10341034- if (!tb->root_switch)10351035 return;1036103610371037 route = get_route(pkg->route_hi, pkg->route_lo);···1389140513901406 mutex_lock(&tb->lock);1391140713921392- switch (n->pkg->code) {13931393- case ICM_EVENT_DEVICE_CONNECTED:13941394- icm->device_connected(tb, n->pkg);13951395- break;13961396- case ICM_EVENT_DEVICE_DISCONNECTED:13971397- icm->device_disconnected(tb, n->pkg);13981398- break;13991399- case ICM_EVENT_XDOMAIN_CONNECTED:14001400- icm->xdomain_connected(tb, n->pkg);14011401- break;14021402- case ICM_EVENT_XDOMAIN_DISCONNECTED:14031403- icm->xdomain_disconnected(tb, n->pkg);14041404- break;14081408+ /*14091409+ * When the domain is stopped we flush its workqueue but before14101410+ * that the root switch is removed. In that case we should treat14111411+ * the queued events as being canceled.14121412+ */14131413+ if (tb->root_switch) {14141414+ switch (n->pkg->code) {14151415+ case ICM_EVENT_DEVICE_CONNECTED:14161416+ icm->device_connected(tb, n->pkg);14171417+ break;14181418+ case ICM_EVENT_DEVICE_DISCONNECTED:14191419+ icm->device_disconnected(tb, n->pkg);14201420+ break;14211421+ case ICM_EVENT_XDOMAIN_CONNECTED:14221422+ icm->xdomain_connected(tb, n->pkg);14231423+ break;14241424+ case ICM_EVENT_XDOMAIN_DISCONNECTED:14251425+ icm->xdomain_disconnected(tb, n->pkg);14261426+ break;14271427+ }14051428 }1406142914071430 mutex_unlock(&tb->lock);
···630630 if (!data->skip_autocfg)631631 dw8250_setup_port(p);632632633633-#ifdef CONFIG_PM634634- uart.capabilities |= UART_CAP_RPM;635635-#endif636636-637633 /* If we have a valid fifosize, try hooking up DMA */638634 if (p->fifosize) {639635 data->dma.rxconf.src_maxburst = p->fifosize / 4;
···15141514{15151515 struct acm *acm = usb_get_intfdata(intf);15161516 struct tty_struct *tty;15171517+ int i;1517151815181519 /* sibling interface is already cleaning up */15191520 if (!acm)···1545154415461545 tty_unregister_device(acm_tty_driver, acm->minor);1547154615471547+ usb_free_urb(acm->ctrlurb);15481548+ for (i = 0; i < ACM_NW; i++)15491549+ usb_free_urb(acm->wb[i].urb);15501550+ for (i = 0; i < acm->rx_buflimit; i++)15511551+ usb_free_urb(acm->read_urbs[i]);15481552 acm_write_buffers_free(acm);15491553 usb_free_coherent(acm->dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma);15501554 acm_read_buffers_free(acm);
···1553155315541554/* Flags */15551555#define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */15561556+#define MID_DELETED 2 /* Mid has been dequeued/deleted */1556155715571558/* Types of response buffer returned from SendReceive2 */15581559#define CIFS_NO_BUFFER 0 /* Response buffer not returned */
+10-3
fs/cifs/connect.c
···659659 mid->mid_state = MID_RESPONSE_RECEIVED;660660 else661661 mid->mid_state = MID_RESPONSE_MALFORMED;662662- list_del_init(&mid->qhead);662662+ /*663663+ * Trying to handle/dequeue a mid after the send_recv()664664+ * function has finished processing it is a bug.665665+ */666666+ if (mid->mid_flags & MID_DELETED)667667+ printk_once(KERN_WARNING668668+ "trying to dequeue a deleted mid\n");669669+ else670670+ list_del_init(&mid->qhead);663671 spin_unlock(&GlobalMid_Lock);664672}665673···946938 } else {947939 mids[0] = server->ops->find_mid(server, buf);948940 bufs[0] = buf;949949- if (mids[0])950950- num_mids = 1;941941+ num_mids = 1;951942952943 if (!mids[0] || !mids[0]->receive)953944 length = standard_receive3(server, mids[0]);
···142142cifs_delete_mid(struct mid_q_entry *mid)143143{144144 spin_lock(&GlobalMid_Lock);145145- list_del(&mid->qhead);145145+ list_del_init(&mid->qhead);146146+ mid->mid_flags |= MID_DELETED;146147 spin_unlock(&GlobalMid_Lock);147148148149 DeleteMidQEntry(mid);···773772 return mid;774773}775774775775+static void776776+cifs_noop_callback(struct mid_q_entry *mid)777777+{778778+}779779+776780int777781compound_send_recv(const unsigned int xid, struct cifs_ses *ses,778782 const int flags, const int num_rqst, struct smb_rqst *rqst,···832826 }833827834828 midQ[i]->mid_state = MID_REQUEST_SUBMITTED;829829+ /*830830+ * We don't invoke the callback compounds unless it is the last831831+ * request.832832+ */833833+ if (i < num_rqst - 1)834834+ midQ[i]->callback = cifs_noop_callback;835835 }836836-837836 cifs_in_send_inc(ses->server);838837 rc = smb_send_rqst(ses->server, num_rqst, rqst, flags);839838 cifs_in_send_dec(ses->server);···919908 midQ[i]->resp_buf = NULL;920909 }921910out:911911+ /*912912+ * This will dequeue all mids. After this it is important that the913913+ * demultiplex_thread will not process any of these mids any futher.914914+ * This is prevented above by using a noop callback that will not915915+ * wake this thread except for the very last PDU.916916+ */922917 for (i = 0; i < num_rqst; i++)923918 cifs_delete_mid(midQ[i]);924919 add_credits(ses->server, credits, optype);
+1-1
fs/ioctl.c
···230230 ret = -EXDEV;231231 if (src_file.file->f_path.mnt != dst_file->f_path.mnt)232232 goto fdput;233233- ret = do_clone_file_range(src_file.file, off, dst_file, destoff, olen);233233+ ret = vfs_clone_file_range(src_file.file, off, dst_file, destoff, olen);234234fdput:235235 fdput(src_file);236236 return ret;
···29462946 if (map_end & (PAGE_SIZE - 1))29472947 to = map_end & (PAGE_SIZE - 1);2948294829492949+retry:29492950 page = find_or_create_page(mapping, page_index, GFP_NOFS);29502951 if (!page) {29512952 ret = -ENOMEM;···29552954 }2956295529572956 /*29582958- * In case PAGE_SIZE <= CLUSTER_SIZE, This page29592959- * can't be dirtied before we CoW it out.29572957+ * In case PAGE_SIZE <= CLUSTER_SIZE, we do not expect a dirty29582958+ * page, so write it back.29602959 */29612961- if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize)29622962- BUG_ON(PageDirty(page));29602960+ if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) {29612961+ if (PageDirty(page)) {29622962+ /*29632963+ * write_on_page will unlock the page on return29642964+ */29652965+ ret = write_one_page(page);29662966+ goto retry;29672967+ }29682968+ }2963296929642970 if (!PageUptodate(page)) {29652971 ret = block_read_full_page(page, ocfs2_get_block);
+1-1
fs/overlayfs/copy_up.c
···141141 }142142143143 /* Try to use clone_file_range to clone up within the same fs */144144- error = vfs_clone_file_range(old_file, 0, new_file, 0, len);144144+ error = do_clone_file_range(old_file, 0, new_file, 0, len);145145 if (!error)146146 goto out;147147 /* Couldn't clone, so now we try to copy the data */
···407407 unsigned long *entries;408408 int err;409409410410+ /*411411+ * The ability to racily run the kernel stack unwinder on a running task412412+ * and then observe the unwinder output is scary; while it is useful for413413+ * debugging kernel issues, it can also allow an attacker to leak kernel414414+ * stack contents.415415+ * Doing this in a manner that is at least safe from races would require416416+ * some work to ensure that the remote task can not be scheduled; and417417+ * even then, this would still expose the unwinder as local attack418418+ * surface.419419+ * Therefore, this interface is restricted to root.420420+ */421421+ if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))422422+ return -EACCES;423423+410424 entries = kmalloc_array(MAX_STACK_TRACE_DEPTH, sizeof(*entries),411425 GFP_KERNEL);412426 if (!entries)
+25-4
fs/pstore/ram.c
···898898 },899899};900900901901-static void ramoops_register_dummy(void)901901+static inline void ramoops_unregister_dummy(void)902902{903903+ platform_device_unregister(dummy);904904+ dummy = NULL;905905+906906+ kfree(dummy_data);907907+ dummy_data = NULL;908908+}909909+910910+static void __init ramoops_register_dummy(void)911911+{912912+ /*913913+ * Prepare a dummy platform data structure to carry the module914914+ * parameters. If mem_size isn't set, then there are no module915915+ * parameters, and we can skip this.916916+ */903917 if (!mem_size)904918 return;905919···946932 if (IS_ERR(dummy)) {947933 pr_info("could not create platform device: %ld\n",948934 PTR_ERR(dummy));935935+ dummy = NULL;936936+ ramoops_unregister_dummy();949937 }950938}951939952940static int __init ramoops_init(void)953941{942942+ int ret;943943+954944 ramoops_register_dummy();955955- return platform_driver_register(&ramoops_driver);945945+ ret = platform_driver_register(&ramoops_driver);946946+ if (ret != 0)947947+ ramoops_unregister_dummy();948948+949949+ return ret;956950}957951late_initcall(ramoops_init);958952959953static void __exit ramoops_exit(void)960954{961955 platform_driver_unregister(&ramoops_driver);962962- platform_device_unregister(dummy);963963- kfree(dummy_data);956956+ ramoops_unregister_dummy();964957}965958module_exit(ramoops_exit);966959
···673673 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS);674674675675 /*676676- * Make space in the inode incore.676676+ * Make space in the inode incore. This needs to be undone if we fail677677+ * to expand the root.677678 */678679 xfs_iroot_realloc(ip, 1, whichfork);679680 ifp->if_flags |= XFS_IFBROOT;···712711 args.minlen = args.maxlen = args.prod = 1;713712 args.wasdel = wasdel;714713 *logflagsp = 0;715715- if ((error = xfs_alloc_vextent(&args))) {716716- ASSERT(ifp->if_broot == NULL);717717- goto err1;718718- }714714+ error = xfs_alloc_vextent(&args);715715+ if (error)716716+ goto out_root_realloc;719717720718 if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {721721- ASSERT(ifp->if_broot == NULL);722719 error = -ENOSPC;723723- goto err1;720720+ goto out_root_realloc;724721 }722722+725723 /*726724 * Allocation can't fail, the space was reserved.727725 */···732732 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L);733733 abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0);734734 if (!abp) {735735- error = -ENOSPC;736736- goto err2;735735+ error = -EFSCORRUPTED;736736+ goto out_unreserve_dquot;737737 }738738+738739 /*739740 * Fill in the child block.740741 */···776775 *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork);777776 return 0;778777779779-err2:778778+out_unreserve_dquot:780779 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);781781-err1:780780+out_root_realloc:782781 xfs_iroot_realloc(ip, -1, whichfork);783782 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);783783+ ASSERT(ifp->if_broot == NULL);784784 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);785785786786 return error;
+2
fs/xfs/libxfs/xfs_format.h
···10161016#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */10171017#define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */10181018#define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */10191019+/* Do not use bit 15, di_flags is legacy and unchanging now */10201020+10191021#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)10201022#define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)10211023#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
+30
fs/xfs/libxfs/xfs_inode_buf.c
···415415 return NULL;416416}417417418418+static xfs_failaddr_t419419+xfs_dinode_verify_forkoff(420420+ struct xfs_dinode *dip,421421+ struct xfs_mount *mp)422422+{423423+ if (!XFS_DFORK_Q(dip))424424+ return NULL;425425+426426+ switch (dip->di_format) {427427+ case XFS_DINODE_FMT_DEV:428428+ if (dip->di_forkoff != (roundup(sizeof(xfs_dev_t), 8) >> 3))429429+ return __this_address;430430+ break;431431+ case XFS_DINODE_FMT_LOCAL: /* fall through ... */432432+ case XFS_DINODE_FMT_EXTENTS: /* fall through ... */433433+ case XFS_DINODE_FMT_BTREE:434434+ if (dip->di_forkoff >= (XFS_LITINO(mp, dip->di_version) >> 3))435435+ return __this_address;436436+ break;437437+ default:438438+ return __this_address;439439+ }440440+ return NULL;441441+}442442+418443xfs_failaddr_t419444xfs_dinode_verify(420445 struct xfs_mount *mp,···494469495470 if (mode && (flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp)496471 return __this_address;472472+473473+ /* check for illegal values of forkoff */474474+ fa = xfs_dinode_verify_forkoff(dip, mp);475475+ if (fa)476476+ return fa;497477498478 /* Do we have appropriate data fork formats for the mode? */499479 switch (mode & S_IFMT) {
···126126{127127 struct xfs_mount *mp = sc->mp;128128129129+ /* di_flags are all taken, last bit cannot be used */129130 if (flags & ~XFS_DIFLAG_ANY)130131 goto bad;131132···173172{174173 struct xfs_mount *mp = sc->mp;175174175175+ /* Unknown di_flags2 could be from a future kernel */176176 if (flags2 & ~XFS_DIFLAG2_ANY)177177- goto bad;177177+ xchk_ino_set_warning(sc, ino);178178179179 /* reflink flag requires reflink feature */180180 if ((flags2 & XFS_DIFLAG2_REFLINK) &&
+7-13
fs/xfs/xfs_bmap_util.c
···702702 struct xfs_iext_cursor icur;703703 int error = 0;704704705705- xfs_ilock(ip, XFS_ILOCK_EXCL);706706- if (!(ifp->if_flags & XFS_IFEXTENTS)) {707707- error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);708708- if (error)709709- goto out_unlock;710710- }705705+ ASSERT(ifp->if_flags & XFS_IFEXTENTS);711706707707+ xfs_ilock(ip, XFS_ILOCK_EXCL);712708 if (!xfs_iext_lookup_extent_before(ip, ifp, &end_fsb, &icur, &got))713709 goto out_unlock;714710···15801584 tirec.br_blockcount, &irec,15811585 &nimaps, 0);15821586 if (error)15831583- goto out_defer;15871587+ goto out;15841588 ASSERT(nimaps == 1);15851589 ASSERT(tirec.br_startoff == irec.br_startoff);15861590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec);···15951599 /* Remove the mapping from the donor file. */15961600 error = xfs_bmap_unmap_extent(tp, tip, &uirec);15971601 if (error)15981598- goto out_defer;16021602+ goto out;1599160316001604 /* Remove the mapping from the source file. */16011605 error = xfs_bmap_unmap_extent(tp, ip, &irec);16021606 if (error)16031603- goto out_defer;16071607+ goto out;1604160816051609 /* Map the donor file's blocks into the source file. */16061610 error = xfs_bmap_map_extent(tp, ip, &uirec);16071611 if (error)16081608- goto out_defer;16121612+ goto out;1609161316101614 /* Map the source file's blocks into the donor file. */16111615 error = xfs_bmap_map_extent(tp, tip, &irec);16121616 if (error)16131613- goto out_defer;16171617+ goto out;1614161816151619 error = xfs_defer_finish(tpp);16161620 tp = *tpp;···16321636 tip->i_d.di_flags2 = tip_flags2;16331637 return 0;1634163816351635-out_defer:16361636- xfs_defer_cancel(tp);16371639out:16381640 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);16391641 tip->i_d.di_flags2 = tip_flags2;
+64-55
fs/xfs/xfs_buf_item.c
···532532}533533534534/*535535+ * Drop the buffer log item refcount and take appropriate action. This helper536536+ * determines whether the bli must be freed or not, since a decrement to zero537537+ * does not necessarily mean the bli is unused.538538+ *539539+ * Return true if the bli is freed, false otherwise.540540+ */541541+bool542542+xfs_buf_item_put(543543+ struct xfs_buf_log_item *bip)544544+{545545+ struct xfs_log_item *lip = &bip->bli_item;546546+ bool aborted;547547+ bool dirty;548548+549549+ /* drop the bli ref and return if it wasn't the last one */550550+ if (!atomic_dec_and_test(&bip->bli_refcount))551551+ return false;552552+553553+ /*554554+ * We dropped the last ref and must free the item if clean or aborted.555555+ * If the bli is dirty and non-aborted, the buffer was clean in the556556+ * transaction but still awaiting writeback from previous changes. In557557+ * that case, the bli is freed on buffer writeback completion.558558+ */559559+ aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags) ||560560+ XFS_FORCED_SHUTDOWN(lip->li_mountp);561561+ dirty = bip->bli_flags & XFS_BLI_DIRTY;562562+ if (dirty && !aborted)563563+ return false;564564+565565+ /*566566+ * The bli is aborted or clean. An aborted item may be in the AIL567567+ * regardless of dirty state. For example, consider an aborted568568+ * transaction that invalidated a dirty bli and cleared the dirty569569+ * state.570570+ */571571+ if (aborted)572572+ xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR);573573+ xfs_buf_item_relse(bip->bli_buf);574574+ return true;575575+}576576+577577+/*535578 * Release the buffer associated with the buf log item. If there is no dirty536579 * logged data associated with the buffer recorded in the buf log item, then537580 * free the buf log item and remove the reference to it in the buffer.···599556{600557 struct xfs_buf_log_item *bip = BUF_ITEM(lip);601558 struct xfs_buf *bp = bip->bli_buf;602602- bool aborted;603603- bool hold = !!(bip->bli_flags & XFS_BLI_HOLD);604604- bool dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);559559+ bool released;560560+ bool hold = bip->bli_flags & XFS_BLI_HOLD;561561+ bool stale = bip->bli_flags & XFS_BLI_STALE;605562#if defined(DEBUG) || defined(XFS_WARN)606606- bool ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);563563+ bool ordered = bip->bli_flags & XFS_BLI_ORDERED;564564+ bool dirty = bip->bli_flags & XFS_BLI_DIRTY;607565#endif608608-609609- aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags);610610-611611- /* Clear the buffer's association with this transaction. */612612- bp->b_transp = NULL;613613-614614- /*615615- * The per-transaction state has been copied above so clear it from the616616- * bli.617617- */618618- bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED);619619-620620- /*621621- * If the buf item is marked stale, then don't do anything. We'll622622- * unlock the buffer and free the buf item when the buffer is unpinned623623- * for the last time.624624- */625625- if (bip->bli_flags & XFS_BLI_STALE) {626626- trace_xfs_buf_item_unlock_stale(bip);627627- ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);628628- if (!aborted) {629629- atomic_dec(&bip->bli_refcount);630630- return;631631- }632632- }633566634567 trace_xfs_buf_item_unlock(bip);635568636569 /*637637- * If the buf item isn't tracking any data, free it, otherwise drop the638638- * reference we hold to it. If we are aborting the transaction, this may639639- * be the only reference to the buf item, so we free it anyway640640- * regardless of whether it is dirty or not. A dirty abort implies a641641- * shutdown, anyway.642642- *643570 * The bli dirty state should match whether the blf has logged segments644571 * except for ordered buffers, where only the bli should be dirty.645572 */646573 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) ||647574 (ordered && dirty && !xfs_buf_item_dirty_format(bip)));575575+ ASSERT(!stale || (bip->__bli_format.blf_flags & XFS_BLF_CANCEL));648576649577 /*650650- * Clean buffers, by definition, cannot be in the AIL. However, aborted651651- * buffers may be in the AIL regardless of dirty state. An aborted652652- * transaction that invalidates a buffer already in the AIL may have653653- * marked it stale and cleared the dirty state, for example.654654- *655655- * Therefore if we are aborting a buffer and we've just taken the last656656- * reference away, we have to check if it is in the AIL before freeing657657- * it. We need to free it in this case, because an aborted transaction658658- * has already shut the filesystem down and this is the last chance we659659- * will have to do so.578578+ * Clear the buffer's association with this transaction and579579+ * per-transaction state from the bli, which has been copied above.660580 */661661- if (atomic_dec_and_test(&bip->bli_refcount)) {662662- if (aborted) {663663- ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));664664- xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR);665665- xfs_buf_item_relse(bp);666666- } else if (!dirty)667667- xfs_buf_item_relse(bp);668668- }581581+ bp->b_transp = NULL;582582+ bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED);669583670670- if (!hold)671671- xfs_buf_relse(bp);584584+ /*585585+ * Unref the item and unlock the buffer unless held or stale. Stale586586+ * buffers remain locked until final unpin unless the bli is freed by587587+ * the unref call. The latter implies shutdown because buffer588588+ * invalidation dirties the bli and transaction.589589+ */590590+ released = xfs_buf_item_put(bip);591591+ if (hold || (stale && !released))592592+ return;593593+ ASSERT(!stale || test_bit(XFS_LI_ABORTED, &lip->li_flags));594594+ xfs_buf_relse(bp);672595}673596674597/*
···15631563 error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags,15641564 XFS_ITRUNC_MAX_EXTENTS, &done);15651565 if (error)15661566- goto out_bmap_cancel;15661566+ goto out;1567156715681568 /*15691569 * Duplicate the transaction that has the permanent···15991599out:16001600 *tpp = tp;16011601 return error;16021602-out_bmap_cancel:16031603- /*16041604- * If the bunmapi call encounters an error, return to the caller where16051605- * the transaction can be properly aborted. We just need to make sure16061606- * we're not holding any resources that we were not when we came in.16071607- */16081608- xfs_defer_cancel(tp);16091609- goto out;16101602}1611160316121604int
+11-1
fs/xfs/xfs_iops.c
···471471 struct inode *inode,472472 struct delayed_call *done)473473{474474+ char *link;475475+474476 ASSERT(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE);475475- return XFS_I(inode)->i_df.if_u1.if_data;477477+478478+ /*479479+ * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED if480480+ * if_data is junk.481481+ */482482+ link = XFS_I(inode)->i_df.if_u1.if_data;483483+ if (!link)484484+ return ERR_PTR(-EFSCORRUPTED);485485+ return link;476486}477487478488STATIC int
-10
fs/xfs/xfs_log_recover.c
···15701570 if (last_cycle != 0) { /* log completely written to */15711571 xlog_put_bp(bp);15721572 return 0;15731573- } else if (first_cycle != 1) {15741574- /*15751575- * If the cycle of the last block is zero, the cycle of15761576- * the first block must be 1. If it's not, maybe we're15771577- * not looking at a log... Bail out.15781578- */15791579- xfs_warn(log->l_mp,15801580- "Log inconsistent or not a log (last==0, first!=1)");15811581- error = -EINVAL;15821582- goto bp_err;15831573 }1584157415851575 /* we have a partially zeroed log */
+84-59
fs/xfs/xfs_reflink.c
···352352 return error;353353}354354355355+/*356356+ * Find the extent that maps the given range in the COW fork. Even if the extent357357+ * is not shared we might have a preallocation for it in the COW fork. If so we358358+ * use it that rather than trigger a new allocation.359359+ */360360+static int361361+xfs_find_trim_cow_extent(362362+ struct xfs_inode *ip,363363+ struct xfs_bmbt_irec *imap,364364+ bool *shared,365365+ bool *found)366366+{367367+ xfs_fileoff_t offset_fsb = imap->br_startoff;368368+ xfs_filblks_t count_fsb = imap->br_blockcount;369369+ struct xfs_iext_cursor icur;370370+ struct xfs_bmbt_irec got;371371+ bool trimmed;372372+373373+ *found = false;374374+375375+ /*376376+ * If we don't find an overlapping extent, trim the range we need to377377+ * allocate to fit the hole we found.378378+ */379379+ if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) ||380380+ got.br_startoff > offset_fsb)381381+ return xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed);382382+383383+ *shared = true;384384+ if (isnullstartblock(got.br_startblock)) {385385+ xfs_trim_extent(imap, got.br_startoff, got.br_blockcount);386386+ return 0;387387+ }388388+389389+ /* real extent found - no need to allocate */390390+ xfs_trim_extent(&got, offset_fsb, count_fsb);391391+ *imap = got;392392+ *found = true;393393+ return 0;394394+}395395+355396/* Allocate all CoW reservations covering a range of blocks in a file. */356397int357398xfs_reflink_allocate_cow(···404363 struct xfs_mount *mp = ip->i_mount;405364 xfs_fileoff_t offset_fsb = imap->br_startoff;406365 xfs_filblks_t count_fsb = imap->br_blockcount;407407- struct xfs_bmbt_irec got;408408- struct xfs_trans *tp = NULL;366366+ struct xfs_trans *tp;409367 int nimaps, error = 0;410410- bool trimmed;368368+ bool found;411369 xfs_filblks_t resaligned;412370 xfs_extlen_t resblks = 0;413413- struct xfs_iext_cursor icur;414371415415-retry:416416- ASSERT(xfs_is_reflink_inode(ip));417372 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));373373+ ASSERT(xfs_is_reflink_inode(ip));374374+375375+ error = xfs_find_trim_cow_extent(ip, imap, shared, &found);376376+ if (error || !*shared)377377+ return error;378378+ if (found)379379+ goto convert;380380+381381+ resaligned = xfs_aligned_fsb_count(imap->br_startoff,382382+ imap->br_blockcount, xfs_get_cowextsz_hint(ip));383383+ resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned);384384+385385+ xfs_iunlock(ip, *lockmode);386386+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp);387387+ *lockmode = XFS_ILOCK_EXCL;388388+ xfs_ilock(ip, *lockmode);389389+390390+ if (error)391391+ return error;392392+393393+ error = xfs_qm_dqattach_locked(ip, false);394394+ if (error)395395+ goto out_trans_cancel;418396419397 /*420420- * Even if the extent is not shared we might have a preallocation for421421- * it in the COW fork. If so use it.398398+ * Check for an overlapping extent again now that we dropped the ilock.422399 */423423- if (xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) &&424424- got.br_startoff <= offset_fsb) {425425- *shared = true;426426-427427- /* If we have a real allocation in the COW fork we're done. */428428- if (!isnullstartblock(got.br_startblock)) {429429- xfs_trim_extent(&got, offset_fsb, count_fsb);430430- *imap = got;431431- goto convert;432432- }433433-434434- xfs_trim_extent(imap, got.br_startoff, got.br_blockcount);435435- } else {436436- error = xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed);437437- if (error || !*shared)438438- goto out;439439- }440440-441441- if (!tp) {442442- resaligned = xfs_aligned_fsb_count(imap->br_startoff,443443- imap->br_blockcount, xfs_get_cowextsz_hint(ip));444444- resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned);445445-446446- xfs_iunlock(ip, *lockmode);447447- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp);448448- *lockmode = XFS_ILOCK_EXCL;449449- xfs_ilock(ip, *lockmode);450450-451451- if (error)452452- return error;453453-454454- error = xfs_qm_dqattach_locked(ip, false);455455- if (error)456456- goto out;457457- goto retry;400400+ error = xfs_find_trim_cow_extent(ip, imap, shared, &found);401401+ if (error || !*shared)402402+ goto out_trans_cancel;403403+ if (found) {404404+ xfs_trans_cancel(tp);405405+ goto convert;458406 }459407460408 error = xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0,461409 XFS_QMOPT_RES_REGBLKS);462410 if (error)463463- goto out;411411+ goto out_trans_cancel;464412465413 xfs_trans_ijoin(tp, ip, 0);466414467467- nimaps = 1;468468-469415 /* Allocate the entire reservation as unwritten blocks. */416416+ nimaps = 1;470417 error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,471418 XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC,472419 resblks, imap, &nimaps);473420 if (error)474474- goto out_trans_cancel;421421+ goto out_unreserve;475422476423 xfs_inode_set_cowblocks_tag(ip);477477-478478- /* Finish up. */479424 error = xfs_trans_commit(tp);480425 if (error)481426 return error;···474447 return -ENOSPC;475448convert:476449 return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);477477-out_trans_cancel:450450+451451+out_unreserve:478452 xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,479453 XFS_QMOPT_RES_REGBLKS);480480-out:481481- if (tp)482482- xfs_trans_cancel(tp);454454+out_trans_cancel:455455+ xfs_trans_cancel(tp);483456 return error;484457}485458···693666 if (!del.br_blockcount)694667 goto prev_extent;695668696696- ASSERT(!isnullstartblock(got.br_startblock));697697-698669 /*699699- * Don't remap unwritten extents; these are700700- * speculatively preallocated CoW extents that have been701701- * allocated but have not yet been involved in a write.670670+ * Only remap real extent that contain data. With AIO671671+ * speculatively preallocations can leak into the range we672672+ * are called upon, and we need to skip them.702673 */703703- if (got.br_state == XFS_EXT_UNWRITTEN)674674+ if (!xfs_bmap_is_real_extent(&got))704675 goto prev_extent;705676706677 /* Unmap the old blocks in the data fork. */
···259259 struct xfs_trans *tp;260260 int error;261261262262+ /*263263+ * Allocate the handle before we do our freeze accounting and setting up264264+ * GFP_NOFS allocation context so that we avoid lockdep false positives265265+ * by doing GFP_KERNEL allocations inside sb_start_intwrite().266266+ */267267+ tp = kmem_zone_zalloc(xfs_trans_zone,268268+ (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);269269+262270 if (!(flags & XFS_TRANS_NO_WRITECOUNT))263271 sb_start_intwrite(mp->m_super);264272···278270 mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);279271 atomic_inc(&mp->m_active_trans);280272281281- tp = kmem_zone_zalloc(xfs_trans_zone,282282- (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);283273 tp->t_magic = XFS_TRANS_HEADER_MAGIC;284274 tp->t_flags = flags;285275 tp->t_mountp = mp;
+25-76
fs/xfs/xfs_trans_buf.c
···322322}323323324324/*325325- * Release the buffer bp which was previously acquired with one of the326326- * xfs_trans_... buffer allocation routines if the buffer has not327327- * been modified within this transaction. If the buffer is modified328328- * within this transaction, do decrement the recursion count but do329329- * not release the buffer even if the count goes to 0. If the buffer is not330330- * modified within the transaction, decrement the recursion count and331331- * release the buffer if the recursion count goes to 0.325325+ * Release a buffer previously joined to the transaction. If the buffer is326326+ * modified within this transaction, decrement the recursion count but do not327327+ * release the buffer even if the count goes to 0. If the buffer is not modified328328+ * within the transaction, decrement the recursion count and release the buffer329329+ * if the recursion count goes to 0.332330 *333333- * If the buffer is to be released and it was not modified before334334- * this transaction began, then free the buf_log_item associated with it.331331+ * If the buffer is to be released and it was not already dirty before this332332+ * transaction began, then also free the buf_log_item associated with it.335333 *336336- * If the transaction pointer is NULL, make this just a normal337337- * brelse() call.334334+ * If the transaction pointer is NULL, this is a normal xfs_buf_relse() call.338335 */339336void340337xfs_trans_brelse(341341- xfs_trans_t *tp,342342- xfs_buf_t *bp)338338+ struct xfs_trans *tp,339339+ struct xfs_buf *bp)343340{344344- struct xfs_buf_log_item *bip;345345- int freed;341341+ struct xfs_buf_log_item *bip = bp->b_log_item;346342347347- /*348348- * Default to a normal brelse() call if the tp is NULL.349349- */350350- if (tp == NULL) {351351- ASSERT(bp->b_transp == NULL);343343+ ASSERT(bp->b_transp == tp);344344+345345+ if (!tp) {352346 xfs_buf_relse(bp);353347 return;354348 }355349356356- ASSERT(bp->b_transp == tp);357357- bip = bp->b_log_item;350350+ trace_xfs_trans_brelse(bip);358351 ASSERT(bip->bli_item.li_type == XFS_LI_BUF);359359- ASSERT(!(bip->bli_flags & XFS_BLI_STALE));360360- ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));361352 ASSERT(atomic_read(&bip->bli_refcount) > 0);362353363363- trace_xfs_trans_brelse(bip);364364-365354 /*366366- * If the release is just for a recursive lock,367367- * then decrement the count and return.355355+ * If the release is for a recursive lookup, then decrement the count356356+ * and return.368357 */369358 if (bip->bli_recur > 0) {370359 bip->bli_recur--;···361372 }362373363374 /*364364- * If the buffer is dirty within this transaction, we can't375375+ * If the buffer is invalidated or dirty in this transaction, we can't365376 * release it until we commit.366377 */367378 if (test_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags))368379 return;369369-370370- /*371371- * If the buffer has been invalidated, then we can't release372372- * it until the transaction commits to disk unless it is re-dirtied373373- * as part of this transaction. This prevents us from pulling374374- * the item from the AIL before we should.375375- */376380 if (bip->bli_flags & XFS_BLI_STALE)377381 return;378382383383+ /*384384+ * Unlink the log item from the transaction and clear the hold flag, if385385+ * set. We wouldn't want the next user of the buffer to get confused.386386+ */379387 ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED));380380-381381- /*382382- * Free up the log item descriptor tracking the released item.383383- */384388 xfs_trans_del_item(&bip->bli_item);389389+ bip->bli_flags &= ~XFS_BLI_HOLD;385390386386- /*387387- * Clear the hold flag in the buf log item if it is set.388388- * We wouldn't want the next user of the buffer to389389- * get confused.390390- */391391- if (bip->bli_flags & XFS_BLI_HOLD) {392392- bip->bli_flags &= ~XFS_BLI_HOLD;393393- }394394-395395- /*396396- * Drop our reference to the buf log item.397397- */398398- freed = atomic_dec_and_test(&bip->bli_refcount);399399-400400- /*401401- * If the buf item is not tracking data in the log, then we must free it402402- * before releasing the buffer back to the free pool.403403- *404404- * If the fs has shutdown and we dropped the last reference, it may fall405405- * on us to release a (possibly dirty) bli if it never made it to the406406- * AIL (e.g., the aborted unpin already happened and didn't release it407407- * due to our reference). Since we're already shutdown and need408408- * ail_lock, just force remove from the AIL and release the bli here.409409- */410410- if (XFS_FORCED_SHUTDOWN(tp->t_mountp) && freed) {411411- xfs_trans_ail_remove(&bip->bli_item, SHUTDOWN_LOG_IO_ERROR);412412- xfs_buf_item_relse(bp);413413- } else if (!(bip->bli_flags & XFS_BLI_DIRTY)) {414414-/***415415- ASSERT(bp->b_pincount == 0);416416-***/417417- ASSERT(atomic_read(&bip->bli_refcount) == 0);418418- ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags));419419- ASSERT(!(bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF));420420- xfs_buf_item_relse(bp);421421- }391391+ /* drop the reference to the bli */392392+ xfs_buf_item_put(bip);422393423394 bp->b_transp = NULL;424395 xfs_buf_relse(bp);
···5353 FPGA_MGR_STATE_OPERATING,5454};55555656-/*5757- * FPGA Manager flags5858- * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported5959- * FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting6060- * FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first6161- * FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed5656+/**5757+ * DOC: FPGA Manager flags5858+ *5959+ * Flags used in the &fpga_image_info->flags field6060+ *6161+ * %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported6262+ *6363+ * %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting6464+ *6565+ * %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted6666+ *6767+ * %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first6868+ *6969+ * %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed6270 */6371#define FPGA_MGR_PARTIAL_RECONFIG BIT(0)6472#define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
···24552455 return vma;24562456}2457245724582458+static inline bool range_in_vma(struct vm_area_struct *vma,24592459+ unsigned long start, unsigned long end)24602460+{24612461+ return (vma && vma->vm_start <= start && end <= vma->vm_end);24622462+}24632463+24582464#ifdef CONFIG_MMU24592465pgprot_t vm_get_page_prot(unsigned long vm_flags);24602466void vma_set_page_prot(struct vm_area_struct *vma);
-6
include/linux/mmzone.h
···671671#ifdef CONFIG_NUMA_BALANCING672672 /* Lock serializing the migrate rate limiting window */673673 spinlock_t numabalancing_migrate_lock;674674-675675- /* Rate limiting time interval */676676- unsigned long numabalancing_migrate_next_window;677677-678678- /* Number of pages migrated during the rate limiting time interval */679679- unsigned long numabalancing_migrate_nr_pages;680674#endif681675 /*682676 * This is a per-node reserve of pages that are not available
+3
include/linux/netdevice.h
···17301730 * switch driver and used to set the phys state of the17311731 * switch port.17321732 *17331733+ * @wol_enabled: Wake-on-LAN is enabled17341734+ *17331735 * FIXME: cleanup struct net_device such that network protocol info17341736 * moves out.17351737 */···20162014 struct lock_class_key *qdisc_tx_busylock;20172015 struct lock_class_key *qdisc_running_key;20182016 bool proto_down;20172017+ unsigned wol_enabled:1;20192018};20202019#define to_net_dev(d) container_of(d, struct net_device, dev)20212020
+2
include/linux/netfilter.h
···215215 break;216216 case NFPROTO_ARP:217217#ifdef CONFIG_NETFILTER_FAMILY_ARP218218+ if (WARN_ON_ONCE(hook >= ARRAY_SIZE(net->nf.hooks_arp)))219219+ break;218220 hook_head = rcu_dereference(net->nf.hooks_arp[hook]);219221#endif220222 break;
···55#include <linux/if_vlan.h>66#include <uapi/linux/virtio_net.h>7788+static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,99+ const struct virtio_net_hdr *hdr)1010+{1111+ switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {1212+ case VIRTIO_NET_HDR_GSO_TCPV4:1313+ case VIRTIO_NET_HDR_GSO_UDP:1414+ skb->protocol = cpu_to_be16(ETH_P_IP);1515+ break;1616+ case VIRTIO_NET_HDR_GSO_TCPV6:1717+ skb->protocol = cpu_to_be16(ETH_P_IPV6);1818+ break;1919+ default:2020+ return -EINVAL;2121+ }2222+2323+ return 0;2424+}2525+826static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,927 const struct virtio_net_hdr *hdr,1028 bool little_endian)
+4
include/media/v4l2-fh.h
···3838 * @prio: priority of the file handler, as defined by &enum v4l2_priority3939 *4040 * @wait: event' s wait queue4141+ * @subscribe_lock: serialise changes to the subscribed list; guarantee that4242+ * the add and del event callbacks are orderly called4143 * @subscribed: list of subscribed events4244 * @available: list of events waiting to be dequeued4345 * @navailable: number of available events at @available list4446 * @sequence: event sequence number4747+ *4548 * @m2m_ctx: pointer to &struct v4l2_m2m_ctx4649 */4750struct v4l2_fh {···55525653 /* Events */5754 wait_queue_head_t wait;5555+ struct mutex subscribe_lock;5856 struct list_head subscribed;5957 struct list_head available;6058 unsigned int navailable;
···48524852 *48534853 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.48544854 * @freq: the freqency(in MHz) to be queried.48554855- * @ptr: pointer where the regdb wmm data is to be stored (or %NULL if48564856- * irrelevant). This can be used later for deduplication.48574855 * @rule: pointer to store the wmm rule from the regulatory db.48584856 *48594857 * Self-managed wireless drivers can use this function to query
···206206 * Callers of shm_lock() must validate the status of the returned ipc207207 * object pointer and error out as appropriate.208208 */209209- return (void *)ipcp;209209+ return ERR_CAST(ipcp);210210}211211212212static inline void shm_lock_by_ptr(struct shmid_kernel *ipcp)
+4-1
kernel/bpf/local_storage.c
···129129 struct bpf_cgroup_storage *storage;130130 struct bpf_storage_buffer *new;131131132132- if (flags & BPF_NOEXIST)132132+ if (flags != BPF_ANY && flags != BPF_EXIST)133133 return -EINVAL;134134135135 storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map,···193193 struct bpf_cgroup_storage_map *map;194194195195 if (attr->key_size != sizeof(struct bpf_cgroup_storage_key))196196+ return ERR_PTR(-EINVAL);197197+198198+ if (attr->value_size == 0)196199 return ERR_PTR(-EINVAL);197200198201 if (attr->value_size > PAGE_SIZE)
+9-1
kernel/bpf/verifier.c
···28962896 u64 umin_val, umax_val;28972897 u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;2898289828992899+ if (insn_bitness == 32) {29002900+ /* Relevant for 32-bit RSH: Information can propagate towards29012901+ * LSB, so it isn't sufficient to only truncate the output to29022902+ * 32 bits.29032903+ */29042904+ coerce_reg_to_size(dst_reg, 4);29052905+ coerce_reg_to_size(&src_reg, 4);29062906+ }29072907+28992908 smin_val = src_reg.smin_value;29002909 smax_val = src_reg.smax_value;29012910 umin_val = src_reg.umin_value;···31403131 if (BPF_CLASS(insn->code) != BPF_ALU64) {31413132 /* 32-bit ALU ops are (32,32)->32 */31423133 coerce_reg_to_size(dst_reg, 4);31433143- coerce_reg_to_size(&src_reg, 4);31443134 }3145313531463136 __reg_deduce_bounds(dst_reg);
+4-7
kernel/events/core.c
···83148314 goto unlock;8315831583168316 list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {83178317+ if (event->cpu != smp_processor_id())83188318+ continue;83178319 if (event->attr.type != PERF_TYPE_TRACEPOINT)83188320 continue;83198321 if (event->attr.config != entry->type)···94339431 if (pmu->task_ctx_nr > perf_invalid_context)94349432 return;9435943394369436- mutex_lock(&pmus_lock);94379434 free_percpu(pmu->pmu_cpu_context);94389438- mutex_unlock(&pmus_lock);94399435}9440943694419437/*···9689968996909690void perf_pmu_unregister(struct pmu *pmu)96919691{96929692- int remove_device;96939693-96949692 mutex_lock(&pmus_lock);96959695- remove_device = pmu_bus_running;96969693 list_del_rcu(&pmu->entry);96979697- mutex_unlock(&pmus_lock);9698969496999695 /*97009696 * We dereference the pmu list under both SRCU and regular RCU, so···97029706 free_percpu(pmu->pmu_disable_count);97039707 if (pmu->type >= PERF_TYPE_MAX)97049708 idr_remove(&pmu_idr, pmu->type);97059705- if (remove_device) {97099709+ if (pmu_bus_running) {97069710 if (pmu->nr_addr_filters)97079711 device_remove_file(pmu->dev, &dev_attr_nr_addr_filters);97089712 device_del(pmu->dev);97099713 put_device(pmu->dev);97109714 }97119715 free_pmu_context(pmu);97169716+ mutex_unlock(&pmus_lock);97129717}97139718EXPORT_SYMBOL_GPL(perf_pmu_unregister);97149719
+6-4
kernel/locking/test-ww_mutex.c
···260260{261261 struct test_cycle *cycle = container_of(work, typeof(*cycle), work);262262 struct ww_acquire_ctx ctx;263263- int err;263263+ int err, erra = 0;264264265265 ww_acquire_init(&ctx, &ww_class);266266 ww_mutex_lock(&cycle->a_mutex, &ctx);···270270271271 err = ww_mutex_lock(cycle->b_mutex, &ctx);272272 if (err == -EDEADLK) {273273+ err = 0;273274 ww_mutex_unlock(&cycle->a_mutex);274275 ww_mutex_lock_slow(cycle->b_mutex, &ctx);275275- err = ww_mutex_lock(&cycle->a_mutex, &ctx);276276+ erra = ww_mutex_lock(&cycle->a_mutex, &ctx);276277 }277278278279 if (!err)279280 ww_mutex_unlock(cycle->b_mutex);280280- ww_mutex_unlock(&cycle->a_mutex);281281+ if (!erra)282282+ ww_mutex_unlock(&cycle->a_mutex);281283 ww_acquire_fini(&ctx);282284283283- cycle->result = err;285285+ cycle->result = err ?: erra;284286}285287286288static int __test_cycle(unsigned int nthreads)
+1-1
kernel/sched/core.c
···1167116711681168 if (task_cpu(p) != new_cpu) {11691169 if (p->sched_class->migrate_task_rq)11701170- p->sched_class->migrate_task_rq(p);11701170+ p->sched_class->migrate_task_rq(p, new_cpu);11711171 p->se.nr_migrations++;11721172 rseq_migrate(p);11731173 perf_event_task_migrate(p);
···13921392 int last_cpupid, this_cpupid;1393139313941394 this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid);13951395+ last_cpupid = page_cpupid_xchg_last(page, this_cpupid);13961396+13971397+ /*13981398+ * Allow first faults or private faults to migrate immediately early in13991399+ * the lifetime of a task. The magic number 4 is based on waiting for14001400+ * two full passes of the "multi-stage node selection" test that is14011401+ * executed below.14021402+ */14031403+ if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&14041404+ (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))14051405+ return true;1395140613961407 /*13971408 * Multi-stage node selection is used in conjunction with a periodic···14211410 * This quadric squishes small probabilities, making it less likely we14221411 * act on an unlikely task<->page relation.14231412 */14241424- last_cpupid = page_cpupid_xchg_last(page, this_cpupid);14251413 if (!cpupid_pid_unset(last_cpupid) &&14261414 cpupid_to_nid(last_cpupid) != dst_nid)14271415 return false;···15241514static void task_numa_assign(struct task_numa_env *env,15251515 struct task_struct *p, long imp)15261516{15171517+ struct rq *rq = cpu_rq(env->dst_cpu);15181518+15191519+ /* Bail out if run-queue part of active NUMA balance. */15201520+ if (xchg(&rq->numa_migrate_on, 1))15211521+ return;15221522+15231523+ /*15241524+ * Clear previous best_cpu/rq numa-migrate flag, since task now15251525+ * found a better CPU to move/swap.15261526+ */15271527+ if (env->best_cpu != -1) {15281528+ rq = cpu_rq(env->best_cpu);15291529+ WRITE_ONCE(rq->numa_migrate_on, 0);15301530+ }15311531+15271532 if (env->best_task)15281533 put_task_struct(env->best_task);15291534 if (p)···15781553}1579155415801555/*15561556+ * Maximum NUMA importance can be 1998 (2*999);15571557+ * SMALLIMP @ 30 would be close to 1998/64.15581558+ * Used to deter task migration.15591559+ */15601560+#define SMALLIMP 3015611561+15621562+/*15811563 * This checks if the overall compute and NUMA accesses of the system would15821564 * be improved if the source tasks was migrated to the target dst_cpu taking15831565 * into account that it might be best if task running on the dst_cpu should···16011569 long moveimp = imp;16021570 int dist = env->dist;1603157115721572+ if (READ_ONCE(dst_rq->numa_migrate_on))15731573+ return;15741574+16041575 rcu_read_lock();16051576 cur = task_rcu_dereference(&dst_rq->curr);16061577 if (cur && ((cur->flags & PF_EXITING) || is_idle_task(cur)))···16171582 goto unlock;1618158316191584 if (!cur) {16201620- if (maymove || imp > env->best_imp)15851585+ if (maymove && moveimp >= env->best_imp)16211586 goto assign;16221587 else16231588 goto unlock;···16601625 task_weight(cur, env->dst_nid, dist);16611626 }1662162716631663- if (imp <= env->best_imp)16641664- goto unlock;16651665-16661628 if (maymove && moveimp > imp && moveimp > env->best_imp) {16671667- imp = moveimp - 1;16291629+ imp = moveimp;16681630 cur = NULL;16691631 goto assign;16701632 }16331633+16341634+ /*16351635+ * If the NUMA importance is less than SMALLIMP,16361636+ * task migration might only result in ping pong16371637+ * of tasks and also hurt performance due to cache16381638+ * misses.16391639+ */16401640+ if (imp < SMALLIMP || imp <= env->best_imp + SMALLIMP / 2)16411641+ goto unlock;1671164216721643 /*16731644 * In the overloaded case, try and keep the load balanced.···17511710 .best_cpu = -1,17521711 };17531712 struct sched_domain *sd;17131713+ struct rq *best_rq;17541714 unsigned long taskweight, groupweight;17551715 int nid, ret, dist;17561716 long taskimp, groupimp;···18471805 if (env.best_cpu == -1)18481806 return -EAGAIN;1849180718501850- /*18511851- * Reset the scan period if the task is being rescheduled on an18521852- * alternative node to recheck if the tasks is now properly placed.18531853- */18541854- p->numa_scan_period = task_scan_start(p);18551855-18081808+ best_rq = cpu_rq(env.best_cpu);18561809 if (env.best_task == NULL) {18571810 ret = migrate_task_to(p, env.best_cpu);18111811+ WRITE_ONCE(best_rq->numa_migrate_on, 0);18581812 if (ret != 0)18591813 trace_sched_stick_numa(p, env.src_cpu, env.best_cpu);18601814 return ret;18611815 }1862181618631817 ret = migrate_swap(p, env.best_task, env.best_cpu, env.src_cpu);18181818+ WRITE_ONCE(best_rq->numa_migrate_on, 0);1864181918651820 if (ret != 0)18661821 trace_sched_stick_numa(p, env.src_cpu, task_cpu(env.best_task));···26352596 }26362597}2637259825992599+static void update_scan_period(struct task_struct *p, int new_cpu)26002600+{26012601+ int src_nid = cpu_to_node(task_cpu(p));26022602+ int dst_nid = cpu_to_node(new_cpu);26032603+26042604+ if (!static_branch_likely(&sched_numa_balancing))26052605+ return;26062606+26072607+ if (!p->mm || !p->numa_faults || (p->flags & PF_EXITING))26082608+ return;26092609+26102610+ if (src_nid == dst_nid)26112611+ return;26122612+26132613+ /*26142614+ * Allow resets if faults have been trapped before one scan26152615+ * has completed. This is most likely due to a new task that26162616+ * is pulled cross-node due to wakeups or load balancing.26172617+ */26182618+ if (p->numa_scan_seq) {26192619+ /*26202620+ * Avoid scan adjustments if moving to the preferred26212621+ * node or if the task was not previously running on26222622+ * the preferred node.26232623+ */26242624+ if (dst_nid == p->numa_preferred_nid ||26252625+ (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))26262626+ return;26272627+ }26282628+26292629+ p->numa_scan_period = task_scan_start(p);26302630+}26312631+26382632#else26392633static void task_tick_numa(struct rq *rq, struct task_struct *curr)26402634{···26782606}2679260726802608static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p)26092609+{26102610+}26112611+26122612+static inline void update_scan_period(struct task_struct *p, int new_cpu)26812613{26822614}26832615···63516275 * cfs_rq_of(p) references at time of call are still valid and identify the63526276 * previous CPU. The caller guarantees p->pi_lock or task_rq(p)->lock is held.63536277 */63546354-static void migrate_task_rq_fair(struct task_struct *p)62786278+static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)63556279{63566280 /*63576281 * As blocked tasks retain absolute vruntime the migration needs to···6404632864056329 /* We have migrated, no longer consider this task hot */64066330 p->se.exec_start = 0;63316331+63326332+ update_scan_period(p, new_cpu);64076333}6408633464096335static void task_dead_fair(struct task_struct *p)
+2-1
kernel/sched/sched.h
···783783#ifdef CONFIG_NUMA_BALANCING784784 unsigned int nr_numa_running;785785 unsigned int nr_preferred_running;786786+ unsigned int numa_migrate_on;786787#endif787788 #define CPU_LOAD_IDX_MAX 5788789 unsigned long cpu_load[CPU_LOAD_IDX_MAX];···1524152315251524#ifdef CONFIG_SMP15261525 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);15271527- void (*migrate_task_rq)(struct task_struct *p);15261526+ void (*migrate_task_rq)(struct task_struct *p, int new_cpu);1528152715291528 void (*task_woken)(struct rq *this_rq, struct task_struct *task);15301529
-1
lib/xz/xz_crc32.c
···1515 * but they are bigger and use more memory for the lookup table.1616 */17171818-#include <linux/crc32poly.h>1918#include "xz_private.h"20192120/*
+4
lib/xz/xz_private.h
···102102# endif103103#endif104104105105+#ifndef CRC32_POLY_LE106106+#define CRC32_POLY_LE 0xedb88320107107+#endif108108+105109/*106110 * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used107111 * before calling xz_dec_lzma2_run().
+2-1
mm/gup_benchmark.c
···1919 struct gup_benchmark *gup)2020{2121 ktime_t start_time, end_time;2222- unsigned long i, nr, nr_pages, addr, next;2222+ unsigned long i, nr_pages, addr, next;2323+ int nr;2324 struct page **pages;24252526 nr_pages = gup->size / PAGE_SIZE;
···33263326 struct page *page;33273327 struct hstate *h = hstate_vma(vma);33283328 unsigned long sz = huge_page_size(h);33293329- const unsigned long mmun_start = start; /* For mmu_notifiers */33303330- const unsigned long mmun_end = end; /* For mmu_notifiers */33293329+ unsigned long mmun_start = start; /* For mmu_notifiers */33303330+ unsigned long mmun_end = end; /* For mmu_notifiers */3331333133323332 WARN_ON(!is_vm_hugetlb_page(vma));33333333 BUG_ON(start & ~huge_page_mask(h));···33393339 */33403340 tlb_remove_check_page_size_change(tlb, sz);33413341 tlb_start_vma(tlb, vma);33423342+33433343+ /*33443344+ * If sharing possible, alert mmu notifiers of worst case.33453345+ */33463346+ adjust_range_if_pmd_sharing_possible(vma, &mmun_start, &mmun_end);33423347 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);33433348 address = start;33443349 for (; address < end; address += sz) {···33543349 ptl = huge_pte_lock(h, mm, ptep);33553350 if (huge_pmd_unshare(mm, &address, ptep)) {33563351 spin_unlock(ptl);33523352+ /*33533353+ * We just unmapped a page of PMDs by clearing a PUD.33543354+ * The caller's TLB flush range should cover this area.33553355+ */33573356 continue;33583357 }33593358···34403431{34413432 struct mm_struct *mm;34423433 struct mmu_gather tlb;34343434+ unsigned long tlb_start = start;34353435+ unsigned long tlb_end = end;34363436+34373437+ /*34383438+ * If shared PMDs were possibly used within this vma range, adjust34393439+ * start/end for worst case tlb flushing.34403440+ * Note that we can not be sure if PMDs are shared until we try to34413441+ * unmap pages. However, we want to make sure TLB flushing covers34423442+ * the largest possible range.34433443+ */34443444+ adjust_range_if_pmd_sharing_possible(vma, &tlb_start, &tlb_end);3443344534443446 mm = vma->vm_mm;3445344734463446- tlb_gather_mmu(&tlb, mm, start, end);34483448+ tlb_gather_mmu(&tlb, mm, tlb_start, tlb_end);34473449 __unmap_hugepage_range(&tlb, vma, start, end, ref_page);34483448- tlb_finish_mmu(&tlb, start, end);34503450+ tlb_finish_mmu(&tlb, tlb_start, tlb_end);34493451}3450345234513453/*···43184298 pte_t pte;43194299 struct hstate *h = hstate_vma(vma);43204300 unsigned long pages = 0;43014301+ unsigned long f_start = start;43024302+ unsigned long f_end = end;43034303+ bool shared_pmd = false;43044304+43054305+ /*43064306+ * In the case of shared PMDs, the area to flush could be beyond43074307+ * start/end. Set f_start/f_end to cover the maximum possible43084308+ * range if PMD sharing is possible.43094309+ */43104310+ adjust_range_if_pmd_sharing_possible(vma, &f_start, &f_end);4321431143224312 BUG_ON(address >= end);43234323- flush_cache_range(vma, address, end);43134313+ flush_cache_range(vma, f_start, f_end);4324431443254325- mmu_notifier_invalidate_range_start(mm, start, end);43154315+ mmu_notifier_invalidate_range_start(mm, f_start, f_end);43264316 i_mmap_lock_write(vma->vm_file->f_mapping);43274317 for (; address < end; address += huge_page_size(h)) {43284318 spinlock_t *ptl;···43434313 if (huge_pmd_unshare(mm, &address, ptep)) {43444314 pages++;43454315 spin_unlock(ptl);43164316+ shared_pmd = true;43464317 continue;43474318 }43484319 pte = huge_ptep_get(ptep);···43794348 * Must flush TLB before releasing i_mmap_rwsem: x86's huge_pmd_unshare43804349 * may have cleared our pud entry and done put_page on the page table:43814350 * once we release i_mmap_rwsem, another task can do the final put_page43824382- * and that page table be reused and filled with junk.43514351+ * and that page table be reused and filled with junk. If we actually43524352+ * did unshare a page of pmds, flush the range corresponding to the pud.43834353 */43844384- flush_hugetlb_tlb_range(vma, start, end);43544354+ if (shared_pmd)43554355+ flush_hugetlb_tlb_range(vma, f_start, f_end);43564356+ else43574357+ flush_hugetlb_tlb_range(vma, start, end);43854358 /*43864359 * No need to call mmu_notifier_invalidate_range() we are downgrading43874360 * page table protection not changing it to point to a new page.···43934358 * See Documentation/vm/mmu_notifier.rst43944359 */43954360 i_mmap_unlock_write(vma->vm_file->f_mapping);43964396- mmu_notifier_invalidate_range_end(mm, start, end);43614361+ mmu_notifier_invalidate_range_end(mm, f_start, f_end);4397436243984363 return pages << h->order;43994364}···45804545 /*45814546 * check on proper vm_flags and page table alignment45824547 */45834583- if (vma->vm_flags & VM_MAYSHARE &&45844584- vma->vm_start <= base && end <= vma->vm_end)45484548+ if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end))45854549 return true;45864550 return false;45514551+}45524552+45534553+/*45544554+ * Determine if start,end range within vma could be mapped by shared pmd.45554555+ * If yes, adjust start and end to cover range associated with possible45564556+ * shared pmd mappings.45574557+ */45584558+void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,45594559+ unsigned long *start, unsigned long *end)45604560+{45614561+ unsigned long check_addr = *start;45624562+45634563+ if (!(vma->vm_flags & VM_MAYSHARE))45644564+ return;45654565+45664566+ for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) {45674567+ unsigned long a_start = check_addr & PUD_MASK;45684568+ unsigned long a_end = a_start + PUD_SIZE;45694569+45704570+ /*45714571+ * If sharing is possible, adjust start/end if necessary.45724572+ */45734573+ if (range_in_vma(vma, a_start, a_end)) {45744574+ if (a_start < *start)45754575+ *start = a_start;45764576+ if (a_end > *end)45774577+ *end = a_end;45784578+ }45794579+ }45874580}4588458145894582/*···47104647int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)47114648{47124649 return 0;46504650+}46514651+46524652+void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,46534653+ unsigned long *start, unsigned long *end)46544654+{47134655}47144656#define want_pmd_share() (0)47154657#endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
+1-1
mm/madvise.c
···9696 new_flags |= VM_DONTDUMP;9797 break;9898 case MADV_DODUMP:9999- if (new_flags & VM_SPECIAL) {9999+ if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) {100100 error = -EINVAL;101101 goto out;102102 }
+4-58
mm/migrate.c
···275275 if (vma->vm_flags & VM_LOCKED && !PageTransCompound(new))276276 mlock_vma_page(new);277277278278+ if (PageTransHuge(page) && PageMlocked(page))279279+ clear_page_mlock(page);280280+278281 /* No need to invalidate - it was non-present before */279282 update_mmu_cache(vma, pvmw.address, pvmw.pte);280283 }···14141411 * we encounter them after the rest of the list14151412 * is processed.14161413 */14171417- if (PageTransHuge(page)) {14141414+ if (PageTransHuge(page) && !PageHuge(page)) {14181415 lock_page(page);14191416 rc = split_huge_page_to_list(page, from);14201417 unlock_page(page);···18581855 return newpage;18591856}1860185718611861-/*18621862- * page migration rate limiting control.18631863- * Do not migrate more than @pages_to_migrate in a @migrate_interval_millisecs18641864- * window of time. Default here says do not migrate more than 1280M per second.18651865- */18661866-static unsigned int migrate_interval_millisecs __read_mostly = 100;18671867-static unsigned int ratelimit_pages __read_mostly = 128 << (20 - PAGE_SHIFT);18681868-18691869-/* Returns true if the node is migrate rate-limited after the update */18701870-static bool numamigrate_update_ratelimit(pg_data_t *pgdat,18711871- unsigned long nr_pages)18721872-{18731873- /*18741874- * Rate-limit the amount of data that is being migrated to a node.18751875- * Optimal placement is no good if the memory bus is saturated and18761876- * all the time is being spent migrating!18771877- */18781878- if (time_after(jiffies, pgdat->numabalancing_migrate_next_window)) {18791879- spin_lock(&pgdat->numabalancing_migrate_lock);18801880- pgdat->numabalancing_migrate_nr_pages = 0;18811881- pgdat->numabalancing_migrate_next_window = jiffies +18821882- msecs_to_jiffies(migrate_interval_millisecs);18831883- spin_unlock(&pgdat->numabalancing_migrate_lock);18841884- }18851885- if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) {18861886- trace_mm_numa_migrate_ratelimit(current, pgdat->node_id,18871887- nr_pages);18881888- return true;18891889- }18901890-18911891- /*18921892- * This is an unlocked non-atomic update so errors are possible.18931893- * The consequences are failing to migrate when we potentiall should18941894- * have which is not severe enough to warrant locking. If it is ever18951895- * a problem, it can be converted to a per-cpu counter.18961896- */18971897- pgdat->numabalancing_migrate_nr_pages += nr_pages;18981898- return false;18991899-}19001900-19011858static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)19021859{19031860 int page_lru;···19301967 if (page_is_file_cache(page) && PageDirty(page))19311968 goto out;1932196919331933- /*19341934- * Rate-limit the amount of data that is being migrated to a node.19351935- * Optimal placement is no good if the memory bus is saturated and19361936- * all the time is being spent migrating!19371937- */19381938- if (numamigrate_update_ratelimit(pgdat, 1))19391939- goto out;19401940-19411970 isolated = numamigrate_isolate_page(pgdat, page);19421971 if (!isolated)19431972 goto out;···19752020 int page_lru = page_is_file_cache(page);19762021 unsigned long mmun_start = address & HPAGE_PMD_MASK;19772022 unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE;19781978-19791979- /*19801980- * Rate-limit the amount of data that is being migrated to a node.19811981- * Optimal placement is no good if the memory bus is saturated and19821982- * all the time is being spent migrating!19831983- */19841984- if (numamigrate_update_ratelimit(pgdat, HPAGE_PMD_NR))19851985- goto out_dropref;1986202319872024 new_page = alloc_pages_node(node,19882025 (GFP_TRANSHUGE_LIGHT | __GFP_THISNODE),···2072212520732126out_fail:20742127 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);20752075-out_dropref:20762128 ptl = pmd_lock(mm, pmd);20772129 if (pmd_same(*pmd, entry)) {20782130 entry = pmd_modify(entry, vma->vm_page_prot);
···13621362 }1363136313641364 /*13651365- * We have to assume the worse case ie pmd for invalidation. Note that13661366- * the page can not be free in this function as call of try_to_unmap()13671367- * must hold a reference on the page.13651365+ * For THP, we have to assume the worse case ie pmd for invalidation.13661366+ * For hugetlb, it could be much worse if we need to do pud13671367+ * invalidation in the case of pmd sharing.13681368+ *13691369+ * Note that the page can not be free in this function as call of13701370+ * try_to_unmap() must hold a reference on the page.13681371 */13691372 end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));13731373+ if (PageHuge(page)) {13741374+ /*13751375+ * If sharing is possible, start and end will be adjusted13761376+ * accordingly.13771377+ */13781378+ adjust_range_if_pmd_sharing_possible(vma, &start, &end);13791379+ }13701380 mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);1371138113721382 while (page_vma_mapped_walk(&pvmw)) {···14191409 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);14201410 address = pvmw.address;1421141114121412+ if (PageHuge(page)) {14131413+ if (huge_pmd_unshare(mm, &address, pvmw.pte)) {14141414+ /*14151415+ * huge_pmd_unshare unmapped an entire PMD14161416+ * page. There is no way of knowing exactly14171417+ * which PMDs may be cached for this mm, so14181418+ * we must flush them all. start/end were14191419+ * already adjusted above to cover this range.14201420+ */14211421+ flush_cache_range(vma, start, end);14221422+ flush_tlb_range(vma, start, end);14231423+ mmu_notifier_invalidate_range(mm, start, end);14241424+14251425+ /*14261426+ * The ref count of the PMD page was dropped14271427+ * which is part of the way map counting14281428+ * is done for shared PMDs. Return 'true'14291429+ * here. When there is no other sharing,14301430+ * huge_pmd_unshare returns false and we will14311431+ * unmap the actual page and drop map count14321432+ * to zero.14331433+ */14341434+ page_vma_mapped_walk_done(&pvmw);14351435+ break;14361436+ }14371437+ }1422143814231439 if (IS_ENABLED(CONFIG_MIGRATION) &&14241440 (flags & TTU_MIGRATION) &&
+3-4
mm/vmscan.c
···580580 struct mem_cgroup *memcg, int priority)581581{582582 struct memcg_shrinker_map *map;583583- unsigned long freed = 0;584584- int ret, i;583583+ unsigned long ret, freed = 0;584584+ int i;585585586586 if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg))587587 return 0;···677677 struct mem_cgroup *memcg,678678 int priority)679679{680680+ unsigned long ret, freed = 0;680681 struct shrinker *shrinker;681681- unsigned long freed = 0;682682- int ret;683682684683 if (!mem_cgroup_is_root(memcg))685684 return shrink_slab_memcg(gfp_mask, nid, memcg, priority);
···24342434 /* LE address type */24352435 addr_type = le_addr_type(cp->addr.type);2436243624372437- hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type);24382438-24392439- err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);24372437+ /* Abort any ongoing SMP pairing. Removes ltk and irk if they exist. */24382438+ err = smp_cancel_and_remove_pairing(hdev, &cp->addr.bdaddr, addr_type);24402439 if (err < 0) {24412440 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,24422441 MGMT_STATUS_NOT_PAIRED, &rp,···24492450 goto done;24502451 }2451245224522452- /* Abort any ongoing SMP pairing */24532453- smp_cancel_pairing(conn);2454245324552454 /* Defer clearing up the connection parameters until closing to24562455 * give a chance of keeping them if a repairing happens.
+25-4
net/bluetooth/smp.c
···24222422 return ret;24232423}2424242424252425-void smp_cancel_pairing(struct hci_conn *hcon)24252425+int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,24262426+ u8 addr_type)24262427{24272427- struct l2cap_conn *conn = hcon->l2cap_data;24282428+ struct hci_conn *hcon;24292429+ struct l2cap_conn *conn;24282430 struct l2cap_chan *chan;24292431 struct smp_chan *smp;24322432+ int err;2430243324342434+ err = hci_remove_ltk(hdev, bdaddr, addr_type);24352435+ hci_remove_irk(hdev, bdaddr, addr_type);24362436+24372437+ hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);24382438+ if (!hcon)24392439+ goto done;24402440+24412441+ conn = hcon->l2cap_data;24312442 if (!conn)24322432- return;24432443+ goto done;2433244424342445 chan = conn->smp;24352446 if (!chan)24362436- return;24472447+ goto done;2437244824382449 l2cap_chan_lock(chan);2439245024402451 smp = chan->data;24412452 if (smp) {24532453+ /* Set keys to NULL to make sure smp_failure() does not try to24542454+ * remove and free already invalidated rcu list entries. */24552455+ smp->ltk = NULL;24562456+ smp->slave_ltk = NULL;24572457+ smp->remote_irk = NULL;24582458+24422459 if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))24432460 smp_failure(conn, 0);24442461 else24452462 smp_failure(conn, SMP_UNSPECIFIED);24632463+ err = 0;24462464 }2447246524482466 l2cap_chan_unlock(chan);24672467+24682468+done:24692469+ return err;24492470}2450247124512472static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
···14831483static int ethtool_set_wol(struct net_device *dev, char __user *useraddr)14841484{14851485 struct ethtool_wolinfo wol;14861486+ int ret;1486148714871488 if (!dev->ethtool_ops->set_wol)14881489 return -EOPNOTSUPP;···14911490 if (copy_from_user(&wol, useraddr, sizeof(wol)))14921491 return -EFAULT;1493149214941494- return dev->ethtool_ops->set_wol(dev, &wol);14931493+ ret = dev->ethtool_ops->set_wol(dev, &wol);14941494+ if (ret)14951495+ return ret;14961496+14971497+ dev->wol_enabled = !!wol.wolopts;14981498+14991499+ return 0;14951500}1496150114971502static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)
+3-19
net/core/netpoll.c
···135135 }136136}137137138138-/*139139- * Check whether delayed processing was scheduled for our NIC. If so,140140- * we attempt to grab the poll lock and use ->poll() to pump the card.141141- * If this fails, either we've recursed in ->poll() or it's already142142- * running on another CPU.143143- *144144- * Note: we don't mask interrupts with this lock because we're using145145- * trylock here and interrupts are already disabled in the softirq146146- * case. Further, we test the poll_owner to avoid recursion on UP147147- * systems where the lock doesn't exist.148148- */149138static void poll_one_napi(struct napi_struct *napi)150139{151151- int work = 0;152152-153153- /* net_rx_action's ->poll() invocations and our's are154154- * synchronized by this test which is only made while155155- * holding the napi->poll_lock.156156- */157157- if (!test_bit(NAPI_STATE_SCHED, &napi->state))158158- return;140140+ int work;159141160142 /* If we set this bit but see that it has already been set,161143 * that indicates that napi has been disabled and we need···312330 /* It is up to the caller to keep npinfo alive. */313331 struct netpoll_info *npinfo;314332333333+ rcu_read_lock_bh();315334 lockdep_assert_irqs_disabled();316335317336 npinfo = rcu_dereference_bh(np->dev->npinfo);···357374 skb_queue_tail(&npinfo->txq, skb);358375 schedule_delayed_work(&npinfo->tx_work,0);359376 }377377+ rcu_read_unlock_bh();360378}361379EXPORT_SYMBOL(netpoll_send_skb_on_dev);362380
+28-13
net/core/rtnetlink.c
···18981898 if (tb[IFLA_IF_NETNSID]) {18991899 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);19001900 tgt_net = get_target_net(skb->sk, netnsid);19011901- if (IS_ERR(tgt_net)) {19021902- tgt_net = net;19031903- netnsid = -1;19041904- }19011901+ if (IS_ERR(tgt_net))19021902+ return PTR_ERR(tgt_net);19051903 }1906190419071905 if (tb[IFLA_EXT_MASK])···28352837 else if (ops->get_num_rx_queues)28362838 num_rx_queues = ops->get_num_rx_queues();2837283928402840+ if (num_tx_queues < 1 || num_tx_queues > 4096)28412841+ return ERR_PTR(-EINVAL);28422842+28432843+ if (num_rx_queues < 1 || num_rx_queues > 4096)28442844+ return ERR_PTR(-EINVAL);28452845+28382846 dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type,28392847 ops->setup, num_tx_queues, num_rx_queues);28402848 if (!dev)···37483744 int err = 0;37493745 int fidx = 0;3750374637513751- err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,37523752- IFLA_MAX, ifla_policy, NULL);37533753- if (err < 0) {37543754- return -EINVAL;37553755- } else if (err == 0) {37563756- if (tb[IFLA_MASTER])37573757- br_idx = nla_get_u32(tb[IFLA_MASTER]);37583758- }37473747+ /* A hack to preserve kernel<->userspace interface.37483748+ * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0.37493749+ * However, ndmsg is shorter than ifinfomsg thus nlmsg_parse() bails.37503750+ * So, check for ndmsg with an optional u32 attribute (not used here).37513751+ * Fortunately these sizes don't conflict with the size of ifinfomsg37523752+ * with an optional attribute.37533753+ */37543754+ if (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) &&37553755+ (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) +37563756+ nla_attr_size(sizeof(u32)))) {37573757+ err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,37583758+ IFLA_MAX, ifla_policy, NULL);37593759+ if (err < 0) {37603760+ return -EINVAL;37613761+ } else if (err == 0) {37623762+ if (tb[IFLA_MASTER])37633763+ br_idx = nla_get_u32(tb[IFLA_MASTER]);37643764+ }3759376537603760- brport_idx = ifm->ifi_index;37663766+ brport_idx = ifm->ifi_index;37673767+ }3761376837623769 if (br_idx) {37633770 br_dev = __dev_get_by_index(net, br_idx);
+3-1
net/dccp/input.c
···606606 if (sk->sk_state == DCCP_LISTEN) {607607 if (dh->dccph_type == DCCP_PKT_REQUEST) {608608 /* It is possible that we process SYN packets from backlog,609609- * so we need to make sure to disable BH right there.609609+ * so we need to make sure to disable BH and RCU right there.610610 */611611+ rcu_read_lock();611612 local_bh_disable();612613 acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0;613614 local_bh_enable();615615+ rcu_read_unlock();614616 if (!acceptable)615617 return 1;616618 consume_skb(skb);
···60096009 if (th->fin)60106010 goto discard;60116011 /* It is possible that we process SYN packets from backlog,60126012- * so we need to make sure to disable BH right there.60126012+ * so we need to make sure to disable BH and RCU right there.60136013 */60146014+ rcu_read_lock();60146015 local_bh_disable();60156016 acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0;60166017 local_bh_enable();60186018+ rcu_read_unlock();6017601960186020 if (!acceptable)60196021 return 1;
···427427 case NL80211_IFTYPE_AP:428428 case NL80211_IFTYPE_AP_VLAN:429429 /* Keys without a station are used for TX only */430430- if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP))430430+ if (sta && test_sta_flag(sta, WLAN_STA_MFP))431431 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;432432 break;433433 case NL80211_IFTYPE_ADHOC:
+2-1
net/mac80211/iface.c
···1756175617571757 if (local->ops->wake_tx_queue &&17581758 type != NL80211_IFTYPE_AP_VLAN &&17591759- type != NL80211_IFTYPE_MONITOR)17591759+ (type != NL80211_IFTYPE_MONITOR ||17601760+ (params->flags & MONITOR_FLAG_ACTIVE)))17601761 txq_size += sizeof(struct txq_info) +17611762 local->hw.txq_data_size;17621763
···479479 if (!skb)480480 return;481481482482- if (dropped) {483483- dev_kfree_skb_any(skb);484484- return;485485- }486486-487482 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {488483 u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie;489484 struct ieee80211_sub_if_data *sdata;···501506 }502507 rcu_read_unlock();503508509509+ dev_kfree_skb_any(skb);510510+ } else if (dropped) {504511 dev_kfree_skb_any(skb);505512 } else {506513 /* consumes skb */···808811809812 rate_control_tx_status(local, sband, status);810813 if (ieee80211_vif_is_mesh(&sta->sdata->vif))811811- ieee80211s_update_metric(local, sta, skb);814814+ ieee80211s_update_metric(local, sta, status);812815813816 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)814817 ieee80211_frame_acked(sta, skb);···969972 }970973971974 rate_control_tx_status(local, sband, status);975975+ if (ieee80211_vif_is_mesh(&sta->sdata->vif))976976+ ieee80211s_update_metric(local, sta, status);972977 }973978974979 if (acked || noack_success) {
+4-4
net/mac80211/tdls.c
···1616#include "ieee80211_i.h"1717#include "driver-ops.h"1818#include "rate.h"1919+#include "wme.h"19202021/* give usermode some time for retries in setting up the TDLS session */2122#define TDLS_PEER_SETUP_TIMEOUT (15 * HZ)···10111010 switch (action_code) {10121011 case WLAN_TDLS_SETUP_REQUEST:10131012 case WLAN_TDLS_SETUP_RESPONSE:10141014- skb_set_queue_mapping(skb, IEEE80211_AC_BK);10151015- skb->priority = 2;10131013+ skb->priority = 256 + 2;10161014 break;10171015 default:10181018- skb_set_queue_mapping(skb, IEEE80211_AC_VI);10191019- skb->priority = 5;10161016+ skb->priority = 256 + 5;10201017 break;10211018 }10191019+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));1022102010231021 /*10241022 * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress.
+5-1
net/mac80211/tx.c
···214214{215215 struct ieee80211_local *local = tx->local;216216 struct ieee80211_if_managed *ifmgd;217217+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);217218218219 /* driver doesn't support power save */219220 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS))···241240242241 /* dynamic ps is supported only in managed mode */243242 if (tx->sdata->vif.type != NL80211_IFTYPE_STATION)243243+ return TX_CONTINUE;244244+245245+ if (unlikely(info->flags & IEEE80211_TX_INTFL_OFFCHAN_TX_OK))244246 return TX_CONTINUE;245247246248 ifmgd = &tx->sdata->u.mgd;···18941890 sdata->vif.hw_queue[skb_get_queue_mapping(skb)];1895189118961892 if (invoke_tx_handlers_early(&tx))18971897- return false;18931893+ return true;1898189418991895 if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))19001896 return true;
···6969 * If successful, a pointer to the connection is returned, but no ref is taken.7070 * NULL is returned if there is no match.7171 *7272+ * When searching for a service call, if we find a peer but no connection, we7373+ * return that through *_peer in case we need to create a new service call.7474+ *7275 * The caller must be holding the RCU read lock.7376 */7477struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local,7575- struct sk_buff *skb)7878+ struct sk_buff *skb,7979+ struct rxrpc_peer **_peer)7680{7781 struct rxrpc_connection *conn;7882 struct rxrpc_conn_proto k;···8985 if (rxrpc_extract_addr_from_skb(local, &srx, skb) < 0)9086 goto not_found;91879292- k.epoch = sp->hdr.epoch;9393- k.cid = sp->hdr.cid & RXRPC_CIDMASK;9494-9588 /* We may have to handle mixing IPv4 and IPv6 */9689 if (srx.transport.family != local->srx.transport.family) {9790 pr_warn_ratelimited("AF_RXRPC: Protocol mismatch %u not %u\n",···10099 k.epoch = sp->hdr.epoch;101100 k.cid = sp->hdr.cid & RXRPC_CIDMASK;102101103103- if (sp->hdr.flags & RXRPC_CLIENT_INITIATED) {102102+ if (rxrpc_to_server(sp)) {104103 /* We need to look up service connections by the full protocol105104 * parameter set. We look up the peer first as an intermediate106105 * step and then the connection from the peer's tree.···108107 peer = rxrpc_lookup_peer_rcu(local, &srx);109108 if (!peer)110109 goto not_found;110110+ *_peer = peer;111111 conn = rxrpc_find_service_conn_rcu(peer, skb);112112 if (!conn || atomic_read(&conn->usage) == 0)113113 goto not_found;···216214 call->peer->cong_cwnd = call->cong_cwnd;217215218216 spin_lock_bh(&conn->params.peer->lock);219219- hlist_del_init(&call->error_link);217217+ hlist_del_rcu(&call->error_link);220218 spin_unlock_bh(&conn->params.peer->lock);221219222220 if (rxrpc_is_client_call(call))
+64-26
net/rxrpc/input.c
···622622 if (!skb)623623 continue;624624625625+ sent_at = skb->tstamp;626626+ smp_rmb(); /* Read timestamp before serial. */625627 sp = rxrpc_skb(skb);626628 if (sp->hdr.serial != orig_serial)627629 continue;628628- smp_rmb();629629- sent_at = skb->tstamp;630630 goto found;631631 }632632+632633 return;633634634635found:···11251124{11261125 struct rxrpc_connection *conn;11271126 struct rxrpc_channel *chan;11281128- struct rxrpc_call *call;11271127+ struct rxrpc_call *call = NULL;11291128 struct rxrpc_skb_priv *sp;11301129 struct rxrpc_local *local = udp_sk->sk_user_data;11301130+ struct rxrpc_peer *peer = NULL;11311131+ struct rxrpc_sock *rx = NULL;11311132 struct sk_buff *skb;11321133 unsigned int channel;11331133- int ret, skew;11341134+ int ret, skew = 0;1134113511351136 _enter("%p", udp_sk);11361137···11451142 _debug("UDP socket error %d", ret);11461143 return;11471144 }11451145+11461146+ if (skb->tstamp == 0)11471147+ skb->tstamp = ktime_get_real();1148114811491149 rxrpc_new_skb(skb, rxrpc_skb_rx_received);11501150···1183117711841178 trace_rxrpc_rx_packet(sp);1185117911861186- _net("Rx RxRPC %s ep=%x call=%x:%x",11871187- sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient",11881188- sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber);11891189-11901190- if (sp->hdr.type >= RXRPC_N_PACKET_TYPES ||11911191- !((RXRPC_SUPPORTED_PACKET_TYPES >> sp->hdr.type) & 1)) {11921192- _proto("Rx Bad Packet Type %u", sp->hdr.type);11931193- goto bad_message;11941194- }11951195-11961180 switch (sp->hdr.type) {11971181 case RXRPC_PACKET_TYPE_VERSION:11981198- if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED))11821182+ if (rxrpc_to_client(sp))11991183 goto discard;12001184 rxrpc_post_packet_to_local(local, skb);12011185 goto out;1202118612031187 case RXRPC_PACKET_TYPE_BUSY:12041204- if (sp->hdr.flags & RXRPC_CLIENT_INITIATED)11881188+ if (rxrpc_to_server(sp))12051189 goto discard;12061190 /* Fall through */11911191+ case RXRPC_PACKET_TYPE_ACK:11921192+ case RXRPC_PACKET_TYPE_ACKALL:11931193+ if (sp->hdr.callNumber == 0)11941194+ goto bad_message;11951195+ /* Fall through */11961196+ case RXRPC_PACKET_TYPE_ABORT:11971197+ break;1207119812081199 case RXRPC_PACKET_TYPE_DATA:12091209- if (sp->hdr.callNumber == 0)12001200+ if (sp->hdr.callNumber == 0 ||12011201+ sp->hdr.seq == 0)12101202 goto bad_message;12111203 if (sp->hdr.flags & RXRPC_JUMBO_PACKET &&12121204 !rxrpc_validate_jumbo(skb))12131205 goto bad_message;12061206+ break;12071207+12081208+ case RXRPC_PACKET_TYPE_CHALLENGE:12091209+ if (rxrpc_to_server(sp))12101210+ goto discard;12111211+ break;12121212+ case RXRPC_PACKET_TYPE_RESPONSE:12131213+ if (rxrpc_to_client(sp))12141214+ goto discard;12141215 break;1215121612161217 /* Packet types 9-11 should just be ignored. */···12251212 case RXRPC_PACKET_TYPE_10:12261213 case RXRPC_PACKET_TYPE_11:12271214 goto discard;12151215+12161216+ default:12171217+ _proto("Rx Bad Packet Type %u", sp->hdr.type);12181218+ goto bad_message;12281219 }12201220+12211221+ if (sp->hdr.serviceId == 0)12221222+ goto bad_message;1229122312301224 rcu_read_lock();1231122512321232- conn = rxrpc_find_connection_rcu(local, skb);12261226+ if (rxrpc_to_server(sp)) {12271227+ /* Weed out packets to services we're not offering. Packets12281228+ * that would begin a call are explicitly rejected and the rest12291229+ * are just discarded.12301230+ */12311231+ rx = rcu_dereference(local->service);12321232+ if (!rx || (sp->hdr.serviceId != rx->srx.srx_service &&12331233+ sp->hdr.serviceId != rx->second_service)) {12341234+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA &&12351235+ sp->hdr.seq == 1)12361236+ goto unsupported_service;12371237+ goto discard_unlock;12381238+ }12391239+ }12401240+12411241+ conn = rxrpc_find_connection_rcu(local, skb, &peer);12331242 if (conn) {12341243 if (sp->hdr.securityIndex != conn->security_ix)12351244 goto wrong_security;···13151280 call = rcu_dereference(chan->call);1316128113171282 if (sp->hdr.callNumber > chan->call_id) {13181318- if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) {12831283+ if (rxrpc_to_client(sp)) {13191284 rcu_read_unlock();13201285 goto reject_packet;13211286 }···13321297 if (!test_bit(RXRPC_CALL_RX_HEARD, &call->flags))13331298 set_bit(RXRPC_CALL_RX_HEARD, &call->flags);13341299 }13351335- } else {13361336- skew = 0;13371337- call = NULL;13381300 }1339130113401302 if (!call || atomic_read(&call->usage) == 0) {13411341- if (!(sp->hdr.type & RXRPC_CLIENT_INITIATED) ||13421342- sp->hdr.callNumber == 0 ||13031303+ if (rxrpc_to_client(sp) ||13431304 sp->hdr.type != RXRPC_PACKET_TYPE_DATA)13441305 goto bad_message_unlock;13451306 if (sp->hdr.seq != 1)13461307 goto discard_unlock;13471347- call = rxrpc_new_incoming_call(local, conn, skb);13081308+ call = rxrpc_new_incoming_call(local, rx, peer, conn, skb);13481309 if (!call) {13491310 rcu_read_unlock();13501311 goto reject_packet;···13711340 skb->priority = RXKADINCONSISTENCY;13721341 goto post_abort;1373134213431343+unsupported_service:13441344+ rcu_read_unlock();13451345+ trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,13461346+ RX_INVALID_OPERATION, EOPNOTSUPP);13471347+ skb->priority = RX_INVALID_OPERATION;13481348+ goto post_abort;13491349+13741350reupgrade:13751351 rcu_read_unlock();13761352 trace_rxrpc_abort(0, "UPG", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,···13921354protocol_error:13931355 skb->priority = RX_PROTOCOL_ERROR;13941356post_abort:13951395- skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT;13571357+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;13961358reject_packet:13971359 trace_rxrpc_rx_done(skb->mark, skb->priority);13981360 rxrpc_reject_packet(local, skb);
+26-14
net/rxrpc/local_object.c
···135135 }136136137137 switch (local->srx.transport.family) {138138+ case AF_INET6:139139+ /* we want to receive ICMPv6 errors */140140+ opt = 1;141141+ ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,142142+ (char *) &opt, sizeof(opt));143143+ if (ret < 0) {144144+ _debug("setsockopt failed");145145+ goto error;146146+ }147147+148148+ /* we want to set the don't fragment bit */149149+ opt = IPV6_PMTUDISC_DO;150150+ ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,151151+ (char *) &opt, sizeof(opt));152152+ if (ret < 0) {153153+ _debug("setsockopt failed");154154+ goto error;155155+ }156156+157157+ /* Fall through and set IPv4 options too otherwise we don't get158158+ * errors from IPv4 packets sent through the IPv6 socket.159159+ */160160+138161 case AF_INET:139162 /* we want to receive ICMP errors */140163 opt = 1;···176153 _debug("setsockopt failed");177154 goto error;178155 }179179- break;180156181181- case AF_INET6:182182- /* we want to receive ICMP errors */157157+ /* We want receive timestamps. */183158 opt = 1;184184- ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,185185- (char *) &opt, sizeof(opt));186186- if (ret < 0) {187187- _debug("setsockopt failed");188188- goto error;189189- }190190-191191- /* we want to set the don't fragment bit */192192- opt = IPV6_PMTUDISC_DO;193193- ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,194194- (char *) &opt, sizeof(opt));159159+ ret = kernel_setsockopt(local->socket, SOL_SOCKET, SO_TIMESTAMPNS,160160+ (char *)&opt, sizeof(opt));195161 if (ret < 0) {196162 _debug("setsockopt failed");197163 goto error;
+36-18
net/rxrpc/output.c
···124124 struct kvec iov[2];125125 rxrpc_serial_t serial;126126 rxrpc_seq_t hard_ack, top;127127- ktime_t now;128127 size_t len, n;129128 int ret;130129 u8 reason;···195196 /* We need to stick a time in before we send the packet in case196197 * the reply gets back before kernel_sendmsg() completes - but197198 * asking UDP to send the packet can take a relatively long198198- * time, so we update the time after, on the assumption that199199- * the packet transmission is more likely to happen towards the200200- * end of the kernel_sendmsg() call.199199+ * time.201200 */202201 call->ping_time = ktime_get_real();203202 set_bit(RXRPC_CALL_PINGING, &call->flags);···203206 }204207205208 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);206206- now = ktime_get_real();207207- if (ping)208208- call->ping_time = now;209209 conn->params.peer->last_tx_at = ktime_get_seconds();210210 if (ret < 0)211211 trace_rxrpc_tx_fail(call->debug_id, serial, ret,···357363358364 /* If our RTT cache needs working on, request an ACK. Also request359365 * ACKs if a DATA packet appears to have been lost.366366+ *367367+ * However, we mustn't request an ACK on the last reply packet of a368368+ * service call, lest OpenAFS incorrectly send us an ACK with some369369+ * soft-ACKs in it and then never follow up with a proper hard ACK.360370 */361361- if (!(sp->hdr.flags & RXRPC_LAST_PACKET) &&371371+ if ((!(sp->hdr.flags & RXRPC_LAST_PACKET) ||372372+ rxrpc_to_server(sp)373373+ ) &&362374 (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events) ||363375 retrans ||364376 call->cong_mode == RXRPC_CALL_SLOW_START ||···390390 goto send_fragmentable;391391392392 down_read(&conn->params.local->defrag_sem);393393+394394+ sp->hdr.serial = serial;395395+ smp_wmb(); /* Set serial before timestamp */396396+ skb->tstamp = ktime_get_real();397397+393398 /* send the packet by UDP394399 * - returns -EMSGSIZE if UDP would have to fragment the packet395400 * to go out of the interface···418413 trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags,419414 retrans, lost);420415 if (ret >= 0) {421421- ktime_t now = ktime_get_real();422422- skb->tstamp = now;423423- smp_wmb();424424- sp->hdr.serial = serial;425416 if (whdr.flags & RXRPC_REQUEST_ACK) {426426- call->peer->rtt_last_req = now;417417+ call->peer->rtt_last_req = skb->tstamp;427418 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);428419 if (call->peer->rtt_usage > 1) {429420 unsigned long nowj = jiffies, ack_lost_at;···457456 _debug("send fragment");458457459458 down_write(&conn->params.local->defrag_sem);459459+460460+ sp->hdr.serial = serial;461461+ smp_wmb(); /* Set serial before timestamp */462462+ skb->tstamp = ktime_get_real();460463461464 switch (conn->params.local->srx.transport.family) {462465 case AF_INET:···524519 struct kvec iov[2];525520 size_t size;526521 __be32 code;527527- int ret;522522+ int ret, ioc;528523529524 _enter("%d", local->debug_id);530525···532527 iov[0].iov_len = sizeof(whdr);533528 iov[1].iov_base = &code;534529 iov[1].iov_len = sizeof(code);535535- size = sizeof(whdr) + sizeof(code);536530537531 msg.msg_name = &srx.transport;538532 msg.msg_control = NULL;···539535 msg.msg_flags = 0;540536541537 memset(&whdr, 0, sizeof(whdr));542542- whdr.type = RXRPC_PACKET_TYPE_ABORT;543538544539 while ((skb = skb_dequeue(&local->reject_queue))) {545540 rxrpc_see_skb(skb, rxrpc_skb_rx_seen);546541 sp = rxrpc_skb(skb);547542543543+ switch (skb->mark) {544544+ case RXRPC_SKB_MARK_REJECT_BUSY:545545+ whdr.type = RXRPC_PACKET_TYPE_BUSY;546546+ size = sizeof(whdr);547547+ ioc = 1;548548+ break;549549+ case RXRPC_SKB_MARK_REJECT_ABORT:550550+ whdr.type = RXRPC_PACKET_TYPE_ABORT;551551+ code = htonl(skb->priority);552552+ size = sizeof(whdr) + sizeof(code);553553+ ioc = 2;554554+ break;555555+ default:556556+ rxrpc_free_skb(skb, rxrpc_skb_rx_freed);557557+ continue;558558+ }559559+548560 if (rxrpc_extract_addr_from_skb(local, &srx, skb) == 0) {549561 msg.msg_namelen = srx.transport_len;550550-551551- code = htonl(skb->priority);552562553563 whdr.epoch = htonl(sp->hdr.epoch);554564 whdr.cid = htonl(sp->hdr.cid);
+11-35
net/rxrpc/peer_event.c
···2323#include "ar-internal.h"24242525static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *);2626+static void rxrpc_distribute_error(struct rxrpc_peer *, int,2727+ enum rxrpc_call_completion);26282729/*2830 * Find the peer associated with an ICMP packet.···196194 rcu_read_unlock();197195 rxrpc_free_skb(skb, rxrpc_skb_rx_freed);198196199199- /* The ref we obtained is passed off to the work item */200200- __rxrpc_queue_peer_error(peer);201197 _leave("");202198}203199···205205static void rxrpc_store_error(struct rxrpc_peer *peer,206206 struct sock_exterr_skb *serr)207207{208208+ enum rxrpc_call_completion compl = RXRPC_CALL_NETWORK_ERROR;208209 struct sock_extended_err *ee;209210 int err;210211···256255 case SO_EE_ORIGIN_NONE:257256 case SO_EE_ORIGIN_LOCAL:258257 _proto("Rx Received local error { error=%d }", err);259259- err += RXRPC_LOCAL_ERROR_OFFSET;258258+ compl = RXRPC_CALL_LOCAL_ERROR;260259 break;261260262261 case SO_EE_ORIGIN_ICMP6:···265264 break;266265 }267266268268- peer->error_report = err;267267+ rxrpc_distribute_error(peer, err, compl);269268}270269271270/*272272- * Distribute an error that occurred on a peer271271+ * Distribute an error that occurred on a peer.273272 */274274-void rxrpc_peer_error_distributor(struct work_struct *work)273273+static void rxrpc_distribute_error(struct rxrpc_peer *peer, int error,274274+ enum rxrpc_call_completion compl)275275{276276- struct rxrpc_peer *peer =277277- container_of(work, struct rxrpc_peer, error_distributor);278276 struct rxrpc_call *call;279279- enum rxrpc_call_completion compl;280280- int error;281277282282- _enter("");283283-284284- error = READ_ONCE(peer->error_report);285285- if (error < RXRPC_LOCAL_ERROR_OFFSET) {286286- compl = RXRPC_CALL_NETWORK_ERROR;287287- } else {288288- compl = RXRPC_CALL_LOCAL_ERROR;289289- error -= RXRPC_LOCAL_ERROR_OFFSET;290290- }291291-292292- _debug("ISSUE ERROR %s %d", rxrpc_call_completions[compl], error);293293-294294- spin_lock_bh(&peer->lock);295295-296296- while (!hlist_empty(&peer->error_targets)) {297297- call = hlist_entry(peer->error_targets.first,298298- struct rxrpc_call, error_link);299299- hlist_del_init(&call->error_link);278278+ hlist_for_each_entry_rcu(call, &peer->error_targets, error_link) {300279 rxrpc_see_call(call);301301-302302- if (rxrpc_set_call_completion(call, compl, 0, -error))280280+ if (call->state < RXRPC_CALL_COMPLETE &&281281+ rxrpc_set_call_completion(call, compl, 0, -error))303282 rxrpc_notify_socket(call);304283 }305305-306306- spin_unlock_bh(&peer->lock);307307-308308- rxrpc_put_peer(peer);309309- _leave("");310284}311285312286/*
+11-41
net/rxrpc/peer_object.c
···124124 struct rxrpc_net *rxnet = local->rxnet;125125126126 hash_for_each_possible_rcu(rxnet->peer_hash, peer, hash_link, hash_key) {127127- if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0) {128128- if (atomic_read(&peer->usage) == 0)129129- return NULL;127127+ if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0 &&128128+ atomic_read(&peer->usage) > 0)130129 return peer;131131- }132130 }133131134132 return NULL;···220222 atomic_set(&peer->usage, 1);221223 peer->local = local;222224 INIT_HLIST_HEAD(&peer->error_targets);223223- INIT_WORK(&peer->error_distributor,224224- &rxrpc_peer_error_distributor);225225 peer->service_conns = RB_ROOT;226226 seqlock_init(&peer->service_conn_lock);227227 spin_lock_init(&peer->lock);···295299}296300297301/*298298- * Set up a new incoming peer. The address is prestored in the preallocated299299- * peer.302302+ * Set up a new incoming peer. There shouldn't be any other matching peers303303+ * since we've already done a search in the list from the non-reentrant context304304+ * (the data_ready handler) that is the only place we can add new peers.300305 */301301-struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *local,302302- struct rxrpc_peer *prealloc)306306+void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer)303307{304304- struct rxrpc_peer *peer;305308 struct rxrpc_net *rxnet = local->rxnet;306309 unsigned long hash_key;307310308308- hash_key = rxrpc_peer_hash_key(local, &prealloc->srx);309309- prealloc->local = local;310310- rxrpc_init_peer(prealloc, hash_key);311311+ hash_key = rxrpc_peer_hash_key(local, &peer->srx);312312+ peer->local = local;313313+ rxrpc_init_peer(peer, hash_key);311314312315 spin_lock(&rxnet->peer_hash_lock);313313-314314- /* Need to check that we aren't racing with someone else */315315- peer = __rxrpc_lookup_peer_rcu(local, &prealloc->srx, hash_key);316316- if (peer && !rxrpc_get_peer_maybe(peer))317317- peer = NULL;318318- if (!peer) {319319- peer = prealloc;320320- hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key);321321- list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new);322322- }323323-316316+ hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key);317317+ list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new);324318 spin_unlock(&rxnet->peer_hash_lock);325325- return peer;326319}327320328321/*···398413 peer = NULL;399414 }400415 return peer;401401-}402402-403403-/*404404- * Queue a peer record. This passes the caller's ref to the workqueue.405405- */406406-void __rxrpc_queue_peer_error(struct rxrpc_peer *peer)407407-{408408- const void *here = __builtin_return_address(0);409409- int n;410410-411411- n = atomic_read(&peer->usage);412412- if (rxrpc_queue_work(&peer->error_distributor))413413- trace_rxrpc_peer(peer, rxrpc_peer_queued_error, n, here);414414- else415415- rxrpc_put_peer(peer);416416}417417418418/*
···10481048 if (!ctx->packet || !ctx->packet->has_cookie_echo)10491049 return;1050105010511051- /* fallthru */10511051+ /* fall through */10521052 case SCTP_STATE_ESTABLISHED:10531053 case SCTP_STATE_SHUTDOWN_PENDING:10541054 case SCTP_STATE_SHUTDOWN_RECEIVED:
+7-5
net/tipc/bearer.c
···609609610610 switch (evt) {611611 case NETDEV_CHANGE:612612- if (netif_carrier_ok(dev))612612+ if (netif_carrier_ok(dev) && netif_oper_up(dev)) {613613+ test_and_set_bit_lock(0, &b->up);613614 break;614614- /* else: fall through */615615- case NETDEV_UP:616616- test_and_set_bit_lock(0, &b->up);617617- break;615615+ }616616+ /* fall through */618617 case NETDEV_GOING_DOWN:619618 clear_bit_unlock(0, &b->up);620619 tipc_reset_bearer(net, b);620620+ break;621621+ case NETDEV_UP:622622+ test_and_set_bit_lock(0, &b->up);621623 break;622624 case NETDEV_CHANGEMTU:623625 if (tipc_mtu_bad(dev, 0)) {
+44-1
net/tipc/link.c
···410410 return l->name;411411}412412413413+u32 tipc_link_state(struct tipc_link *l)414414+{415415+ return l->state;416416+}417417+413418/**414419 * tipc_link_create - create a new link415420 * @n: pointer to associated node···846841 l->in_session = false;847842 l->session++;848843 l->mtu = l->advertised_mtu;844844+ spin_lock_bh(&l->wakeupq.lock);845845+ spin_lock_bh(&l->inputq->lock);846846+ skb_queue_splice_init(&l->wakeupq, l->inputq);847847+ spin_unlock_bh(&l->inputq->lock);848848+ spin_unlock_bh(&l->wakeupq.lock);849849+849850 __skb_queue_purge(&l->transmq);850851 __skb_queue_purge(&l->deferdq);851851- skb_queue_splice_init(&l->wakeupq, l->inputq);852852 __skb_queue_purge(&l->backlogq);853853 l->backlog[TIPC_LOW_IMPORTANCE].len = 0;854854 l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;···13901380 __skb_queue_tail(xmitq, skb);13911381}1392138213831383+void tipc_link_create_dummy_tnl_msg(struct tipc_link *l,13841384+ struct sk_buff_head *xmitq)13851385+{13861386+ u32 onode = tipc_own_addr(l->net);13871387+ struct tipc_msg *hdr, *ihdr;13881388+ struct sk_buff_head tnlq;13891389+ struct sk_buff *skb;13901390+ u32 dnode = l->addr;13911391+13921392+ skb_queue_head_init(&tnlq);13931393+ skb = tipc_msg_create(TUNNEL_PROTOCOL, FAILOVER_MSG,13941394+ INT_H_SIZE, BASIC_H_SIZE,13951395+ dnode, onode, 0, 0, 0);13961396+ if (!skb) {13971397+ pr_warn("%sunable to create tunnel packet\n", link_co_err);13981398+ return;13991399+ }14001400+14011401+ hdr = buf_msg(skb);14021402+ msg_set_msgcnt(hdr, 1);14031403+ msg_set_bearer_id(hdr, l->peer_bearer_id);14041404+14051405+ ihdr = (struct tipc_msg *)msg_data(hdr);14061406+ tipc_msg_init(onode, ihdr, TIPC_LOW_IMPORTANCE, TIPC_DIRECT_MSG,14071407+ BASIC_H_SIZE, dnode);14081408+ msg_set_errcode(ihdr, TIPC_ERR_NO_PORT);14091409+ __skb_queue_tail(&tnlq, skb);14101410+ tipc_link_xmit(l, &tnlq, xmitq);14111411+}14121412+13931413/* tipc_link_tnl_prepare(): prepare and return a list of tunnel packets13941414 * with contents of the link's transmit and backlog queues.13951415 */···15151475 if (!l->in_session)15161476 return false;15171477 if (session != curr_session)14781478+ return false;14791479+ /* Extra sanity check */14801480+ if (!link_is_up(l) && msg_ack(hdr))15181481 return false;15191482 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO))15201483 return true;
···10581058 return NULL;10591059}1060106010611061+/*10621062+ * Update RX channel information based on the available frame payload10631063+ * information. This is mainly for the 2.4 GHz band where frames can be received10641064+ * from neighboring channels and the Beacon frames use the DSSS Parameter Set10651065+ * element to indicate the current (transmitting) channel, but this might also10661066+ * be needed on other bands if RX frequency does not match with the actual10671067+ * operating channel of a BSS.10681068+ */10611069static struct ieee80211_channel *10621070cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,10631063- struct ieee80211_channel *channel)10711071+ struct ieee80211_channel *channel,10721072+ enum nl80211_bss_scan_width scan_width)10641073{10651074 const u8 *tmp;10661075 u32 freq;10671076 int channel_number = -1;10771077+ struct ieee80211_channel *alt_channel;1068107810691079 tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);10701080 if (tmp && tmp[1] == 1) {···10881078 }10891079 }1090108010911091- if (channel_number < 0)10811081+ if (channel_number < 0) {10821082+ /* No channel information in frame payload */10921083 return channel;10841084+ }1093108510941086 freq = ieee80211_channel_to_frequency(channel_number, channel->band);10951095- channel = ieee80211_get_channel(wiphy, freq);10961096- if (!channel)10871087+ alt_channel = ieee80211_get_channel(wiphy, freq);10881088+ if (!alt_channel) {10891089+ if (channel->band == NL80211_BAND_2GHZ) {10901090+ /*10911091+ * Better not allow unexpected channels when that could10921092+ * be going beyond the 1-11 range (e.g., discovering10931093+ * BSS on channel 12 when radio is configured for10941094+ * channel 11.10951095+ */10961096+ return NULL;10971097+ }10981098+10991099+ /* No match for the payload channel number - ignore it */11001100+ return channel;11011101+ }11021102+11031103+ if (scan_width == NL80211_BSS_CHAN_WIDTH_10 ||11041104+ scan_width == NL80211_BSS_CHAN_WIDTH_5) {11051105+ /*11061106+ * Ignore channel number in 5 and 10 MHz channels where there11071107+ * may not be an n:1 or 1:n mapping between frequencies and11081108+ * channel numbers.11091109+ */11101110+ return channel;11111111+ }11121112+11131113+ /*11141114+ * Use the channel determined through the payload channel number11151115+ * instead of the RX channel reported by the driver.11161116+ */11171117+ if (alt_channel->flags & IEEE80211_CHAN_DISABLED)10971118 return NULL;10981098- if (channel->flags & IEEE80211_CHAN_DISABLED)10991099- return NULL;11001100- return channel;11191119+ return alt_channel;11011120}1102112111031122/* Returned bss is reference counted and must be cleaned up appropriately. */···11511112 (data->signal < 0 || data->signal > 100)))11521113 return NULL;1153111411541154- channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan);11151115+ channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan,11161116+ data->scan_width);11551117 if (!channel)11561118 return NULL;11571119···12501210 return NULL;1251121112521212 channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable,12531253- ielen, data->chan);12131213+ ielen, data->chan, data->scan_width);12541214 if (!channel)12551215 return NULL;12561216
+10-4
net/wireless/wext-compat.c
···12781278 if (err)12791279 return err;1280128012811281- if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)))12821282- return -EOPNOTSUPP;12811281+ if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {12821282+ err = -EOPNOTSUPP;12831283+ goto free;12841284+ }1283128512841286 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);1285128712861286- return 0;12881288+free:12891289+ cfg80211_sinfo_release_content(&sinfo);12901290+ return err;12871291}1288129212891293/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */···12971293 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);12981294 /* we are under RTNL - globally locked - so can use static structs */12991295 static struct iw_statistics wstats;13001300- static struct station_info sinfo;12961296+ static struct station_info sinfo = {};13011297 u8 bssid[ETH_ALEN];1302129813031299 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)···13551351 wstats.discard.misc = sinfo.rx_dropped_misc;13561352 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))13571353 wstats.discard.retries = sinfo.tx_failed;13541354+13551355+ cfg80211_sinfo_release_content(&sinfo);1358135613591357 return &wstats;13601358}