···171171Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com>172172Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com>173173Takashi YOSHII <takashi.yoshii.zj@renesas.com>174174+Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com>174175Yusuke Goda <goda.yusuke@renesas.com>175176Gustavo Padovan <gustavo@las.ic.unicamp.br>176177Gustavo Padovan <padovan@profusion.mobi>
+6
Documentation/admin-guide/kernel-parameters.txt
···17251725 kernel and module base offset ASLR (Address Space17261726 Layout Randomization).1727172717281728+ kasan_multi_shot17291729+ [KNL] Enforce KASAN (Kernel Address Sanitizer) to print17301730+ report on every invalid memory access. Without this17311731+ parameter KASAN will print report only for the first17321732+ invalid access.17331733+17281734 keepinitrd [HW,ARM]1729173517301736 kernelcore= [KNL,X86,IA-64,PPC]
···1212- reg : Offset and length of the register set for the module1313- interrupts : the interrupt number for the RNG module.1414 Used for "ti,omap4-rng" and "inside-secure,safexcel-eip76"1515-- clocks: the trng clock source1515+- clocks: the trng clock source. Only mandatory for the1616+ "inside-secure,safexcel-eip76" compatible.16171718Example:1819/* AM335x */
···600600[recommended]601601 ->readlink is optional for symlinks. Don't set, unless filesystem needs602602 to fake something for readlink(2).603603+--604604+[mandatory]605605+ ->getattr() is now passed a struct path rather than a vfsmount and606606+ dentry separately, and it now has request_mask and query_flags arguments607607+ to specify the fields and sync type requested by statx. Filesystems not608608+ supporting any statx-specific features may ignore the new arguments.
···77777878int __init foo_probe(void)7979{8080+ int error;8181+8082 struct pinctrl_dev *pctl;81838282- return pinctrl_register_and_init(&foo_desc, <PARENT>, NULL, &pctl);8484+ error = pinctrl_register_and_init(&foo_desc, <PARENT>, NULL, &pctl);8585+ if (error)8686+ return error;8787+8888+ return pinctrl_enable(pctl);8389}84908591To enable the pinctrl subsystem and the subgroups for PINMUX and PINCONF and
+1-1
Documentation/process/stable-kernel-rules.rst
···124124125125.. code-block:: none126126127127- Cc: <stable@vger.kernel.org> # 3.3.x-127127+ Cc: <stable@vger.kernel.org> # 3.3.x128128129129The tag has the meaning of:130130
+6
Documentation/virtual/kvm/devices/arm-vgic.txt
···83838484 Bits for undefined preemption levels are RAZ/WI.85858686+ For historical reasons and to provide ABI compatibility with userspace we8787+ export the GICC_PMR register in the format of the GICH_VMCR.VMPriMask8888+ field in the lower 5 bits of a word, meaning that userspace must always8989+ use the lower 5 bits to communicate with the KVM device and must shift the9090+ value left by 3 places to obtain the actual priority mask level.9191+8692 Limitations:8793 - Priorities are not implemented, and registers are RAZ/WI8894 - Currently only implemented for KVM_DEV_TYPE_ARM_VGIC_V2.
···100100;################### Non TLB Exception Handling #############################101101102102ENTRY(EV_SWI)103103- flag 1103103+ ; TODO: implement this104104+ EXCEPTION_PROLOGUE105105+ b ret_from_exception104106END(EV_SWI)105107106108ENTRY(EV_DivZero)107107- flag 1109109+ ; TODO: implement this110110+ EXCEPTION_PROLOGUE111111+ b ret_from_exception108112END(EV_DivZero)109113110114ENTRY(EV_DCError)111111- flag 1115115+ ; TODO: implement this116116+ EXCEPTION_PROLOGUE117117+ b ret_from_exception112118END(EV_DCError)113119114120; ---------------------------------------------
···633633634634 write_aux_reg(ARC_REG_SLC_INVALIDATE, 1);635635636636+ /* Make sure "busy" bit reports correct stataus, see STAR 9001165532 */637637+ read_aux_reg(r);638638+636639 /* Important to wait for flush to complete */637640 while (read_aux_reg(r) & SLC_CTRL_BUSY);638641}
···292292 phys_addr_t addr = start, end = start + size;293293 phys_addr_t next;294294295295+ assert_spin_locked(&kvm->mmu_lock);295296 pgd = kvm->arch.pgd + stage2_pgd_index(addr);296297 do {297298 next = stage2_pgd_addr_end(addr, end);298299 if (!stage2_pgd_none(*pgd))299300 unmap_stage2_puds(kvm, pgd, addr, next);301301+ /*302302+ * If the range is too large, release the kvm->mmu_lock303303+ * to prevent starvation and lockup detector warnings.304304+ */305305+ if (next != end)306306+ cond_resched_lock(&kvm->mmu_lock);300307 } while (pgd++, addr = next, addr != end);301308}302309···810803 int idx;811804812805 idx = srcu_read_lock(&kvm->srcu);806806+ down_read(¤t->mm->mmap_sem);813807 spin_lock(&kvm->mmu_lock);814808815809 slots = kvm_memslots(kvm);···818810 stage2_unmap_memslot(kvm, memslot);819811820812 spin_unlock(&kvm->mmu_lock);813813+ up_read(¤t->mm->mmap_sem);821814 srcu_read_unlock(&kvm->srcu, idx);822815}823816···838829 if (kvm->arch.pgd == NULL)839830 return;840831832832+ spin_lock(&kvm->mmu_lock);841833 unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);834834+ spin_unlock(&kvm->mmu_lock);835835+842836 /* Free the HW pgd, one page at a time */843837 free_pages_exact(kvm->arch.pgd, S2_PGD_SIZE);844838 kvm->arch.pgd = NULL;···18131801 (KVM_PHYS_SIZE >> PAGE_SHIFT))18141802 return -EFAULT;1815180318041804+ down_read(¤t->mm->mmap_sem);18161805 /*18171806 * A memory region could potentially cover multiple VMAs, and any holes18181807 * between them, so iterate over all of them to find out if we can map···18571844 pa += vm_start - vma->vm_start;1858184518591846 /* IO region dirty page logging not allowed */18601860- if (memslot->flags & KVM_MEM_LOG_DIRTY_PAGES)18611861- return -EINVAL;18471847+ if (memslot->flags & KVM_MEM_LOG_DIRTY_PAGES) {18481848+ ret = -EINVAL;18491849+ goto out;18501850+ }1862185118631852 ret = kvm_phys_addr_ioremap(kvm, gpa, pa,18641853 vm_end - vm_start,···18721857 } while (hva < reg_end);1873185818741859 if (change == KVM_MR_FLAGS_ONLY)18751875- return ret;18601860+ goto out;1876186118771862 spin_lock(&kvm->mmu_lock);18781863 if (ret)···18801865 else18811866 stage2_flush_memslot(kvm, memslot);18821867 spin_unlock(&kvm->mmu_lock);18681868+out:18691869+ up_read(¤t->mm->mmap_sem);18831870 return ret;18841871}18851872
+19-1
arch/arm/mm/dma-mapping.c
···935935 __arm_dma_free(dev, size, cpu_addr, handle, attrs, true);936936}937937938938+/*939939+ * The whole dma_get_sgtable() idea is fundamentally unsafe - it seems940940+ * that the intention is to allow exporting memory allocated via the941941+ * coherent DMA APIs through the dma_buf API, which only accepts a942942+ * scattertable. This presents a couple of problems:943943+ * 1. Not all memory allocated via the coherent DMA APIs is backed by944944+ * a struct page945945+ * 2. Passing coherent DMA memory into the streaming APIs is not allowed946946+ * as we will try to flush the memory through a different alias to that947947+ * actually being used (and the flushes are redundant.)948948+ */938949int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt,939950 void *cpu_addr, dma_addr_t handle, size_t size,940951 unsigned long attrs)941952{942942- struct page *page = pfn_to_page(dma_to_pfn(dev, handle));953953+ unsigned long pfn = dma_to_pfn(dev, handle);954954+ struct page *page;943955 int ret;956956+957957+ /* If the PFN is not valid, we do not have a struct page */958958+ if (!pfn_valid(pfn))959959+ return -ENXIO;960960+961961+ page = pfn_to_page(pfn);944962945963 ret = sg_alloc_table(sgt, 1, GFP_KERNEL);946964 if (unlikely(ret))
···266266#endif267267268268 if (p) {269269- if (cur) {269269+ if (!p->ainsn.insn_check_cc(regs->ARM_cpsr)) {270270+ /*271271+ * Probe hit but conditional execution check failed,272272+ * so just skip the instruction and continue as if273273+ * nothing had happened.274274+ * In this case, we can skip recursing check too.275275+ */276276+ singlestep_skip(p, regs);277277+ } else if (cur) {270278 /* Kprobe is pending, so we're recursing. */271279 switch (kcb->kprobe_status) {272280 case KPROBE_HIT_ACTIVE:273281 case KPROBE_HIT_SSDONE:282282+ case KPROBE_HIT_SS:274283 /* A pre- or post-handler probe got us here. */275284 kprobes_inc_nmissed_count(p);276285 save_previous_kprobe(kcb);···288279 singlestep(p, regs, kcb);289280 restore_previous_kprobe(kcb);290281 break;282282+ case KPROBE_REENTER:283283+ /* A nested probe was hit in FIQ, it is a BUG */284284+ pr_warn("Unrecoverable kprobe detected at %p.\n",285285+ p->addr);286286+ /* fall through */291287 default:292288 /* impossible cases */293289 BUG();294290 }295295- } else if (p->ainsn.insn_check_cc(regs->ARM_cpsr)) {291291+ } else {296292 /* Probe hit and conditional execution check ok. */297293 set_current_kprobe(p);298294 kcb->kprobe_status = KPROBE_HIT_ACTIVE;···318304 }319305 reset_current_kprobe();320306 }321321- } else {322322- /*323323- * Probe hit but conditional execution check failed,324324- * so just skip the instruction and continue as if325325- * nothing had happened.326326- */327327- singlestep_skip(p, regs);328307 }329308 } else if (cur) {330309 /* We probably hit a jprobe. Call its break handler. */···441434 struct hlist_node *tmp;442435 unsigned long flags, orig_ret_address = 0;443436 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;437437+ kprobe_opcode_t *correct_ret_addr = NULL;444438445439 INIT_HLIST_HEAD(&empty_rp);446440 kretprobe_hash_lock(current, &head, &flags);···464456 /* another task is sharing our hash bucket */465457 continue;466458467467- if (ri->rp && ri->rp->handler) {468468- __this_cpu_write(current_kprobe, &ri->rp->kp);469469- get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;470470- ri->rp->handler(ri, regs);471471- __this_cpu_write(current_kprobe, NULL);472472- }473473-474459 orig_ret_address = (unsigned long)ri->ret_addr;475475- recycle_rp_inst(ri, &empty_rp);476460477461 if (orig_ret_address != trampoline_address)478462 /*···476476 }477477478478 kretprobe_assert(ri, orig_ret_address, trampoline_address);479479+480480+ correct_ret_addr = ri->ret_addr;481481+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {482482+ if (ri->task != current)483483+ /* another task is sharing our hash bucket */484484+ continue;485485+486486+ orig_ret_address = (unsigned long)ri->ret_addr;487487+ if (ri->rp && ri->rp->handler) {488488+ __this_cpu_write(current_kprobe, &ri->rp->kp);489489+ get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;490490+ ri->ret_addr = correct_ret_addr;491491+ ri->rp->handler(ri, regs);492492+ __this_cpu_write(current_kprobe, NULL);493493+ }494494+495495+ recycle_rp_inst(ri, &empty_rp);496496+497497+ if (orig_ret_address != trampoline_address)498498+ /*499499+ * This is the real return address. Any other500500+ * instances associated with this task are for501501+ * other calls deeper on the call stack502502+ */503503+ break;504504+ }505505+479506 kretprobe_hash_unlock(current, &flags);480507481508 hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
···7070 0, sizeof(*regs));7171}72727373-static int gpr_set(struct task_struct *target,7474- const struct user_regset *regset,7575- unsigned int pos, unsigned int count,7676- const void *kbuf, const void __user *ubuf)7777-{7878- int ret;7979- struct pt_regs *regs = task_pt_regs(target);8080-8181- /* Don't copyin TSR or CSR */8282- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,8383- ®s,8484- 0, PT_TSR * sizeof(long));8585- if (ret)8686- return ret;8787-8888- ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,8989- PT_TSR * sizeof(long),9090- (PT_TSR + 1) * sizeof(long));9191- if (ret)9292- return ret;9393-9494- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,9595- ®s,9696- (PT_TSR + 1) * sizeof(long),9797- PT_CSR * sizeof(long));9898- if (ret)9999- return ret;100100-101101- ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,102102- PT_CSR * sizeof(long),103103- (PT_CSR + 1) * sizeof(long));104104- if (ret)105105- return ret;106106-107107- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,108108- ®s,109109- (PT_CSR + 1) * sizeof(long), -1);110110- return ret;111111-}112112-11373enum c6x_regset {11474 REGSET_GPR,11575};···81121 .size = sizeof(u32),82122 .align = sizeof(u32),83123 .get = gpr_get,8484- .set = gpr_set85124 },86125};87126
+5-3
arch/h8300/kernel/ptrace.c
···9595 long *reg = (long *)®s;96969797 /* build user regs in buffer */9898- for (r = 0; r < ARRAY_SIZE(register_offset); r++)9898+ BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0);9999+ for (r = 0; r < sizeof(regs) / sizeof(long); r++)99100 *reg++ = h8300_get_reg(target, r);100101101102 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,···114113 long *reg;115114116115 /* build user regs in buffer */117117- for (reg = (long *)®s, r = 0; r < ARRAY_SIZE(register_offset); r++)116116+ BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0);117117+ for (reg = (long *)®s, r = 0; r < sizeof(regs) / sizeof(long); r++)118118 *reg++ = h8300_get_reg(target, r);119119120120 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,···124122 return ret;125123126124 /* write back to pt_regs */127127- for (reg = (long *)®s, r = 0; r < ARRAY_SIZE(register_offset); r++)125125+ for (reg = (long *)®s, r = 0; r < sizeof(regs) / sizeof(long); r++)128126 h8300_put_reg(target, r, *reg++);129127 return 0;130128}
+8-7
arch/metag/include/asm/uaccess.h
···197197198198#define strlen_user(str) strnlen_user(str, 32767)199199200200-extern unsigned long __must_check __copy_user_zeroing(void *to,201201- const void __user *from,202202- unsigned long n);200200+extern unsigned long raw_copy_from_user(void *to, const void __user *from,201201+ unsigned long n);203202204203static inline unsigned long205204copy_from_user(void *to, const void __user *from, unsigned long n)206205{206206+ unsigned long res = n;207207 if (likely(access_ok(VERIFY_READ, from, n)))208208- return __copy_user_zeroing(to, from, n);209209- memset(to, 0, n);210210- return n;208208+ res = raw_copy_from_user(to, from, n);209209+ if (unlikely(res))210210+ memset(to + (n - res), 0, res);211211+ return res;211212}212213213213-#define __copy_from_user(to, from, n) __copy_user_zeroing(to, from, n)214214+#define __copy_from_user(to, from, n) raw_copy_from_user(to, from, n)214215#define __copy_from_user_inatomic __copy_from_user215216216217extern unsigned long __must_check __copy_user(void __user *to,
+15-4
arch/metag/kernel/ptrace.c
···2626 * user_regset definitions.2727 */28282929+static unsigned long user_txstatus(const struct pt_regs *regs)3030+{3131+ unsigned long data = (unsigned long)regs->ctx.Flags;3232+3333+ if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)3434+ data |= USER_GP_REGS_STATUS_CATCH_BIT;3535+3636+ return data;3737+}3838+2939int metag_gp_regs_copyout(const struct pt_regs *regs,3040 unsigned int pos, unsigned int count,3141 void *kbuf, void __user *ubuf)···7464 if (ret)7565 goto out;7666 /* TXSTATUS */7777- data = (unsigned long)regs->ctx.Flags;7878- if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)7979- data |= USER_GP_REGS_STATUS_CATCH_BIT;6767+ data = user_txstatus(regs);8068 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,8169 &data, 4*25, 4*26);8270 if (ret)···129121 if (ret)130122 goto out;131123 /* TXSTATUS */124124+ data = user_txstatus(regs);132125 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,133126 &data, 4*25, 4*26);134127 if (ret)···255246 unsigned long long *ptr;256247 int ret, i;257248249249+ if (count < 4*13)250250+ return -EINVAL;258251 /* Read the entire pipeline before making any changes */259252 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,260253 &rp, 0, 4*13);···316305 const void *kbuf, const void __user *ubuf)317306{318307 int ret;319319- void __user *tls;308308+ void __user *tls = target->thread.tls_ptr;320309321310 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);322311 if (ret)
+126-198
arch/metag/lib/usercopy.c
···2929 COPY \3030 "1:\n" \3131 " .section .fixup,\"ax\"\n" \3232- " MOV D1Ar1,#0\n" \3332 FIXUP \3433 " MOVT D1Ar1,#HI(1b)\n" \3534 " JUMP D1Ar1,#LO(1b)\n" \···259260 "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \260261 "22:\n" \261262 "MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \262262- "SUB %3, %3, #32\n" \263263 "23:\n" \264264- "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \264264+ "SUB %3, %3, #32\n" \265265 "24:\n" \266266+ "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \267267+ "25:\n" \266268 "MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \269269+ "26:\n" \267270 "SUB %3, %3, #32\n" \268271 "DCACHE [%1+#-64], D0Ar6\n" \269272 "BR $Lloop"id"\n" \270273 \271274 "MOV RAPF, %1\n" \272272- "25:\n" \273273- "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \274274- "26:\n" \275275- "MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \276276- "SUB %3, %3, #32\n" \277275 "27:\n" \278276 "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \279277 "28:\n" \280278 "MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \281281- "SUB %0, %0, #8\n" \282279 "29:\n" \280280+ "SUB %3, %3, #32\n" \281281+ "30:\n" \282282+ "MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \283283+ "31:\n" \284284+ "MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \285285+ "32:\n" \286286+ "SUB %0, %0, #8\n" \287287+ "33:\n" \283288 "SETL [%0++], D0.7, D1.7\n" \284289 "SUB %3, %3, #32\n" \285290 "1:" \···315312 " .long 26b,3b\n" \316313 " .long 27b,3b\n" \317314 " .long 28b,3b\n" \318318- " .long 29b,4b\n" \315315+ " .long 29b,3b\n" \316316+ " .long 30b,3b\n" \317317+ " .long 31b,3b\n" \318318+ " .long 32b,3b\n" \319319+ " .long 33b,4b\n" \319320 " .previous\n" \320321 : "=r" (to), "=r" (from), "=r" (ret), "=d" (n) \321322 : "0" (to), "1" (from), "2" (ret), "3" (n) \322322- : "D1Ar1", "D0Ar2", "memory")323323+ : "D1Ar1", "D0Ar2", "cc", "memory")323324324325/* rewind 'to' and 'from' pointers when a fault occurs325326 *···349342#define __asm_copy_to_user_64bit_rapf_loop(to, from, ret, n, id)\350343 __asm_copy_user_64bit_rapf_loop(to, from, ret, n, id, \351344 "LSR D0Ar2, D0Ar2, #8\n" \352352- "AND D0Ar2, D0Ar2, #0x7\n" \345345+ "ANDS D0Ar2, D0Ar2, #0x7\n" \353346 "ADDZ D0Ar2, D0Ar2, #4\n" \354347 "SUB D0Ar2, D0Ar2, #1\n" \355348 "MOV D1Ar1, #4\n" \···410403 "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \411404 "22:\n" \412405 "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \413413- "SUB %3, %3, #16\n" \414406 "23:\n" \415415- "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \416416- "24:\n" \417417- "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \418407 "SUB %3, %3, #16\n" \419419- "25:\n" \408408+ "24:\n" \420409 "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \421421- "26:\n" \410410+ "25:\n" \422411 "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \412412+ "26:\n" \423413 "SUB %3, %3, #16\n" \424414 "27:\n" \425415 "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \426416 "28:\n" \427417 "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \418418+ "29:\n" \419419+ "SUB %3, %3, #16\n" \420420+ "30:\n" \421421+ "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \422422+ "31:\n" \423423+ "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \424424+ "32:\n" \428425 "SUB %3, %3, #16\n" \429426 "DCACHE [%1+#-64], D0Ar6\n" \430427 "BR $Lloop"id"\n" \431428 \432429 "MOV RAPF, %1\n" \433433- "29:\n" \434434- "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \435435- "30:\n" \436436- "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \437437- "SUB %3, %3, #16\n" \438438- "31:\n" \439439- "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \440440- "32:\n" \441441- "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \442442- "SUB %3, %3, #16\n" \443430 "33:\n" \444431 "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \445432 "34:\n" \446433 "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \447447- "SUB %3, %3, #16\n" \448434 "35:\n" \449449- "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \435435+ "SUB %3, %3, #16\n" \450436 "36:\n" \451451- "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \452452- "SUB %0, %0, #4\n" \437437+ "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \453438 "37:\n" \439439+ "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \440440+ "38:\n" \441441+ "SUB %3, %3, #16\n" \442442+ "39:\n" \443443+ "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \444444+ "40:\n" \445445+ "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \446446+ "41:\n" \447447+ "SUB %3, %3, #16\n" \448448+ "42:\n" \449449+ "MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \450450+ "43:\n" \451451+ "MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \452452+ "44:\n" \453453+ "SUB %0, %0, #4\n" \454454+ "45:\n" \454455 "SETD [%0++], D0.7\n" \455456 "SUB %3, %3, #16\n" \456457 "1:" \···498483 " .long 34b,3b\n" \499484 " .long 35b,3b\n" \500485 " .long 36b,3b\n" \501501- " .long 37b,4b\n" \486486+ " .long 37b,3b\n" \487487+ " .long 38b,3b\n" \488488+ " .long 39b,3b\n" \489489+ " .long 40b,3b\n" \490490+ " .long 41b,3b\n" \491491+ " .long 42b,3b\n" \492492+ " .long 43b,3b\n" \493493+ " .long 44b,3b\n" \494494+ " .long 45b,4b\n" \502495 " .previous\n" \503496 : "=r" (to), "=r" (from), "=r" (ret), "=d" (n) \504497 : "0" (to), "1" (from), "2" (ret), "3" (n) \505505- : "D1Ar1", "D0Ar2", "memory")498498+ : "D1Ar1", "D0Ar2", "cc", "memory")506499507500/* rewind 'to' and 'from' pointers when a fault occurs508501 *···536513#define __asm_copy_to_user_32bit_rapf_loop(to, from, ret, n, id)\537514 __asm_copy_user_32bit_rapf_loop(to, from, ret, n, id, \538515 "LSR D0Ar2, D0Ar2, #8\n" \539539- "AND D0Ar2, D0Ar2, #0x7\n" \516516+ "ANDS D0Ar2, D0Ar2, #0x7\n" \540517 "ADDZ D0Ar2, D0Ar2, #4\n" \541518 "SUB D0Ar2, D0Ar2, #1\n" \542519 "MOV D1Ar1, #4\n" \···561538 if ((unsigned long) src & 1) {562539 __asm_copy_to_user_1(dst, src, retn);563540 n--;541541+ if (retn)542542+ return retn + n;564543 }565544 if ((unsigned long) dst & 1) {566545 /* Worst case - byte copy */567546 while (n > 0) {568547 __asm_copy_to_user_1(dst, src, retn);569548 n--;549549+ if (retn)550550+ return retn + n;570551 }571552 }572553 if (((unsigned long) src & 2) && n >= 2) {573554 __asm_copy_to_user_2(dst, src, retn);574555 n -= 2;556556+ if (retn)557557+ return retn + n;575558 }576559 if ((unsigned long) dst & 2) {577560 /* Second worst case - word copy */578561 while (n >= 2) {579562 __asm_copy_to_user_2(dst, src, retn);580563 n -= 2;564564+ if (retn)565565+ return retn + n;581566 }582567 }583568···600569 while (n >= 8) {601570 __asm_copy_to_user_8x64(dst, src, retn);602571 n -= 8;572572+ if (retn)573573+ return retn + n;603574 }604575 }605576 if (n >= RAPF_MIN_BUF_SIZE) {···614581 while (n >= 8) {615582 __asm_copy_to_user_8x64(dst, src, retn);616583 n -= 8;584584+ if (retn)585585+ return retn + n;617586 }618587 }619588#endif···623588 while (n >= 16) {624589 __asm_copy_to_user_16(dst, src, retn);625590 n -= 16;591591+ if (retn)592592+ return retn + n;626593 }627594628595 while (n >= 4) {629596 __asm_copy_to_user_4(dst, src, retn);630597 n -= 4;598598+ if (retn)599599+ return retn + n;631600 }632601633602 switch (n) {···648609 break;649610 }650611612612+ /*613613+ * If we get here, retn correctly reflects the number of failing614614+ * bytes.615615+ */651616 return retn;652617}653618EXPORT_SYMBOL(__copy_user);···660617 __asm_copy_user_cont(to, from, ret, \661618 " GETB D1Ar1,[%1++]\n" \662619 "2: SETB [%0++],D1Ar1\n", \663663- "3: ADD %2,%2,#1\n" \664664- " SETB [%0++],D1Ar1\n", \620620+ "3: ADD %2,%2,#1\n", \665621 " .long 2b,3b\n")666622667623#define __asm_copy_from_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \668624 __asm_copy_user_cont(to, from, ret, \669625 " GETW D1Ar1,[%1++]\n" \670626 "2: SETW [%0++],D1Ar1\n" COPY, \671671- "3: ADD %2,%2,#2\n" \672672- " SETW [%0++],D1Ar1\n" FIXUP, \627627+ "3: ADD %2,%2,#2\n" FIXUP, \673628 " .long 2b,3b\n" TENTRY)674629675630#define __asm_copy_from_user_2(to, from, ret) \···677636 __asm_copy_from_user_2x_cont(to, from, ret, \678637 " GETB D1Ar1,[%1++]\n" \679638 "4: SETB [%0++],D1Ar1\n", \680680- "5: ADD %2,%2,#1\n" \681681- " SETB [%0++],D1Ar1\n", \639639+ "5: ADD %2,%2,#1\n", \682640 " .long 4b,5b\n")683641684642#define __asm_copy_from_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \685643 __asm_copy_user_cont(to, from, ret, \686644 " GETD D1Ar1,[%1++]\n" \687645 "2: SETD [%0++],D1Ar1\n" COPY, \688688- "3: ADD %2,%2,#4\n" \689689- " SETD [%0++],D1Ar1\n" FIXUP, \646646+ "3: ADD %2,%2,#4\n" FIXUP, \690647 " .long 2b,3b\n" TENTRY)691648692649#define __asm_copy_from_user_4(to, from, ret) \693650 __asm_copy_from_user_4x_cont(to, from, ret, "", "", "")694694-695695-#define __asm_copy_from_user_5(to, from, ret) \696696- __asm_copy_from_user_4x_cont(to, from, ret, \697697- " GETB D1Ar1,[%1++]\n" \698698- "4: SETB [%0++],D1Ar1\n", \699699- "5: ADD %2,%2,#1\n" \700700- " SETB [%0++],D1Ar1\n", \701701- " .long 4b,5b\n")702702-703703-#define __asm_copy_from_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \704704- __asm_copy_from_user_4x_cont(to, from, ret, \705705- " GETW D1Ar1,[%1++]\n" \706706- "4: SETW [%0++],D1Ar1\n" COPY, \707707- "5: ADD %2,%2,#2\n" \708708- " SETW [%0++],D1Ar1\n" FIXUP, \709709- " .long 4b,5b\n" TENTRY)710710-711711-#define __asm_copy_from_user_6(to, from, ret) \712712- __asm_copy_from_user_6x_cont(to, from, ret, "", "", "")713713-714714-#define __asm_copy_from_user_7(to, from, ret) \715715- __asm_copy_from_user_6x_cont(to, from, ret, \716716- " GETB D1Ar1,[%1++]\n" \717717- "6: SETB [%0++],D1Ar1\n", \718718- "7: ADD %2,%2,#1\n" \719719- " SETB [%0++],D1Ar1\n", \720720- " .long 6b,7b\n")721721-722722-#define __asm_copy_from_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \723723- __asm_copy_from_user_4x_cont(to, from, ret, \724724- " GETD D1Ar1,[%1++]\n" \725725- "4: SETD [%0++],D1Ar1\n" COPY, \726726- "5: ADD %2,%2,#4\n" \727727- " SETD [%0++],D1Ar1\n" FIXUP, \728728- " .long 4b,5b\n" TENTRY)729729-730730-#define __asm_copy_from_user_8(to, from, ret) \731731- __asm_copy_from_user_8x_cont(to, from, ret, "", "", "")732732-733733-#define __asm_copy_from_user_9(to, from, ret) \734734- __asm_copy_from_user_8x_cont(to, from, ret, \735735- " GETB D1Ar1,[%1++]\n" \736736- "6: SETB [%0++],D1Ar1\n", \737737- "7: ADD %2,%2,#1\n" \738738- " SETB [%0++],D1Ar1\n", \739739- " .long 6b,7b\n")740740-741741-#define __asm_copy_from_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \742742- __asm_copy_from_user_8x_cont(to, from, ret, \743743- " GETW D1Ar1,[%1++]\n" \744744- "6: SETW [%0++],D1Ar1\n" COPY, \745745- "7: ADD %2,%2,#2\n" \746746- " SETW [%0++],D1Ar1\n" FIXUP, \747747- " .long 6b,7b\n" TENTRY)748748-749749-#define __asm_copy_from_user_10(to, from, ret) \750750- __asm_copy_from_user_10x_cont(to, from, ret, "", "", "")751751-752752-#define __asm_copy_from_user_11(to, from, ret) \753753- __asm_copy_from_user_10x_cont(to, from, ret, \754754- " GETB D1Ar1,[%1++]\n" \755755- "8: SETB [%0++],D1Ar1\n", \756756- "9: ADD %2,%2,#1\n" \757757- " SETB [%0++],D1Ar1\n", \758758- " .long 8b,9b\n")759759-760760-#define __asm_copy_from_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \761761- __asm_copy_from_user_8x_cont(to, from, ret, \762762- " GETD D1Ar1,[%1++]\n" \763763- "6: SETD [%0++],D1Ar1\n" COPY, \764764- "7: ADD %2,%2,#4\n" \765765- " SETD [%0++],D1Ar1\n" FIXUP, \766766- " .long 6b,7b\n" TENTRY)767767-768768-#define __asm_copy_from_user_12(to, from, ret) \769769- __asm_copy_from_user_12x_cont(to, from, ret, "", "", "")770770-771771-#define __asm_copy_from_user_13(to, from, ret) \772772- __asm_copy_from_user_12x_cont(to, from, ret, \773773- " GETB D1Ar1,[%1++]\n" \774774- "8: SETB [%0++],D1Ar1\n", \775775- "9: ADD %2,%2,#1\n" \776776- " SETB [%0++],D1Ar1\n", \777777- " .long 8b,9b\n")778778-779779-#define __asm_copy_from_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \780780- __asm_copy_from_user_12x_cont(to, from, ret, \781781- " GETW D1Ar1,[%1++]\n" \782782- "8: SETW [%0++],D1Ar1\n" COPY, \783783- "9: ADD %2,%2,#2\n" \784784- " SETW [%0++],D1Ar1\n" FIXUP, \785785- " .long 8b,9b\n" TENTRY)786786-787787-#define __asm_copy_from_user_14(to, from, ret) \788788- __asm_copy_from_user_14x_cont(to, from, ret, "", "", "")789789-790790-#define __asm_copy_from_user_15(to, from, ret) \791791- __asm_copy_from_user_14x_cont(to, from, ret, \792792- " GETB D1Ar1,[%1++]\n" \793793- "10: SETB [%0++],D1Ar1\n", \794794- "11: ADD %2,%2,#1\n" \795795- " SETB [%0++],D1Ar1\n", \796796- " .long 10b,11b\n")797797-798798-#define __asm_copy_from_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \799799- __asm_copy_from_user_12x_cont(to, from, ret, \800800- " GETD D1Ar1,[%1++]\n" \801801- "8: SETD [%0++],D1Ar1\n" COPY, \802802- "9: ADD %2,%2,#4\n" \803803- " SETD [%0++],D1Ar1\n" FIXUP, \804804- " .long 8b,9b\n" TENTRY)805805-806806-#define __asm_copy_from_user_16(to, from, ret) \807807- __asm_copy_from_user_16x_cont(to, from, ret, "", "", "")808651809652#define __asm_copy_from_user_8x64(to, from, ret) \810653 asm volatile ( \···696771 "2: SETL [%0++],D0Ar2,D1Ar1\n" \697772 "1:\n" \698773 " .section .fixup,\"ax\"\n" \699699- " MOV D1Ar1,#0\n" \700700- " MOV D0Ar2,#0\n" \701774 "3: ADD %2,%2,#8\n" \702702- " SETL [%0++],D0Ar2,D1Ar1\n" \703775 " MOVT D0Ar2,#HI(1b)\n" \704776 " JUMP D0Ar2,#LO(1b)\n" \705777 " .previous\n" \···711789 *712790 * Rationale:713791 * A fault occurs while reading from user buffer, which is the714714- * source. Since the fault is at a single address, we only715715- * need to rewind by 8 bytes.792792+ * source.716793 * Since we don't write to kernel buffer until we read first,717794 * the kernel buffer is at the right state and needn't be718718- * corrected.795795+ * corrected, but the source must be rewound to the beginning of796796+ * the block, which is LSM_STEP*8 bytes.797797+ * LSM_STEP is bits 10:8 in TXSTATUS which is already read798798+ * and stored in D0Ar2799799+ *800800+ * NOTE: If a fault occurs at the last operation in M{G,S}ETL801801+ * LSM_STEP will be 0. ie: we do 4 writes in our case, if802802+ * a fault happens at the 4th write, LSM_STEP will be 0803803+ * instead of 4. The code copes with that.719804 */720805#define __asm_copy_from_user_64bit_rapf_loop(to, from, ret, n, id) \721806 __asm_copy_user_64bit_rapf_loop(to, from, ret, n, id, \722722- "SUB %1, %1, #8\n")807807+ "LSR D0Ar2, D0Ar2, #5\n" \808808+ "ANDS D0Ar2, D0Ar2, #0x38\n" \809809+ "ADDZ D0Ar2, D0Ar2, #32\n" \810810+ "SUB %1, %1, D0Ar2\n")723811724812/* rewind 'from' pointer when a fault occurs725813 *726814 * Rationale:727815 * A fault occurs while reading from user buffer, which is the728728- * source. Since the fault is at a single address, we only729729- * need to rewind by 4 bytes.816816+ * source.730817 * Since we don't write to kernel buffer until we read first,731818 * the kernel buffer is at the right state and needn't be732732- * corrected.819819+ * corrected, but the source must be rewound to the beginning of820820+ * the block, which is LSM_STEP*4 bytes.821821+ * LSM_STEP is bits 10:8 in TXSTATUS which is already read822822+ * and stored in D0Ar2823823+ *824824+ * NOTE: If a fault occurs at the last operation in M{G,S}ETL825825+ * LSM_STEP will be 0. ie: we do 4 writes in our case, if826826+ * a fault happens at the 4th write, LSM_STEP will be 0827827+ * instead of 4. The code copes with that.733828 */734829#define __asm_copy_from_user_32bit_rapf_loop(to, from, ret, n, id) \735830 __asm_copy_user_32bit_rapf_loop(to, from, ret, n, id, \736736- "SUB %1, %1, #4\n")831831+ "LSR D0Ar2, D0Ar2, #6\n" \832832+ "ANDS D0Ar2, D0Ar2, #0x1c\n" \833833+ "ADDZ D0Ar2, D0Ar2, #16\n" \834834+ "SUB %1, %1, D0Ar2\n")737835738836739739-/* Copy from user to kernel, zeroing the bytes that were inaccessible in740740- userland. The return-value is the number of bytes that were741741- inaccessible. */742742-unsigned long __copy_user_zeroing(void *pdst, const void __user *psrc,743743- unsigned long n)837837+/*838838+ * Copy from user to kernel. The return-value is the number of bytes that were839839+ * inaccessible.840840+ */841841+unsigned long raw_copy_from_user(void *pdst, const void __user *psrc,842842+ unsigned long n)744843{745844 register char *dst asm ("A0.2") = pdst;746845 register const char __user *src asm ("A1.2") = psrc;···773830 if ((unsigned long) src & 1) {774831 __asm_copy_from_user_1(dst, src, retn);775832 n--;833833+ if (retn)834834+ return retn + n;776835 }777836 if ((unsigned long) dst & 1) {778837 /* Worst case - byte copy */···782837 __asm_copy_from_user_1(dst, src, retn);783838 n--;784839 if (retn)785785- goto copy_exception_bytes;840840+ return retn + n;786841 }787842 }788843 if (((unsigned long) src & 2) && n >= 2) {789844 __asm_copy_from_user_2(dst, src, retn);790845 n -= 2;846846+ if (retn)847847+ return retn + n;791848 }792849 if ((unsigned long) dst & 2) {793850 /* Second worst case - word copy */···797850 __asm_copy_from_user_2(dst, src, retn);798851 n -= 2;799852 if (retn)800800- goto copy_exception_bytes;853853+ return retn + n;801854 }802855 }803803-804804- /* We only need one check after the unalignment-adjustments,805805- because if both adjustments were done, either both or806806- neither reference had an exception. */807807- if (retn != 0)808808- goto copy_exception_bytes;809856810857#ifdef USE_RAPF811858 /* 64 bit copy loop */···813872 __asm_copy_from_user_8x64(dst, src, retn);814873 n -= 8;815874 if (retn)816816- goto copy_exception_bytes;875875+ return retn + n;817876 }818877 }819878···829888 __asm_copy_from_user_8x64(dst, src, retn);830889 n -= 8;831890 if (retn)832832- goto copy_exception_bytes;891891+ return retn + n;833892 }834893 }835894#endif···839898 n -= 4;840899841900 if (retn)842842- goto copy_exception_bytes;901901+ return retn + n;843902 }844903845904 /* If we get here, there were no memory read faults. */···865924 /* If we get here, retn correctly reflects the number of failing866925 bytes. */867926 return retn;868868-869869- copy_exception_bytes:870870- /* We already have "retn" bytes cleared, and need to clear the871871- remaining "n" bytes. A non-optimized simple byte-for-byte in-line872872- memset is preferred here, since this isn't speed-critical code and873873- we'd rather have this a leaf-function than calling memset. */874874- {875875- char *endp;876876- for (endp = dst + n; dst < endp; dst++)877877- *dst = 0;878878- }879879-880880- return retn + n;881927}882882-EXPORT_SYMBOL(__copy_user_zeroing);928928+EXPORT_SYMBOL(raw_copy_from_user);883929884930#define __asm_clear_8x64(to, ret) \885931 asm volatile ( \
+1-1
arch/mips/Kconfig
···15311531 select CPU_SUPPORTS_HIGHMEM15321532 select CPU_SUPPORTS_MSA15331533 select GENERIC_CSUM15341534- select MIPS_O32_FP64_SUPPORT if MIPS32_O3215341534+ select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O3215351535 select HAVE_KVM15361536 help15371537 Choose this option to build a kernel for release 6 or later of the
···1818#include <irq.h>19192020#define IRQ_STACK_SIZE THREAD_SIZE2121+#define IRQ_STACK_START (IRQ_STACK_SIZE - sizeof(unsigned long))21222223extern void *irq_stack[NR_CPUS];2424+2525+/*2626+ * The highest address on the IRQ stack contains a dummy frame put down in2727+ * genex.S (handle_int & except_vec_vi_handler) which is structured as follows:2828+ *2929+ * top ------------3030+ * | task sp | <- irq_stack[cpu] + IRQ_STACK_START3131+ * ------------3232+ * | | <- First frame of IRQ context3333+ * ------------3434+ *3535+ * task sp holds a copy of the task stack pointer where the struct pt_regs3636+ * from exception entry can be found.3737+ */23382439static inline bool on_irq_stack(int cpu, unsigned long sp)2540{
···467467468468 if (!np_xbar)469469 panic("Failed to load xbar nodes from devicetree");470470- if (of_address_to_resource(np_pmu, 0, &res_xbar))470470+ if (of_address_to_resource(np_xbar, 0, &res_xbar))471471 panic("Failed to get xbar resources");472472 if (!request_mem_region(res_xbar.start, resource_size(&res_xbar),473473 res_xbar.name))
···6565 ".previous\n"66666767/*6868+ * ASM_EXCEPTIONTABLE_ENTRY_EFAULT() creates a special exception table entry6969+ * (with lowest bit set) for which the fault handler in fixup_exception() will7070+ * load -EFAULT into %r8 for a read or write fault, and zeroes the target7171+ * register in case of a read fault in get_user().7272+ */7373+#define ASM_EXCEPTIONTABLE_ENTRY_EFAULT( fault_addr, except_addr )\7474+ ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr + 1)7575+7676+/*6877 * The page fault handler stores, in a per-cpu area, the following information6978 * if a fixup routine is available.7079 */···10091#define __get_user(x, ptr) \10192({ \10293 register long __gu_err __asm__ ("r8") = 0; \103103- register long __gu_val __asm__ ("r9") = 0; \9494+ register long __gu_val; \10495 \10596 load_sr2(); \10697 switch (sizeof(*(ptr))) { \···116107})117108118109#define __get_user_asm(ldx, ptr) \119119- __asm__("\n1:\t" ldx "\t0(%%sr2,%2),%0\n\t" \120120- ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\110110+ __asm__("1: " ldx " 0(%%sr2,%2),%0\n" \111111+ "9:\n" \112112+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \121113 : "=r"(__gu_val), "=r"(__gu_err) \122122- : "r"(ptr), "1"(__gu_err) \123123- : "r1");114114+ : "r"(ptr), "1"(__gu_err));124115125116#if !defined(CONFIG_64BIT)126117127118#define __get_user_asm64(ptr) \128128- __asm__("\n1:\tldw 0(%%sr2,%2),%0" \129129- "\n2:\tldw 4(%%sr2,%2),%R0\n\t" \130130- ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_2)\131131- ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_get_user_skip_1)\119119+ __asm__(" copy %%r0,%R0\n" \120120+ "1: ldw 0(%%sr2,%2),%0\n" \121121+ "2: ldw 4(%%sr2,%2),%R0\n" \122122+ "9:\n" \123123+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \124124+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \132125 : "=r"(__gu_val), "=r"(__gu_err) \133133- : "r"(ptr), "1"(__gu_err) \134134- : "r1");126126+ : "r"(ptr), "1"(__gu_err));135127136128#endif /* !defined(CONFIG_64BIT) */137129···158148 * The "__put_user/kernel_asm()" macros tell gcc they read from memory159149 * instead of writing. This is because they do not write to any memory160150 * gcc knows about, so there are no aliasing issues. These macros must161161- * also be aware that "fixup_put_user_skip_[12]" are executed in the162162- * context of the fault, and any registers used there must be listed163163- * as clobbers. In this case only "r1" is used by the current routines.164164- * r8/r9 are already listed as err/val.151151+ * also be aware that fixups are executed in the context of the fault,152152+ * and any registers used there must be listed as clobbers.153153+ * r8 is already listed as err.165154 */166155167156#define __put_user_asm(stx, x, ptr) \168157 __asm__ __volatile__ ( \169169- "\n1:\t" stx "\t%2,0(%%sr2,%1)\n\t" \170170- ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\158158+ "1: " stx " %2,0(%%sr2,%1)\n" \159159+ "9:\n" \160160+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \171161 : "=r"(__pu_err) \172172- : "r"(ptr), "r"(x), "0"(__pu_err) \173173- : "r1")162162+ : "r"(ptr), "r"(x), "0"(__pu_err))174163175164176165#if !defined(CONFIG_64BIT)177166178167#define __put_user_asm64(__val, ptr) do { \179168 __asm__ __volatile__ ( \180180- "\n1:\tstw %2,0(%%sr2,%1)" \181181- "\n2:\tstw %R2,4(%%sr2,%1)\n\t" \182182- ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\183183- ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\169169+ "1: stw %2,0(%%sr2,%1)\n" \170170+ "2: stw %R2,4(%%sr2,%1)\n" \171171+ "9:\n" \172172+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \173173+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \184174 : "=r"(__pu_err) \185185- : "r"(ptr), "r"(__val), "0"(__pu_err) \186186- : "r1"); \175175+ : "r"(ptr), "r"(__val), "0"(__pu_err)); \187176} while (0)188177189178#endif /* !defined(CONFIG_64BIT) */
-10
arch/parisc/kernel/parisc_ksyms.c
···4747EXPORT_SYMBOL(lclear_user);4848EXPORT_SYMBOL(lstrnlen_user);49495050-/* Global fixups - defined as int to avoid creation of function pointers */5151-extern int fixup_get_user_skip_1;5252-extern int fixup_get_user_skip_2;5353-extern int fixup_put_user_skip_1;5454-extern int fixup_put_user_skip_2;5555-EXPORT_SYMBOL(fixup_get_user_skip_1);5656-EXPORT_SYMBOL(fixup_get_user_skip_2);5757-EXPORT_SYMBOL(fixup_put_user_skip_1);5858-EXPORT_SYMBOL(fixup_put_user_skip_2);5959-6050#ifndef CONFIG_64BIT6151/* Needed so insmod can set dp value */6252extern int $global$;
+2
arch/parisc/kernel/process.c
···143143 printk(KERN_EMERG "System shut down completed.\n"144144 "Please power this system off now.");145145146146+ /* prevent soft lockup/stalled CPU messages for endless loop. */147147+ rcu_sysrq_start();146148 for (;;);147149}148150
···11-/*22- * Linux/PA-RISC Project (http://www.parisc-linux.org/)33- *44- * Copyright (C) 2004 Randolph Chung <tausq@debian.org>55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License as published by88- * the Free Software Foundation; either version 2, or (at your option)99- * any later version.1010- *1111- * This program is distributed in the hope that it will be useful,1212- * but WITHOUT ANY WARRANTY; without even the implied warranty of1313- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414- * GNU General Public License for more details.1515- *1616- * You should have received a copy of the GNU General Public License1717- * along with this program; if not, write to the Free Software1818- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919- * 2020- * Fixup routines for kernel exception handling.2121- */2222-#include <asm/asm-offsets.h>2323-#include <asm/assembly.h>2424-#include <asm/errno.h>2525-#include <linux/linkage.h>2626-2727-#ifdef CONFIG_SMP2828- .macro get_fault_ip t1 t22929- loadgp3030- addil LT%__per_cpu_offset,%r273131- LDREG RT%__per_cpu_offset(%r1),\t13232- /* t2 = smp_processor_id() */3333- mfctl 30,\t23434- ldw TI_CPU(\t2),\t23535-#ifdef CONFIG_64BIT3636- extrd,u \t2,63,32,\t23737-#endif3838- /* t2 = &__per_cpu_offset[smp_processor_id()]; */3939- LDREGX \t2(\t1),\t2 4040- addil LT%exception_data,%r274141- LDREG RT%exception_data(%r1),\t14242- /* t1 = this_cpu_ptr(&exception_data) */4343- add,l \t1,\t2,\t14444- /* %r27 = t1->fault_gp - restore gp */4545- LDREG EXCDATA_GP(\t1), %r274646- /* t1 = t1->fault_ip */4747- LDREG EXCDATA_IP(\t1), \t14848- .endm4949-#else5050- .macro get_fault_ip t1 t25151- loadgp5252- /* t1 = this_cpu_ptr(&exception_data) */5353- addil LT%exception_data,%r275454- LDREG RT%exception_data(%r1),\t25555- /* %r27 = t2->fault_gp - restore gp */5656- LDREG EXCDATA_GP(\t2), %r275757- /* t1 = t2->fault_ip */5858- LDREG EXCDATA_IP(\t2), \t15959- .endm6060-#endif6161-6262- .level LEVEL6363-6464- .text6565- .section .fixup, "ax"6666-6767- /* get_user() fixups, store -EFAULT in r8, and 0 in r9 */6868-ENTRY_CFI(fixup_get_user_skip_1)6969- get_fault_ip %r1,%r87070- ldo 4(%r1), %r17171- ldi -EFAULT, %r87272- bv %r0(%r1)7373- copy %r0, %r97474-ENDPROC_CFI(fixup_get_user_skip_1)7575-7676-ENTRY_CFI(fixup_get_user_skip_2)7777- get_fault_ip %r1,%r87878- ldo 8(%r1), %r17979- ldi -EFAULT, %r88080- bv %r0(%r1)8181- copy %r0, %r98282-ENDPROC_CFI(fixup_get_user_skip_2)8383-8484- /* put_user() fixups, store -EFAULT in r8 */8585-ENTRY_CFI(fixup_put_user_skip_1)8686- get_fault_ip %r1,%r88787- ldo 4(%r1), %r18888- bv %r0(%r1)8989- ldi -EFAULT, %r89090-ENDPROC_CFI(fixup_put_user_skip_1)9191-9292-ENTRY_CFI(fixup_put_user_skip_2)9393- get_fault_ip %r1,%r89494- ldo 8(%r1), %r19595- bv %r0(%r1)9696- ldi -EFAULT, %r89797-ENDPROC_CFI(fixup_put_user_skip_2)9898-
+318
arch/parisc/lib/lusercopy.S
···55 * Copyright (C) 2000 Richard Hirst <rhirst with parisc-linux.org>66 * Copyright (C) 2001 Matthieu Delahaye <delahaym at esiee.fr>77 * Copyright (C) 2003 Randolph Chung <tausq with parisc-linux.org>88+ * Copyright (C) 2017 Helge Deller <deller@gmx.de>99+ * Copyright (C) 2017 John David Anglin <dave.anglin@bell.net>810 *911 *1012 * This program is free software; you can redistribute it and/or modify···132130 ASM_EXCEPTIONTABLE_ENTRY(1b,3b)133131 ASM_EXCEPTIONTABLE_ENTRY(2b,3b)134132133133+ .procend134134+135135+136136+137137+/*138138+ * unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)139139+ *140140+ * Inputs:141141+ * - sr1 already contains space of source region142142+ * - sr2 already contains space of destination region143143+ *144144+ * Returns:145145+ * - number of bytes that could not be copied.146146+ * On success, this will be zero.147147+ *148148+ * This code is based on a C-implementation of a copy routine written by149149+ * Randolph Chung, which in turn was derived from the glibc.150150+ *151151+ * Several strategies are tried to try to get the best performance for various152152+ * conditions. In the optimal case, we copy by loops that copy 32- or 16-bytes153153+ * at a time using general registers. Unaligned copies are handled either by154154+ * aligning the destination and then using shift-and-write method, or in a few155155+ * cases by falling back to a byte-at-a-time copy.156156+ *157157+ * Testing with various alignments and buffer sizes shows that this code is158158+ * often >10x faster than a simple byte-at-a-time copy, even for strangely159159+ * aligned operands. It is interesting to note that the glibc version of memcpy160160+ * (written in C) is actually quite fast already. This routine is able to beat161161+ * it by 30-40% for aligned copies because of the loop unrolling, but in some162162+ * cases the glibc version is still slightly faster. This lends more163163+ * credibility that gcc can generate very good code as long as we are careful.164164+ *165165+ * Possible optimizations:166166+ * - add cache prefetching167167+ * - try not to use the post-increment address modifiers; they may create168168+ * additional interlocks. Assumption is that those were only efficient on old169169+ * machines (pre PA8000 processors)170170+ */171171+172172+ dst = arg0173173+ src = arg1174174+ len = arg2175175+ end = arg3176176+ t1 = r19177177+ t2 = r20178178+ t3 = r21179179+ t4 = r22180180+ srcspc = sr1181181+ dstspc = sr2182182+183183+ t0 = r1184184+ a1 = t1185185+ a2 = t2186186+ a3 = t3187187+ a0 = t4188188+189189+ save_src = ret0190190+ save_dst = ret1191191+ save_len = r31192192+193193+ENTRY_CFI(pa_memcpy)194194+ .proc195195+ .callinfo NO_CALLS196196+ .entry197197+198198+ /* Last destination address */199199+ add dst,len,end200200+201201+ /* short copy with less than 16 bytes? */202202+ cmpib,>>=,n 15,len,.Lbyte_loop203203+204204+ /* same alignment? */205205+ xor src,dst,t0206206+ extru t0,31,2,t1207207+ cmpib,<>,n 0,t1,.Lunaligned_copy208208+209209+#ifdef CONFIG_64BIT210210+ /* only do 64-bit copies if we can get aligned. */211211+ extru t0,31,3,t1212212+ cmpib,<>,n 0,t1,.Lalign_loop32213213+214214+ /* loop until we are 64-bit aligned */215215+.Lalign_loop64:216216+ extru dst,31,3,t1217217+ cmpib,=,n 0,t1,.Lcopy_loop_16218218+20: ldb,ma 1(srcspc,src),t1219219+21: stb,ma t1,1(dstspc,dst)220220+ b .Lalign_loop64221221+ ldo -1(len),len222222+223223+ ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)224224+ ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)225225+226226+ ldi 31,t0227227+.Lcopy_loop_16:228228+ cmpb,COND(>>=),n t0,len,.Lword_loop229229+230230+10: ldd 0(srcspc,src),t1231231+11: ldd 8(srcspc,src),t2232232+ ldo 16(src),src233233+12: std,ma t1,8(dstspc,dst)234234+13: std,ma t2,8(dstspc,dst)235235+14: ldd 0(srcspc,src),t1236236+15: ldd 8(srcspc,src),t2237237+ ldo 16(src),src238238+16: std,ma t1,8(dstspc,dst)239239+17: std,ma t2,8(dstspc,dst)240240+241241+ ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)242242+ ASM_EXCEPTIONTABLE_ENTRY(11b,.Lcopy16_fault)243243+ ASM_EXCEPTIONTABLE_ENTRY(12b,.Lcopy_done)244244+ ASM_EXCEPTIONTABLE_ENTRY(13b,.Lcopy_done)245245+ ASM_EXCEPTIONTABLE_ENTRY(14b,.Lcopy_done)246246+ ASM_EXCEPTIONTABLE_ENTRY(15b,.Lcopy16_fault)247247+ ASM_EXCEPTIONTABLE_ENTRY(16b,.Lcopy_done)248248+ ASM_EXCEPTIONTABLE_ENTRY(17b,.Lcopy_done)249249+250250+ b .Lcopy_loop_16251251+ ldo -32(len),len252252+253253+.Lword_loop:254254+ cmpib,COND(>>=),n 3,len,.Lbyte_loop255255+20: ldw,ma 4(srcspc,src),t1256256+21: stw,ma t1,4(dstspc,dst)257257+ b .Lword_loop258258+ ldo -4(len),len259259+260260+ ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)261261+ ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)262262+263263+#endif /* CONFIG_64BIT */264264+265265+ /* loop until we are 32-bit aligned */266266+.Lalign_loop32:267267+ extru dst,31,2,t1268268+ cmpib,=,n 0,t1,.Lcopy_loop_4269269+20: ldb,ma 1(srcspc,src),t1270270+21: stb,ma t1,1(dstspc,dst)271271+ b .Lalign_loop32272272+ ldo -1(len),len273273+274274+ ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)275275+ ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)276276+277277+278278+.Lcopy_loop_4:279279+ cmpib,COND(>>=),n 15,len,.Lbyte_loop280280+281281+10: ldw 0(srcspc,src),t1282282+11: ldw 4(srcspc,src),t2283283+12: stw,ma t1,4(dstspc,dst)284284+13: stw,ma t2,4(dstspc,dst)285285+14: ldw 8(srcspc,src),t1286286+15: ldw 12(srcspc,src),t2287287+ ldo 16(src),src288288+16: stw,ma t1,4(dstspc,dst)289289+17: stw,ma t2,4(dstspc,dst)290290+291291+ ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)292292+ ASM_EXCEPTIONTABLE_ENTRY(11b,.Lcopy8_fault)293293+ ASM_EXCEPTIONTABLE_ENTRY(12b,.Lcopy_done)294294+ ASM_EXCEPTIONTABLE_ENTRY(13b,.Lcopy_done)295295+ ASM_EXCEPTIONTABLE_ENTRY(14b,.Lcopy_done)296296+ ASM_EXCEPTIONTABLE_ENTRY(15b,.Lcopy8_fault)297297+ ASM_EXCEPTIONTABLE_ENTRY(16b,.Lcopy_done)298298+ ASM_EXCEPTIONTABLE_ENTRY(17b,.Lcopy_done)299299+300300+ b .Lcopy_loop_4301301+ ldo -16(len),len302302+303303+.Lbyte_loop:304304+ cmpclr,COND(<>) len,%r0,%r0305305+ b,n .Lcopy_done306306+20: ldb 0(srcspc,src),t1307307+ ldo 1(src),src308308+21: stb,ma t1,1(dstspc,dst)309309+ b .Lbyte_loop310310+ ldo -1(len),len311311+312312+ ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)313313+ ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)314314+315315+.Lcopy_done:316316+ bv %r0(%r2)317317+ sub end,dst,ret0318318+319319+320320+ /* src and dst are not aligned the same way. */321321+ /* need to go the hard way */322322+.Lunaligned_copy:323323+ /* align until dst is 32bit-word-aligned */324324+ extru dst,31,2,t1325325+ cmpib,COND(=),n 0,t1,.Lcopy_dstaligned326326+20: ldb 0(srcspc,src),t1327327+ ldo 1(src),src328328+21: stb,ma t1,1(dstspc,dst)329329+ b .Lunaligned_copy330330+ ldo -1(len),len331331+332332+ ASM_EXCEPTIONTABLE_ENTRY(20b,.Lcopy_done)333333+ ASM_EXCEPTIONTABLE_ENTRY(21b,.Lcopy_done)334334+335335+.Lcopy_dstaligned:336336+337337+ /* store src, dst and len in safe place */338338+ copy src,save_src339339+ copy dst,save_dst340340+ copy len,save_len341341+342342+ /* len now needs give number of words to copy */343343+ SHRREG len,2,len344344+345345+ /*346346+ * Copy from a not-aligned src to an aligned dst using shifts.347347+ * Handles 4 words per loop.348348+ */349349+350350+ depw,z src,28,2,t0351351+ subi 32,t0,t0352352+ mtsar t0353353+ extru len,31,2,t0354354+ cmpib,= 2,t0,.Lcase2355355+ /* Make src aligned by rounding it down. */356356+ depi 0,31,2,src357357+358358+ cmpiclr,<> 3,t0,%r0359359+ b,n .Lcase3360360+ cmpiclr,<> 1,t0,%r0361361+ b,n .Lcase1362362+.Lcase0:363363+ cmpb,= %r0,len,.Lcda_finish364364+ nop365365+366366+1: ldw,ma 4(srcspc,src), a3367367+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)368368+1: ldw,ma 4(srcspc,src), a0369369+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)370370+ b,n .Ldo3371371+.Lcase1:372372+1: ldw,ma 4(srcspc,src), a2373373+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)374374+1: ldw,ma 4(srcspc,src), a3375375+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)376376+ ldo -1(len),len377377+ cmpb,=,n %r0,len,.Ldo0378378+.Ldo4:379379+1: ldw,ma 4(srcspc,src), a0380380+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)381381+ shrpw a2, a3, %sar, t0382382+1: stw,ma t0, 4(dstspc,dst)383383+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)384384+.Ldo3:385385+1: ldw,ma 4(srcspc,src), a1386386+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)387387+ shrpw a3, a0, %sar, t0388388+1: stw,ma t0, 4(dstspc,dst)389389+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)390390+.Ldo2:391391+1: ldw,ma 4(srcspc,src), a2392392+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)393393+ shrpw a0, a1, %sar, t0394394+1: stw,ma t0, 4(dstspc,dst)395395+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)396396+.Ldo1:397397+1: ldw,ma 4(srcspc,src), a3398398+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)399399+ shrpw a1, a2, %sar, t0400400+1: stw,ma t0, 4(dstspc,dst)401401+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)402402+ ldo -4(len),len403403+ cmpb,<> %r0,len,.Ldo4404404+ nop405405+.Ldo0:406406+ shrpw a2, a3, %sar, t0407407+1: stw,ma t0, 4(dstspc,dst)408408+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcopy_done)409409+410410+.Lcda_rdfault:411411+.Lcda_finish:412412+ /* calculate new src, dst and len and jump to byte-copy loop */413413+ sub dst,save_dst,t0414414+ add save_src,t0,src415415+ b .Lbyte_loop416416+ sub save_len,t0,len417417+418418+.Lcase3:419419+1: ldw,ma 4(srcspc,src), a0420420+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)421421+1: ldw,ma 4(srcspc,src), a1422422+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)423423+ b .Ldo2424424+ ldo 1(len),len425425+.Lcase2:426426+1: ldw,ma 4(srcspc,src), a1427427+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)428428+1: ldw,ma 4(srcspc,src), a2429429+ ASM_EXCEPTIONTABLE_ENTRY(1b,.Lcda_rdfault)430430+ b .Ldo1431431+ ldo 2(len),len432432+433433+434434+ /* fault exception fixup handlers: */435435+#ifdef CONFIG_64BIT436436+.Lcopy16_fault:437437+10: b .Lcopy_done438438+ std,ma t1,8(dstspc,dst)439439+ ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)440440+#endif441441+442442+.Lcopy8_fault:443443+10: b .Lcopy_done444444+ stw,ma t1,4(dstspc,dst)445445+ ASM_EXCEPTIONTABLE_ENTRY(10b,.Lcopy_done)446446+447447+ .exit448448+ENDPROC_CFI(pa_memcpy)135449 .procend136450137451 .end
+3-458
arch/parisc/lib/memcpy.c
···22 * Optimized memory copy routines.33 *44 * Copyright (C) 2004 Randolph Chung <tausq@debian.org>55- * Copyright (C) 2013 Helge Deller <deller@gmx.de>55+ * Copyright (C) 2013-2017 Helge Deller <deller@gmx.de>66 *77 * This program is free software; you can redistribute it and/or modify88 * it under the terms of the GNU General Public License as published by···2121 * Portions derived from the GNU C Library2222 * Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.2323 *2424- * Several strategies are tried to try to get the best performance for various2525- * conditions. In the optimal case, we copy 64-bytes in an unrolled loop using 2626- * fp regs. This is followed by loops that copy 32- or 16-bytes at a time using2727- * general registers. Unaligned copies are handled either by aligning the 2828- * destination and then using shift-and-write method, or in a few cases by 2929- * falling back to a byte-at-a-time copy.3030- *3131- * I chose to implement this in C because it is easier to maintain and debug,3232- * and in my experiments it appears that the C code generated by gcc (3.3/3.43333- * at the time of writing) is fairly optimal. Unfortunately some of the 3434- * semantics of the copy routine (exception handling) is difficult to express3535- * in C, so we have to play some tricks to get it to work.3636- *3737- * All the loads and stores are done via explicit asm() code in order to use3838- * the right space registers. 3939- * 4040- * Testing with various alignments and buffer sizes shows that this code is 4141- * often >10x faster than a simple byte-at-a-time copy, even for strangely4242- * aligned operands. It is interesting to note that the glibc version4343- * of memcpy (written in C) is actually quite fast already. This routine is 4444- * able to beat it by 30-40% for aligned copies because of the loop unrolling, 4545- * but in some cases the glibc version is still slightly faster. This lends 4646- * more credibility that gcc can generate very good code as long as we are 4747- * careful.4848- *4949- * TODO:5050- * - cache prefetching needs more experimentation to get optimal settings5151- * - try not to use the post-increment address modifiers; they create additional5252- * interlocks5353- * - replace byte-copy loops with stybs sequences5424 */55255656-#ifdef __KERNEL__5726#include <linux/module.h>5827#include <linux/compiler.h>5928#include <linux/uaccess.h>6060-#define s_space "%%sr1"6161-#define d_space "%%sr2"6262-#else6363-#include "memcpy.h"6464-#define s_space "%%sr0"6565-#define d_space "%%sr0"6666-#define pa_memcpy new2_copy6767-#endif68296930DECLARE_PER_CPU(struct exception_data, exception_data);7070-7171-#define preserve_branch(label) do { \7272- volatile int dummy = 0; \7373- /* The following branch is never taken, it's just here to */ \7474- /* prevent gcc from optimizing away our exception code. */ \7575- if (unlikely(dummy != dummy)) \7676- goto label; \7777-} while (0)78317932#define get_user_space() (segment_eq(get_fs(), KERNEL_DS) ? 0 : mfsp(3))8033#define get_kernel_space() (0)81348282-#define MERGE(w0, sh_1, w1, sh_2) ({ \8383- unsigned int _r; \8484- asm volatile ( \8585- "mtsar %3\n" \8686- "shrpw %1, %2, %%sar, %0\n" \8787- : "=r"(_r) \8888- : "r"(w0), "r"(w1), "r"(sh_2) \8989- ); \9090- _r; \9191-})9292-#define THRESHOLD 169393-9494-#ifdef DEBUG_MEMCPY9595-#define DPRINTF(fmt, args...) do { printk(KERN_DEBUG "%s:%d:%s ", __FILE__, __LINE__, __func__ ); printk(KERN_DEBUG fmt, ##args ); } while (0)9696-#else9797-#define DPRINTF(fmt, args...)9898-#endif9999-100100-#define def_load_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \101101- __asm__ __volatile__ ( \102102- "1:\t" #_insn ",ma " #_sz "(" _s ",%1), %0\n\t" \103103- ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \104104- : _tt(_t), "+r"(_a) \105105- : \106106- : "r8")107107-108108-#define def_store_ai_insn(_insn,_sz,_tt,_s,_a,_t,_e) \109109- __asm__ __volatile__ ( \110110- "1:\t" #_insn ",ma %1, " #_sz "(" _s ",%0)\n\t" \111111- ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \112112- : "+r"(_a) \113113- : _tt(_t) \114114- : "r8")115115-116116-#define ldbma(_s, _a, _t, _e) def_load_ai_insn(ldbs,1,"=r",_s,_a,_t,_e)117117-#define stbma(_s, _t, _a, _e) def_store_ai_insn(stbs,1,"r",_s,_a,_t,_e)118118-#define ldwma(_s, _a, _t, _e) def_load_ai_insn(ldw,4,"=r",_s,_a,_t,_e)119119-#define stwma(_s, _t, _a, _e) def_store_ai_insn(stw,4,"r",_s,_a,_t,_e)120120-#define flddma(_s, _a, _t, _e) def_load_ai_insn(fldd,8,"=f",_s,_a,_t,_e)121121-#define fstdma(_s, _t, _a, _e) def_store_ai_insn(fstd,8,"f",_s,_a,_t,_e)122122-123123-#define def_load_insn(_insn,_tt,_s,_o,_a,_t,_e) \124124- __asm__ __volatile__ ( \125125- "1:\t" #_insn " " #_o "(" _s ",%1), %0\n\t" \126126- ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \127127- : _tt(_t) \128128- : "r"(_a) \129129- : "r8")130130-131131-#define def_store_insn(_insn,_tt,_s,_t,_o,_a,_e) \132132- __asm__ __volatile__ ( \133133- "1:\t" #_insn " %0, " #_o "(" _s ",%1)\n\t" \134134- ASM_EXCEPTIONTABLE_ENTRY(1b,_e) \135135- : \136136- : _tt(_t), "r"(_a) \137137- : "r8")138138-139139-#define ldw(_s,_o,_a,_t,_e) def_load_insn(ldw,"=r",_s,_o,_a,_t,_e)140140-#define stw(_s,_t,_o,_a,_e) def_store_insn(stw,"r",_s,_t,_o,_a,_e)141141-142142-#ifdef CONFIG_PREFETCH143143-static inline void prefetch_src(const void *addr)144144-{145145- __asm__("ldw 0(" s_space ",%0), %%r0" : : "r" (addr));146146-}147147-148148-static inline void prefetch_dst(const void *addr)149149-{150150- __asm__("ldd 0(" d_space ",%0), %%r0" : : "r" (addr));151151-}152152-#else153153-#define prefetch_src(addr) do { } while(0)154154-#define prefetch_dst(addr) do { } while(0)155155-#endif156156-157157-#define PA_MEMCPY_OK 0158158-#define PA_MEMCPY_LOAD_ERROR 1159159-#define PA_MEMCPY_STORE_ERROR 2160160-161161-/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words162162- * per loop. This code is derived from glibc. 163163- */164164-static noinline unsigned long copy_dstaligned(unsigned long dst,165165- unsigned long src, unsigned long len)166166-{167167- /* gcc complains that a2 and a3 may be uninitialized, but actually168168- * they cannot be. Initialize a2/a3 to shut gcc up.169169- */170170- register unsigned int a0, a1, a2 = 0, a3 = 0;171171- int sh_1, sh_2;172172-173173- /* prefetch_src((const void *)src); */174174-175175- /* Calculate how to shift a word read at the memory operation176176- aligned srcp to make it aligned for copy. */177177- sh_1 = 8 * (src % sizeof(unsigned int));178178- sh_2 = 8 * sizeof(unsigned int) - sh_1;179179-180180- /* Make src aligned by rounding it down. */181181- src &= -sizeof(unsigned int);182182-183183- switch (len % 4)184184- {185185- case 2:186186- /* a1 = ((unsigned int *) src)[0];187187- a2 = ((unsigned int *) src)[1]; */188188- ldw(s_space, 0, src, a1, cda_ldw_exc);189189- ldw(s_space, 4, src, a2, cda_ldw_exc);190190- src -= 1 * sizeof(unsigned int);191191- dst -= 3 * sizeof(unsigned int);192192- len += 2;193193- goto do1;194194- case 3:195195- /* a0 = ((unsigned int *) src)[0];196196- a1 = ((unsigned int *) src)[1]; */197197- ldw(s_space, 0, src, a0, cda_ldw_exc);198198- ldw(s_space, 4, src, a1, cda_ldw_exc);199199- src -= 0 * sizeof(unsigned int);200200- dst -= 2 * sizeof(unsigned int);201201- len += 1;202202- goto do2;203203- case 0:204204- if (len == 0)205205- return PA_MEMCPY_OK;206206- /* a3 = ((unsigned int *) src)[0];207207- a0 = ((unsigned int *) src)[1]; */208208- ldw(s_space, 0, src, a3, cda_ldw_exc);209209- ldw(s_space, 4, src, a0, cda_ldw_exc);210210- src -=-1 * sizeof(unsigned int);211211- dst -= 1 * sizeof(unsigned int);212212- len += 0;213213- goto do3;214214- case 1:215215- /* a2 = ((unsigned int *) src)[0];216216- a3 = ((unsigned int *) src)[1]; */217217- ldw(s_space, 0, src, a2, cda_ldw_exc);218218- ldw(s_space, 4, src, a3, cda_ldw_exc);219219- src -=-2 * sizeof(unsigned int);220220- dst -= 0 * sizeof(unsigned int);221221- len -= 1;222222- if (len == 0)223223- goto do0;224224- goto do4; /* No-op. */225225- }226226-227227- do228228- {229229- /* prefetch_src((const void *)(src + 4 * sizeof(unsigned int))); */230230-do4:231231- /* a0 = ((unsigned int *) src)[0]; */232232- ldw(s_space, 0, src, a0, cda_ldw_exc);233233- /* ((unsigned int *) dst)[0] = MERGE (a2, sh_1, a3, sh_2); */234234- stw(d_space, MERGE (a2, sh_1, a3, sh_2), 0, dst, cda_stw_exc);235235-do3:236236- /* a1 = ((unsigned int *) src)[1]; */237237- ldw(s_space, 4, src, a1, cda_ldw_exc);238238- /* ((unsigned int *) dst)[1] = MERGE (a3, sh_1, a0, sh_2); */239239- stw(d_space, MERGE (a3, sh_1, a0, sh_2), 4, dst, cda_stw_exc);240240-do2:241241- /* a2 = ((unsigned int *) src)[2]; */242242- ldw(s_space, 8, src, a2, cda_ldw_exc);243243- /* ((unsigned int *) dst)[2] = MERGE (a0, sh_1, a1, sh_2); */244244- stw(d_space, MERGE (a0, sh_1, a1, sh_2), 8, dst, cda_stw_exc);245245-do1:246246- /* a3 = ((unsigned int *) src)[3]; */247247- ldw(s_space, 12, src, a3, cda_ldw_exc);248248- /* ((unsigned int *) dst)[3] = MERGE (a1, sh_1, a2, sh_2); */249249- stw(d_space, MERGE (a1, sh_1, a2, sh_2), 12, dst, cda_stw_exc);250250-251251- src += 4 * sizeof(unsigned int);252252- dst += 4 * sizeof(unsigned int);253253- len -= 4;254254- }255255- while (len != 0);256256-257257-do0:258258- /* ((unsigned int *) dst)[0] = MERGE (a2, sh_1, a3, sh_2); */259259- stw(d_space, MERGE (a2, sh_1, a3, sh_2), 0, dst, cda_stw_exc);260260-261261- preserve_branch(handle_load_error);262262- preserve_branch(handle_store_error);263263-264264- return PA_MEMCPY_OK;265265-266266-handle_load_error:267267- __asm__ __volatile__ ("cda_ldw_exc:\n");268268- return PA_MEMCPY_LOAD_ERROR;269269-270270-handle_store_error:271271- __asm__ __volatile__ ("cda_stw_exc:\n");272272- return PA_MEMCPY_STORE_ERROR;273273-}274274-275275-276276-/* Returns PA_MEMCPY_OK, PA_MEMCPY_LOAD_ERROR or PA_MEMCPY_STORE_ERROR.277277- * In case of an access fault the faulty address can be read from the per_cpu278278- * exception data struct. */279279-static noinline unsigned long pa_memcpy_internal(void *dstp, const void *srcp,280280- unsigned long len)281281-{282282- register unsigned long src, dst, t1, t2, t3;283283- register unsigned char *pcs, *pcd;284284- register unsigned int *pws, *pwd;285285- register double *pds, *pdd;286286- unsigned long ret;287287-288288- src = (unsigned long)srcp;289289- dst = (unsigned long)dstp;290290- pcs = (unsigned char *)srcp;291291- pcd = (unsigned char *)dstp;292292-293293- /* prefetch_src((const void *)srcp); */294294-295295- if (len < THRESHOLD)296296- goto byte_copy;297297-298298- /* Check alignment */299299- t1 = (src ^ dst);300300- if (unlikely(t1 & (sizeof(double)-1)))301301- goto unaligned_copy;302302-303303- /* src and dst have same alignment. */304304-305305- /* Copy bytes till we are double-aligned. */306306- t2 = src & (sizeof(double) - 1);307307- if (unlikely(t2 != 0)) {308308- t2 = sizeof(double) - t2;309309- while (t2 && len) {310310- /* *pcd++ = *pcs++; */311311- ldbma(s_space, pcs, t3, pmc_load_exc);312312- len--;313313- stbma(d_space, t3, pcd, pmc_store_exc);314314- t2--;315315- }316316- }317317-318318- pds = (double *)pcs;319319- pdd = (double *)pcd;320320-321321-#if 0322322- /* Copy 8 doubles at a time */323323- while (len >= 8*sizeof(double)) {324324- register double r1, r2, r3, r4, r5, r6, r7, r8;325325- /* prefetch_src((char *)pds + L1_CACHE_BYTES); */326326- flddma(s_space, pds, r1, pmc_load_exc);327327- flddma(s_space, pds, r2, pmc_load_exc);328328- flddma(s_space, pds, r3, pmc_load_exc);329329- flddma(s_space, pds, r4, pmc_load_exc);330330- fstdma(d_space, r1, pdd, pmc_store_exc);331331- fstdma(d_space, r2, pdd, pmc_store_exc);332332- fstdma(d_space, r3, pdd, pmc_store_exc);333333- fstdma(d_space, r4, pdd, pmc_store_exc);334334-335335-#if 0336336- if (L1_CACHE_BYTES <= 32)337337- prefetch_src((char *)pds + L1_CACHE_BYTES);338338-#endif339339- flddma(s_space, pds, r5, pmc_load_exc);340340- flddma(s_space, pds, r6, pmc_load_exc);341341- flddma(s_space, pds, r7, pmc_load_exc);342342- flddma(s_space, pds, r8, pmc_load_exc);343343- fstdma(d_space, r5, pdd, pmc_store_exc);344344- fstdma(d_space, r6, pdd, pmc_store_exc);345345- fstdma(d_space, r7, pdd, pmc_store_exc);346346- fstdma(d_space, r8, pdd, pmc_store_exc);347347- len -= 8*sizeof(double);348348- }349349-#endif350350-351351- pws = (unsigned int *)pds;352352- pwd = (unsigned int *)pdd;353353-354354-word_copy:355355- while (len >= 8*sizeof(unsigned int)) {356356- register unsigned int r1,r2,r3,r4,r5,r6,r7,r8;357357- /* prefetch_src((char *)pws + L1_CACHE_BYTES); */358358- ldwma(s_space, pws, r1, pmc_load_exc);359359- ldwma(s_space, pws, r2, pmc_load_exc);360360- ldwma(s_space, pws, r3, pmc_load_exc);361361- ldwma(s_space, pws, r4, pmc_load_exc);362362- stwma(d_space, r1, pwd, pmc_store_exc);363363- stwma(d_space, r2, pwd, pmc_store_exc);364364- stwma(d_space, r3, pwd, pmc_store_exc);365365- stwma(d_space, r4, pwd, pmc_store_exc);366366-367367- ldwma(s_space, pws, r5, pmc_load_exc);368368- ldwma(s_space, pws, r6, pmc_load_exc);369369- ldwma(s_space, pws, r7, pmc_load_exc);370370- ldwma(s_space, pws, r8, pmc_load_exc);371371- stwma(d_space, r5, pwd, pmc_store_exc);372372- stwma(d_space, r6, pwd, pmc_store_exc);373373- stwma(d_space, r7, pwd, pmc_store_exc);374374- stwma(d_space, r8, pwd, pmc_store_exc);375375- len -= 8*sizeof(unsigned int);376376- }377377-378378- while (len >= 4*sizeof(unsigned int)) {379379- register unsigned int r1,r2,r3,r4;380380- ldwma(s_space, pws, r1, pmc_load_exc);381381- ldwma(s_space, pws, r2, pmc_load_exc);382382- ldwma(s_space, pws, r3, pmc_load_exc);383383- ldwma(s_space, pws, r4, pmc_load_exc);384384- stwma(d_space, r1, pwd, pmc_store_exc);385385- stwma(d_space, r2, pwd, pmc_store_exc);386386- stwma(d_space, r3, pwd, pmc_store_exc);387387- stwma(d_space, r4, pwd, pmc_store_exc);388388- len -= 4*sizeof(unsigned int);389389- }390390-391391- pcs = (unsigned char *)pws;392392- pcd = (unsigned char *)pwd;393393-394394-byte_copy:395395- while (len) {396396- /* *pcd++ = *pcs++; */397397- ldbma(s_space, pcs, t3, pmc_load_exc);398398- stbma(d_space, t3, pcd, pmc_store_exc);399399- len--;400400- }401401-402402- return PA_MEMCPY_OK;403403-404404-unaligned_copy:405405- /* possibly we are aligned on a word, but not on a double... */406406- if (likely((t1 & (sizeof(unsigned int)-1)) == 0)) {407407- t2 = src & (sizeof(unsigned int) - 1);408408-409409- if (unlikely(t2 != 0)) {410410- t2 = sizeof(unsigned int) - t2;411411- while (t2) {412412- /* *pcd++ = *pcs++; */413413- ldbma(s_space, pcs, t3, pmc_load_exc);414414- stbma(d_space, t3, pcd, pmc_store_exc);415415- len--;416416- t2--;417417- }418418- }419419-420420- pws = (unsigned int *)pcs;421421- pwd = (unsigned int *)pcd;422422- goto word_copy;423423- }424424-425425- /* Align the destination. */426426- if (unlikely((dst & (sizeof(unsigned int) - 1)) != 0)) {427427- t2 = sizeof(unsigned int) - (dst & (sizeof(unsigned int) - 1));428428- while (t2) {429429- /* *pcd++ = *pcs++; */430430- ldbma(s_space, pcs, t3, pmc_load_exc);431431- stbma(d_space, t3, pcd, pmc_store_exc);432432- len--;433433- t2--;434434- }435435- dst = (unsigned long)pcd;436436- src = (unsigned long)pcs;437437- }438438-439439- ret = copy_dstaligned(dst, src, len / sizeof(unsigned int));440440- if (ret)441441- return ret;442442-443443- pcs += (len & -sizeof(unsigned int));444444- pcd += (len & -sizeof(unsigned int));445445- len %= sizeof(unsigned int);446446-447447- preserve_branch(handle_load_error);448448- preserve_branch(handle_store_error);449449-450450- goto byte_copy;451451-452452-handle_load_error:453453- __asm__ __volatile__ ("pmc_load_exc:\n");454454- return PA_MEMCPY_LOAD_ERROR;455455-456456-handle_store_error:457457- __asm__ __volatile__ ("pmc_store_exc:\n");458458- return PA_MEMCPY_STORE_ERROR;459459-}460460-461461-46235/* Returns 0 for success, otherwise, returns number of bytes not transferred. */463463-static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)464464-{465465- unsigned long ret, fault_addr, reference;466466- struct exception_data *d;3636+extern unsigned long pa_memcpy(void *dst, const void *src,3737+ unsigned long len);46738468468- ret = pa_memcpy_internal(dstp, srcp, len);469469- if (likely(ret == PA_MEMCPY_OK))470470- return 0;471471-472472- /* if a load or store fault occured we can get the faulty addr */473473- d = this_cpu_ptr(&exception_data);474474- fault_addr = d->fault_addr;475475-476476- /* error in load or store? */477477- if (ret == PA_MEMCPY_LOAD_ERROR)478478- reference = (unsigned long) srcp;479479- else480480- reference = (unsigned long) dstp;481481-482482- DPRINTF("pa_memcpy: fault type = %lu, len=%lu fault_addr=%lu ref=%lu\n",483483- ret, len, fault_addr, reference);484484-485485- if (fault_addr >= reference)486486- return len - (fault_addr - reference);487487- else488488- return len;489489-}490490-491491-#ifdef __KERNEL__49239unsigned long __copy_to_user(void __user *dst, const void *src,49340 unsigned long len)49441{···8453785538 return __probe_kernel_read(dst, src, size);86539}8787-8888-#endif
+17
arch/parisc/mm/fault.c
···150150 d->fault_space = regs->isr;151151 d->fault_addr = regs->ior;152152153153+ /*154154+ * Fix up get_user() and put_user().155155+ * ASM_EXCEPTIONTABLE_ENTRY_EFAULT() sets the least-significant156156+ * bit in the relative address of the fixup routine to indicate157157+ * that %r8 should be loaded with -EFAULT to report a userspace158158+ * access error.159159+ */160160+ if (fix->fixup & 1) {161161+ regs->gr[8] = -EFAULT;162162+163163+ /* zero target register for get_user() */164164+ if (parisc_acctyp(0, regs->iir) == VM_READ) {165165+ int treg = regs->iir & 0x1f;166166+ regs->gr[treg] = 0;167167+ }168168+ }169169+153170 regs->iaoq[0] = (unsigned long)&fix->fixup + fix->fixup;154171 regs->iaoq[0] &= ~3;155172 /*
+3
arch/powerpc/crypto/crc32c-vpmsum_glue.c
···3333 }34343535 if (len & ~VMX_ALIGN_MASK) {3636+ preempt_disable();3637 pagefault_disable();3738 enable_kernel_altivec();3839 crc = __crc32c_vpmsum(crc, p, len & ~VMX_ALIGN_MASK);4040+ disable_kernel_altivec();3941 pagefault_enable();4242+ preempt_enable();4043 }41444245 tail = len & VMX_ALIGN_MASK;
+19-8
arch/powerpc/kernel/align.c
···807807 nb = aligninfo[instr].len;808808 flags = aligninfo[instr].flags;809809810810- /* ldbrx/stdbrx overlap lfs/stfs in the DSISR unfortunately */811811- if (IS_XFORM(instruction) && ((instruction >> 1) & 0x3ff) == 532) {812812- nb = 8;813813- flags = LD+SW;814814- } else if (IS_XFORM(instruction) &&815815- ((instruction >> 1) & 0x3ff) == 660) {816816- nb = 8;817817- flags = ST+SW;810810+ /*811811+ * Handle some cases which give overlaps in the DSISR values.812812+ */813813+ if (IS_XFORM(instruction)) {814814+ switch (get_xop(instruction)) {815815+ case 532: /* ldbrx */816816+ nb = 8;817817+ flags = LD+SW;818818+ break;819819+ case 660: /* stdbrx */820820+ nb = 8;821821+ flags = ST+SW;822822+ break;823823+ case 20: /* lwarx */824824+ case 84: /* ldarx */825825+ case 116: /* lharx */826826+ case 276: /* lqarx */827827+ return 0; /* not emulated ever */828828+ }818829 }819830820831 /* Byteswap little endian loads and stores */
+2-2
arch/powerpc/kernel/misc_64.S
···6767 * flush all bytes from start through stop-1 inclusive6868 */69697070-_GLOBAL(flush_icache_range)7070+_GLOBAL_TOC(flush_icache_range)7171BEGIN_FTR_SECTION7272 PURGE_PREFETCHED_INS7373 blr···120120 *121121 * flush all bytes from start to stop-1 inclusive122122 */123123-_GLOBAL(flush_dcache_range)123123+_GLOBAL_TOC(flush_dcache_range)124124125125/*126126 * Flush the data cache to memory
+9
arch/powerpc/kernel/setup_64.c
···236236 mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);237237 }238238239239+ /*240240+ * Fixup HFSCR:TM based on CPU features. The bit is set by our241241+ * early asm init because at that point we haven't updated our242242+ * CPU features from firmware and device-tree. Here we have,243243+ * so let's do it.244244+ */245245+ if (cpu_has_feature(CPU_FTR_HVMODE) && !cpu_has_feature(CPU_FTR_TM_COMP))246246+ mtspr(SPRN_HFSCR, mfspr(SPRN_HFSCR) & ~HFSCR_TM);247247+239248 /* Set IR and DR in PACA MSR */240249 get_paca()->kernel_msr = MSR_KERNEL;241250}
+4
arch/powerpc/kvm/book3s_64_mmu_hv.c
···14871487 /* start new resize */1488148814891489 resize = kzalloc(sizeof(*resize), GFP_KERNEL);14901490+ if (!resize) {14911491+ ret = -ENOMEM;14921492+ goto out;14931493+ }14901494 resize->order = shift;14911495 resize->kvm = kvm;14921496 INIT_WORK(&resize->work, resize_hpt_prepare_work);
+5-2
arch/powerpc/mm/hash_native_64.c
···638638 unsigned long psize = batch->psize;639639 int ssize = batch->ssize;640640 int i;641641+ unsigned int use_local;642642+643643+ use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&644644+ mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();641645642646 local_irq_save(flags);643647···671667 } pte_iterate_hashed_end();672668 }673669674674- if (mmu_has_feature(MMU_FTR_TLBIEL) &&675675- mmu_psize_defs[psize].tlbiel && local) {670670+ if (use_local) {676671 asm volatile("ptesync":::"memory");677672 for (i = 0; i < number; i++) {678673 vpn = batch->vpn[i];
+19-16
arch/s390/boot/compressed/misc.c
···141141142142unsigned long decompress_kernel(void)143143{144144- unsigned long output_addr;145145- unsigned char *output;144144+ void *output, *kernel_end;146145147147- output_addr = ((unsigned long) &_end + HEAP_SIZE + 4095UL) & -4096UL;148148- check_ipl_parmblock((void *) 0, output_addr + SZ__bss_start);149149- memset(&_bss, 0, &_ebss - &_bss);150150- free_mem_ptr = (unsigned long)&_end;151151- free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;152152- output = (unsigned char *) output_addr;146146+ output = (void *) ALIGN((unsigned long) &_end + HEAP_SIZE, PAGE_SIZE);147147+ kernel_end = output + SZ__bss_start;148148+ check_ipl_parmblock((void *) 0, (unsigned long) kernel_end);153149154150#ifdef CONFIG_BLK_DEV_INITRD155151 /*156152 * Move the initrd right behind the end of the decompressed157157- * kernel image.153153+ * kernel image. This also prevents initrd corruption caused by154154+ * bss clearing since kernel_end will always be located behind the155155+ * current bss section..158156 */159159- if (INITRD_START && INITRD_SIZE &&160160- INITRD_START < (unsigned long) output + SZ__bss_start) {161161- check_ipl_parmblock(output + SZ__bss_start,162162- INITRD_START + INITRD_SIZE);163163- memmove(output + SZ__bss_start,164164- (void *) INITRD_START, INITRD_SIZE);165165- INITRD_START = (unsigned long) output + SZ__bss_start;157157+ if (INITRD_START && INITRD_SIZE && kernel_end > (void *) INITRD_START) {158158+ check_ipl_parmblock(kernel_end, INITRD_SIZE);159159+ memmove(kernel_end, (void *) INITRD_START, INITRD_SIZE);160160+ INITRD_START = (unsigned long) kernel_end;166161 }167162#endif163163+164164+ /*165165+ * Clear bss section. free_mem_ptr and free_mem_end_ptr need to be166166+ * initialized afterwards since they reside in bss.167167+ */168168+ memset(&_bss, 0, &_ebss - &_bss);169169+ free_mem_ptr = (unsigned long) &_end;170170+ free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;168171169172 puts("Uncompressing Linux... ");170173 __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
···1818#include <asm/signal.h>1919#include <asm/page.h>20202121-/*2222- * The sparc has no problems with write protection2323- */2424-#define wp_works_ok 12525-#define wp_works_ok__is_a_macro /* for versions in ksyms.c */2626-2721/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...2822 * That one page is used to protect kernel from intruders, so that2923 * we can make our access_ok test faster
-4
arch/sparc/include/asm/processor_64.h
···1818#include <asm/ptrace.h>1919#include <asm/page.h>20202121-/* The sparc has no problems with write protection */2222-#define wp_works_ok 12323-#define wp_works_ok__is_a_macro /* for versions in ksyms.c */2424-2521/*2622 * User lives in his very own context, and cannot reference us. Note2723 * that TASK_SIZE is a misnomer, it really gives maximum user virtual
···351351 }352352353353 if (!ret) {354354- unsigned long y;354354+ unsigned long y = regs->y;355355356356 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,357357 &y,
···122122123123 spin_lock_irqsave(&mm->context.lock, flags);124124125125- if (tb->hugepage_shift < HPAGE_SHIFT) {125125+ if (tb->hugepage_shift < REAL_HPAGE_SHIFT) {126126 base = (unsigned long) mm->context.tsb_block[MM_TSB_BASE].tsb;127127 nentries = mm->context.tsb_block[MM_TSB_BASE].tsb_nentries;128128 if (tlb_type == cheetah_plus || tlb_type == hypervisor)···155155156156 spin_lock_irqsave(&mm->context.lock, flags);157157158158- if (hugepage_shift < HPAGE_SHIFT) {158158+ if (hugepage_shift < REAL_HPAGE_SHIFT) {159159 base = (unsigned long) mm->context.tsb_block[MM_TSB_BASE].tsb;160160 nentries = mm->context.tsb_block[MM_TSB_BASE].tsb_nentries;161161 if (tlb_type == cheetah_plus || tlb_type == hypervisor)
+31-4
arch/x86/Makefile
···120120 # -funit-at-a-time shrinks the kernel .text considerably121121 # unfortunately it makes reading oopses harder.122122 KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)123123-124124- # this works around some issues with generating unwind tables in older gccs125125- # newer gccs do it by default126126- KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args)127123endif128124129125ifdef CONFIG_X86_X32···141145# Don't unroll struct assignments with kmemcheck enabled142146ifeq ($(CONFIG_KMEMCHECK),y)143147 KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)148148+endif149149+150150+#151151+# If the function graph tracer is used with mcount instead of fentry,152152+# '-maccumulate-outgoing-args' is needed to prevent a GCC bug153153+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109)154154+#155155+ifdef CONFIG_FUNCTION_GRAPH_TRACER156156+ ifndef CONFIG_HAVE_FENTRY157157+ ACCUMULATE_OUTGOING_ARGS := 1158158+ else159159+ ifeq ($(call cc-option-yn, -mfentry), n)160160+ ACCUMULATE_OUTGOING_ARGS := 1161161+ endif162162+ endif163163+endif164164+165165+#166166+# Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a167167+# GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226). There's no way168168+# to test for this bug at compile-time because the test case needs to execute,169169+# which is a no-go for cross compilers. So check the GCC version instead.170170+#171171+ifdef CONFIG_JUMP_LABEL172172+ ifneq ($(ACCUMULATE_OUTGOING_ARGS), 1)173173+ ACCUMULATE_OUTGOING_ARGS = $(call cc-if-fullversion, -lt, 040502, 1)174174+ endif175175+endif176176+177177+ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)178178+ KBUILD_CFLAGS += -maccumulate-outgoing-args144179endif145180146181# Stackpointer is addressed different for 32 bit and 64 bit x86
-18
arch/x86/Makefile_32.cpu
···4545# cpu entries4646cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686))47474848-# Work around the pentium-mmx code generator madness of gcc4.4.x which4949-# does stack alignment by generating horrible code _before_ the mcount5050-# prologue (push %ebp, mov %esp, %ebp) which breaks the function graph5151-# tracer assumptions. For i686, generic, core2 this is set by the5252-# compiler anyway5353-ifeq ($(CONFIG_FUNCTION_GRAPH_TRACER), y)5454-ADD_ACCUMULATE_OUTGOING_ARGS := y5555-endif5656-5757-# Work around to a bug with asm goto with first implementations of it5858-# in gcc causing gcc to mess up the push and pop of the stack in some5959-# uses of asm goto.6060-ifeq ($(CONFIG_JUMP_LABEL), y)6161-ADD_ACCUMULATE_OUTGOING_ARGS := y6262-endif6363-6464-cflags-$(ADD_ACCUMULATE_OUTGOING_ARGS) += $(call cc-option,-maccumulate-outgoing-args)6565-6648# Bug fix for binutils: this option is required in order to keep6749# binutils from generating NOPL instructions against our will.6850ifneq ($(CONFIG_X86_P6_NOP),y)
+1
arch/x86/boot/compressed/error.c
···44 * memcpy() and memmove() are defined for the compressed boot environment.55 */66#include "misc.h"77+#include "error.h"7889void warn(char *m)910{
+6-3
arch/x86/events/core.c
···22562256 struct perf_event_mmap_page *userpg, u64 now)22572257{22582258 struct cyc2ns_data *data;22592259+ u64 offset;2259226022602261 userpg->cap_user_time = 0;22612262 userpg->cap_user_time_zero = 0;···22642263 !!(event->hw.flags & PERF_X86_EVENT_RDPMC_ALLOWED);22652264 userpg->pmc_width = x86_pmu.cntval_bits;2266226522672267- if (!sched_clock_stable())22662266+ if (!using_native_sched_clock() || !sched_clock_stable())22682267 return;2269226822702269 data = cyc2ns_read_begin();22702270+22712271+ offset = data->cyc2ns_offset + __sched_clock_offset;2271227222722273 /*22732274 * Internal timekeeping for enabled/running/stopped times···22782275 userpg->cap_user_time = 1;22792276 userpg->time_mult = data->cyc2ns_mul;22802277 userpg->time_shift = data->cyc2ns_shift;22812281- userpg->time_offset = data->cyc2ns_offset - now;22782278+ userpg->time_offset = offset - now;2282227922832280 /*22842281 * cap_user_time_zero doesn't make sense when we're using a different···22862283 */22872284 if (!event->attr.use_clockid) {22882285 userpg->cap_user_time_zero = 1;22892289- userpg->time_zero = data->cyc2ns_offset;22862286+ userpg->time_zero = offset;22902287 }2291228822922289 cyc2ns_read_end(data);
+2
arch/x86/include/asm/timer.h
···12121313extern int no_timer_check;14141515+extern bool using_native_sched_clock(void);1616+1517/*1618 * We use the full linear equation: f(x) = a + b*x, in order to allow1719 * a continuous function in the face of dynamic freq changes.
···54545555static DEFINE_MUTEX(mce_chrdev_read_mutex);56565757+static int mce_chrdev_open_count; /* #times opened */5858+5759#define mce_log_get_idx_check(p) \5860({ \5961 RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \···598596 * notifier and us registered.599597 */600598 if (atomic_read(&num_notifiers) > 2)599599+ return NOTIFY_DONE;600600+601601+ /* Don't print when mcelog is running */602602+ if (mce_chrdev_open_count > 0)601603 return NOTIFY_DONE;602604603605 __print_mce(m);···18341828 */1835182918361830static DEFINE_SPINLOCK(mce_chrdev_state_lock);18371837-static int mce_chrdev_open_count; /* #times opened */18381831static int mce_chrdev_open_exclu; /* already open exclusive? */1839183218401833static int mce_chrdev_open(struct inode *inode, struct file *file)
···81988198 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);81998199 case EXIT_REASON_PREEMPTION_TIMER:82008200 return false;82018201+ case EXIT_REASON_PML_FULL:82028202+ /* We don't expose PML support to L1. */82038203+ return false;82018204 default:82028205 return true;82038206 }···1026810265 vmx_flush_tlb(vcpu);1026910266 }10270102671026810268+ }1026910269+1027010270+ if (enable_pml) {1027110271+ /*1027210272+ * Conceptually we want to copy the PML address and index from1027310273+ * vmcs01 here, and then back to vmcs01 on nested vmexit. But,1027410274+ * since we always flush the log on each vmexit, this happens1027510275+ * to be equivalent to simply resetting the fields in vmcs02.1027610276+ */1027710277+ ASSERT(vmx->pml_pg);1027810278+ vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg));1027910279+ vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1);1027110280 }10272102811027310282 if (nested_cpu_has_ept(vmcs12)) {
···88LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib99targets += purgatory.ro10101111+KASAN_SANITIZE := n1112KCOV_INSTRUMENT := n12131314# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
+13
arch/xtensa/include/asm/page.h
···164164165165#define ARCH_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)166166167167+#ifdef CONFIG_MMU168168+static inline unsigned long ___pa(unsigned long va)169169+{170170+ unsigned long off = va - PAGE_OFFSET;171171+172172+ if (off >= XCHAL_KSEG_SIZE)173173+ off -= XCHAL_KSEG_SIZE;174174+175175+ return off + PHYS_OFFSET;176176+}177177+#define __pa(x) ___pa((unsigned long)(x))178178+#else167179#define __pa(x) \168180 ((unsigned long) (x) - PAGE_OFFSET + PHYS_OFFSET)181181+#endif169182#define __va(x) \170183 ((void *)((unsigned long) (x) - PHYS_OFFSET + PAGE_OFFSET))171184#define pfn_valid(pfn) \
···816816817817 if (q->elevator) {818818 ioc_clear_queue(q);819819- elevator_exit(q->elevator);819819+ elevator_exit(q, q->elevator);820820 }821821822822 blk_exit_rl(&q->root_rl);
+59-55
block/elevator.c
···242242 }243243 }244244245245- if (e->uses_mq) {246246- err = blk_mq_sched_setup(q);247247- if (!err)248248- err = e->ops.mq.init_sched(q, e);249249- } else245245+ if (e->uses_mq)246246+ err = blk_mq_init_sched(q, e);247247+ else250248 err = e->ops.sq.elevator_init_fn(q, e);251251- if (err) {252252- if (e->uses_mq)253253- blk_mq_sched_teardown(q);249249+ if (err)254250 elevator_put(e);255255- }256251 return err;257252}258253EXPORT_SYMBOL(elevator_init);259254260260-void elevator_exit(struct elevator_queue *e)255255+void elevator_exit(struct request_queue *q, struct elevator_queue *e)261256{262257 mutex_lock(&e->sysfs_lock);263258 if (e->uses_mq && e->type->ops.mq.exit_sched)264264- e->type->ops.mq.exit_sched(e);259259+ blk_mq_exit_sched(q, e);265260 else if (!e->uses_mq && e->type->ops.sq.elevator_exit_fn)266261 e->type->ops.sq.elevator_exit_fn(e);267262 mutex_unlock(&e->sysfs_lock);···941946}942947EXPORT_SYMBOL_GPL(elv_unregister);943948949949+static int elevator_switch_mq(struct request_queue *q,950950+ struct elevator_type *new_e)951951+{952952+ int ret;953953+954954+ blk_mq_freeze_queue(q);955955+ blk_mq_quiesce_queue(q);956956+957957+ if (q->elevator) {958958+ if (q->elevator->registered)959959+ elv_unregister_queue(q);960960+ ioc_clear_queue(q);961961+ elevator_exit(q, q->elevator);962962+ }963963+964964+ ret = blk_mq_init_sched(q, new_e);965965+ if (ret)966966+ goto out;967967+968968+ if (new_e) {969969+ ret = elv_register_queue(q);970970+ if (ret) {971971+ elevator_exit(q, q->elevator);972972+ goto out;973973+ }974974+ }975975+976976+ if (new_e)977977+ blk_add_trace_msg(q, "elv switch: %s", new_e->elevator_name);978978+ else979979+ blk_add_trace_msg(q, "elv switch: none");980980+981981+out:982982+ blk_mq_unfreeze_queue(q);983983+ blk_mq_start_stopped_hw_queues(q, true);984984+ return ret;985985+986986+}987987+944988/*945989 * switch to new_e io scheduler. be careful not to introduce deadlocks -946990 * we don't free the old io scheduler, before we have allocated what we···992958 bool old_registered = false;993959 int err;994960995995- if (q->mq_ops) {996996- blk_mq_freeze_queue(q);997997- blk_mq_quiesce_queue(q);998998- }961961+ if (q->mq_ops)962962+ return elevator_switch_mq(q, new_e);9999631000964 /*1001965 * Turn on BYPASS and drain all requests w/ elevator private data.···1005973 if (old) {1006974 old_registered = old->registered;100797510081008- if (old->uses_mq)10091009- blk_mq_sched_teardown(q);10101010-10111011- if (!q->mq_ops)10121012- blk_queue_bypass_start(q);976976+ blk_queue_bypass_start(q);10139771014978 /* unregister and clear all auxiliary data of the old elevator */1015979 if (old_registered)···1015987 }10169881017989 /* allocate, init and register new elevator */10181018- if (new_e) {10191019- if (new_e->uses_mq) {10201020- err = blk_mq_sched_setup(q);10211021- if (!err)10221022- err = new_e->ops.mq.init_sched(q, new_e);10231023- } else10241024- err = new_e->ops.sq.elevator_init_fn(q, new_e);10251025- if (err)10261026- goto fail_init;990990+ err = new_e->ops.sq.elevator_init_fn(q, new_e);991991+ if (err)992992+ goto fail_init;102799310281028- err = elv_register_queue(q);10291029- if (err)10301030- goto fail_register;10311031- } else10321032- q->elevator = NULL;994994+ err = elv_register_queue(q);995995+ if (err)996996+ goto fail_register;10339971034998 /* done, kill the old one and finish */1035999 if (old) {10361036- elevator_exit(old);10371037- if (!q->mq_ops)10381038- blk_queue_bypass_end(q);10001000+ elevator_exit(q, old);10011001+ blk_queue_bypass_end(q);10391002 }1040100310411041- if (q->mq_ops) {10421042- blk_mq_unfreeze_queue(q);10431043- blk_mq_start_stopped_hw_queues(q, true);10441044- }10451045-10461046- if (new_e)10471047- blk_add_trace_msg(q, "elv switch: %s", new_e->elevator_name);10481048- else10491049- blk_add_trace_msg(q, "elv switch: none");10041004+ blk_add_trace_msg(q, "elv switch: %s", new_e->elevator_name);1050100510511006 return 0;1052100710531008fail_register:10541054- if (q->mq_ops)10551055- blk_mq_sched_teardown(q);10561056- elevator_exit(q->elevator);10091009+ elevator_exit(q, q->elevator);10571010fail_init:10581011 /* switch failed, restore and re-register old elevator */10591012 if (old) {10601013 q->elevator = old;10611014 elv_register_queue(q);10621062- if (!q->mq_ops)10631063- blk_queue_bypass_end(q);10641064- }10651065- if (q->mq_ops) {10661066- blk_mq_unfreeze_queue(q);10671067- blk_mq_start_stopped_hw_queues(q, true);10151015+ blk_queue_bypass_end(q);10681016 }1069101710701018 return err;
+5-2
crypto/lrw.c
···286286287287 subreq->cryptlen = LRW_BUFFER_SIZE;288288 if (req->cryptlen > LRW_BUFFER_SIZE) {289289- subreq->cryptlen = min(req->cryptlen, (unsigned)PAGE_SIZE);290290- rctx->ext = kmalloc(subreq->cryptlen, gfp);289289+ unsigned int n = min(req->cryptlen, (unsigned int)PAGE_SIZE);290290+291291+ rctx->ext = kmalloc(n, gfp);292292+ if (rctx->ext)293293+ subreq->cryptlen = n;291294 }292295293296 rctx->src = req->src;
+5-2
crypto/xts.c
···230230231231 subreq->cryptlen = XTS_BUFFER_SIZE;232232 if (req->cryptlen > XTS_BUFFER_SIZE) {233233- subreq->cryptlen = min(req->cryptlen, (unsigned)PAGE_SIZE);234234- rctx->ext = kmalloc(subreq->cryptlen, gfp);233233+ unsigned int n = min(req->cryptlen, (unsigned int)PAGE_SIZE);234234+235235+ rctx->ext = kmalloc(n, gfp);236236+ if (rctx->ext)237237+ subreq->cryptlen = n;235238 }236239237240 rctx->src = req->src;
-1
drivers/acpi/Makefile
···22# Makefile for the Linux ACPI interpreter33#4455-ccflags-y := -Os65ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT7687#
···10731073 if (list_empty(&ghes_sci))10741074 unregister_acpi_hed_notifier(&ghes_notifier_sci);10751075 mutex_unlock(&ghes_list_mutex);10761076+ synchronize_rcu();10761077 break;10771078 case ACPI_HEST_NOTIFY_NMI:10781079 ghes_nmi_remove(ghes);
+6-6
drivers/acpi/glue.c
···9999 return -ENODEV;100100101101 /*102102- * If the device has a _HID (or _CID) returning a valid ACPI/PNP103103- * device ID, it is better to make it look less attractive here, so that104104- * the other device with the same _ADR value (that may not have a valid105105- * device ID) can be matched going forward. [This means a second spec106106- * violation in a row, so whatever we do here is best effort anyway.]102102+ * If the device has a _HID returning a valid ACPI/PNP device ID, it is103103+ * better to make it look less attractive here, so that the other device104104+ * with the same _ADR value (that may not have a valid device ID) can be105105+ * matched going forward. [This means a second spec violation in a row,106106+ * so whatever we do here is best effort anyway.]107107 */108108- return sta_present && list_empty(&adev->pnp.ids) ?108108+ return sta_present && !adev->pnp.type.platform_id ?109109 FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;110110}111111
+6
drivers/acpi/ioapic.c
···4545 struct resource *res = data;4646 struct resource_win win;47474848+ /*4949+ * We might assign this to 'res' later, make sure all pointers are5050+ * cleared before the resource is added to the global list5151+ */5252+ memset(&win, 0, sizeof(win));5353+4854 res->flags = 0;4955 if (acpi_dev_filter_resource_type(acpi_res, IORESOURCE_MEM))5056 return AE_OK;
+103-33
drivers/block/nbd.c
···4747struct nbd_sock {4848 struct socket *sock;4949 struct mutex tx_lock;5050+ struct request *pending;5151+ int sent;5052};51535254#define NBD_TIMEDOUT 0···126124127125static int nbd_size_clear(struct nbd_device *nbd, struct block_device *bdev)128126{129129- bd_set_size(bdev, 0);127127+ if (bdev->bd_openers <= 1)128128+ bd_set_size(bdev, 0);130129 set_capacity(nbd->disk, 0);131130 kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);132131···193190194191 dev_err(nbd_to_dev(nbd), "Connection timed out, shutting down connection\n");195192 set_bit(NBD_TIMEDOUT, &nbd->runtime_flags);196196- req->errors++;193193+ req->errors = -EIO;197194198195 mutex_lock(&nbd->config_lock);199196 sock_shutdown(nbd);···205202 * Send or receive packet.206203 */207204static int sock_xmit(struct nbd_device *nbd, int index, int send,208208- struct iov_iter *iter, int msg_flags)205205+ struct iov_iter *iter, int msg_flags, int *sent)209206{210207 struct socket *sock = nbd->socks[index]->sock;211208 int result;···240237 result = -EPIPE; /* short read */241238 break;242239 }240240+ if (sent)241241+ *sent += result;243242 } while (msg_data_left(&msg));244243245244 tsk_restore_flags(current, pflags, PF_MEMALLOC);···253248static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)254249{255250 struct request *req = blk_mq_rq_from_pdu(cmd);251251+ struct nbd_sock *nsock = nbd->socks[index];256252 int result;257253 struct nbd_request request = {.magic = htonl(NBD_REQUEST_MAGIC)};258254 struct kvec iov = {.iov_base = &request, .iov_len = sizeof(request)};···262256 struct bio *bio;263257 u32 type;264258 u32 tag = blk_mq_unique_tag(req);259259+ int sent = nsock->sent, skip = 0;265260266261 iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request));267262···290283 return -EIO;291284 }292285286286+ /* We did a partial send previously, and we at least sent the whole287287+ * request struct, so just go and send the rest of the pages in the288288+ * request.289289+ */290290+ if (sent) {291291+ if (sent >= sizeof(request)) {292292+ skip = sent - sizeof(request);293293+ goto send_pages;294294+ }295295+ iov_iter_advance(&from, sent);296296+ }293297 request.type = htonl(type);294298 if (type != NBD_CMD_FLUSH) {295299 request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);···312294 cmd, nbdcmd_to_ascii(type),313295 (unsigned long long)blk_rq_pos(req) << 9, blk_rq_bytes(req));314296 result = sock_xmit(nbd, index, 1, &from,315315- (type == NBD_CMD_WRITE) ? MSG_MORE : 0);297297+ (type == NBD_CMD_WRITE) ? MSG_MORE : 0, &sent);316298 if (result <= 0) {299299+ if (result == -ERESTARTSYS) {300300+ /* If we havne't sent anything we can just return BUSY,301301+ * however if we have sent something we need to make302302+ * sure we only allow this req to be sent until we are303303+ * completely done.304304+ */305305+ if (sent) {306306+ nsock->pending = req;307307+ nsock->sent = sent;308308+ }309309+ return BLK_MQ_RQ_QUEUE_BUSY;310310+ }317311 dev_err_ratelimited(disk_to_dev(nbd->disk),318312 "Send control failed (result %d)\n", result);319313 return -EIO;320314 }321321-315315+send_pages:322316 if (type != NBD_CMD_WRITE)323323- return 0;317317+ goto out;324318325319 bio = req->bio;326320 while (bio) {···348318 cmd, bvec.bv_len);349319 iov_iter_bvec(&from, ITER_BVEC | WRITE,350320 &bvec, 1, bvec.bv_len);351351- result = sock_xmit(nbd, index, 1, &from, flags);321321+ if (skip) {322322+ if (skip >= iov_iter_count(&from)) {323323+ skip -= iov_iter_count(&from);324324+ continue;325325+ }326326+ iov_iter_advance(&from, skip);327327+ skip = 0;328328+ }329329+ result = sock_xmit(nbd, index, 1, &from, flags, &sent);352330 if (result <= 0) {331331+ if (result == -ERESTARTSYS) {332332+ /* We've already sent the header, we333333+ * have no choice but to set pending and334334+ * return BUSY.335335+ */336336+ nsock->pending = req;337337+ nsock->sent = sent;338338+ return BLK_MQ_RQ_QUEUE_BUSY;339339+ }353340 dev_err(disk_to_dev(nbd->disk),354341 "Send data failed (result %d)\n",355342 result);···383336 }384337 bio = next;385338 }339339+out:340340+ nsock->pending = NULL;341341+ nsock->sent = 0;386342 return 0;387343}388344···403353404354 reply.magic = 0;405355 iov_iter_kvec(&to, READ | ITER_KVEC, &iov, 1, sizeof(reply));406406- result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL);356356+ result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);407357 if (result <= 0) {408358 if (!test_bit(NBD_DISCONNECTED, &nbd->runtime_flags) &&409359 !test_bit(NBD_DISCONNECT_REQUESTED, &nbd->runtime_flags))···433383 if (ntohl(reply.error)) {434384 dev_err(disk_to_dev(nbd->disk), "Other side returned error (%d)\n",435385 ntohl(reply.error));436436- req->errors++;386386+ req->errors = -EIO;437387 return cmd;438388 }439389···445395 rq_for_each_segment(bvec, req, iter) {446396 iov_iter_bvec(&to, ITER_BVEC | READ,447397 &bvec, 1, bvec.bv_len);448448- result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL);398398+ result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);449399 if (result <= 0) {450400 dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n",451401 result);452452- req->errors++;402402+ req->errors = -EIO;453403 return cmd;454404 }455405 dev_dbg(nbd_to_dev(nbd), "request %p: got %d bytes data\n",···519469 if (!blk_mq_request_started(req))520470 return;521471 cmd = blk_mq_rq_to_pdu(req);522522- req->errors++;472472+ req->errors = -EIO;523473 nbd_end_request(cmd);524474}525475···532482}533483534484535535-static void nbd_handle_cmd(struct nbd_cmd *cmd, int index)485485+static int nbd_handle_cmd(struct nbd_cmd *cmd, int index)536486{537487 struct request *req = blk_mq_rq_from_pdu(cmd);538488 struct nbd_device *nbd = cmd->nbd;539489 struct nbd_sock *nsock;490490+ int ret;540491541492 if (index >= nbd->num_connections) {542493 dev_err_ratelimited(disk_to_dev(nbd->disk),543494 "Attempted send on invalid socket\n");544544- goto error_out;495495+ return -EINVAL;545496 }546497547498 if (test_bit(NBD_DISCONNECTED, &nbd->runtime_flags)) {548499 dev_err_ratelimited(disk_to_dev(nbd->disk),549500 "Attempted send on closed socket\n");550550- goto error_out;501501+ return -EINVAL;551502 }552503553504 req->errors = 0;···559508 mutex_unlock(&nsock->tx_lock);560509 dev_err_ratelimited(disk_to_dev(nbd->disk),561510 "Attempted send on closed socket\n");562562- goto error_out;511511+ return -EINVAL;563512 }564513565565- if (nbd_send_cmd(nbd, cmd, index) != 0) {566566- dev_err_ratelimited(disk_to_dev(nbd->disk),567567- "Request send failed\n");568568- req->errors++;569569- nbd_end_request(cmd);514514+ /* Handle the case that we have a pending request that was partially515515+ * transmitted that _has_ to be serviced first. We need to call requeue516516+ * here so that it gets put _after_ the request that is already on the517517+ * dispatch list.518518+ */519519+ if (unlikely(nsock->pending && nsock->pending != req)) {520520+ blk_mq_requeue_request(req, true);521521+ ret = 0;522522+ goto out;570523 }571571-524524+ ret = nbd_send_cmd(nbd, cmd, index);525525+out:572526 mutex_unlock(&nsock->tx_lock);573573-574574- return;575575-576576-error_out:577577- req->errors++;578578- nbd_end_request(cmd);527527+ return ret;579528}580529581530static int nbd_queue_rq(struct blk_mq_hw_ctx *hctx,582531 const struct blk_mq_queue_data *bd)583532{584533 struct nbd_cmd *cmd = blk_mq_rq_to_pdu(bd->rq);534534+ int ret;585535586536 /*587537 * Since we look at the bio's to send the request over the network we···595543 */596544 init_completion(&cmd->send_complete);597545 blk_mq_start_request(bd->rq);598598- nbd_handle_cmd(cmd, hctx->queue_num);546546+547547+ /* We can be called directly from the user space process, which means we548548+ * could possibly have signals pending so our sendmsg will fail. In549549+ * this case we need to return that we are busy, otherwise error out as550550+ * appropriate.551551+ */552552+ ret = nbd_handle_cmd(cmd, hctx->queue_num);553553+ if (ret < 0)554554+ ret = BLK_MQ_RQ_QUEUE_ERROR;555555+ if (!ret)556556+ ret = BLK_MQ_RQ_QUEUE_OK;599557 complete(&cmd->send_complete);600558601601- return BLK_MQ_RQ_QUEUE_OK;559559+ return ret;602560}603561604562static int nbd_add_socket(struct nbd_device *nbd, struct block_device *bdev,···643581644582 mutex_init(&nsock->tx_lock);645583 nsock->sock = sock;584584+ nsock->pending = NULL;585585+ nsock->sent = 0;646586 socks[nbd->num_connections++] = nsock;647587648588 if (max_part)···666602667603static void nbd_bdev_reset(struct block_device *bdev)668604{605605+ if (bdev->bd_openers > 1)606606+ return;669607 set_device_ro(bdev, false);670608 bdev->bd_inode->i_size = 0;671609 if (max_part > 0) {···700634701635 for (i = 0; i < nbd->num_connections; i++) {702636 iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request));703703- ret = sock_xmit(nbd, i, 1, &from, 0);637637+ ret = sock_xmit(nbd, i, 1, &from, 0, NULL);704638 if (ret <= 0)705639 dev_err(disk_to_dev(nbd->disk),706640 "Send disconnect failed %d\n", ret);···731665{732666 sock_shutdown(nbd);733667 nbd_clear_que(nbd);734734- kill_bdev(bdev);668668+669669+ __invalidate_device(bdev, true);735670 nbd_bdev_reset(bdev);736671 /*737672 * We want to give the run thread a chance to wait for everybody···848781 nbd_size_set(nbd, bdev, nbd->blksize, arg);849782 return 0;850783 case NBD_SET_TIMEOUT:851851- nbd->tag_set.timeout = arg * HZ;784784+ if (arg) {785785+ nbd->tag_set.timeout = arg * HZ;786786+ blk_queue_rq_timeout(nbd->disk->queue, arg * HZ);787787+ }852788 return 0;853789854790 case NBD_SET_FLAGS:
···918918 .release = cpufreq_sysfs_release,919919};920920921921-static int add_cpu_dev_symlink(struct cpufreq_policy *policy,922922- struct device *dev)921921+static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu)923922{923923+ struct device *dev = get_cpu_device(cpu);924924+925925+ if (!dev)926926+ return;927927+928928+ if (cpumask_test_and_set_cpu(cpu, policy->real_cpus))929929+ return;930930+924931 dev_dbg(dev, "%s: Adding symlink\n", __func__);925925- return sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");932932+ if (sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"))933933+ dev_err(dev, "cpufreq symlink creation failed\n");926934}927935928936static void remove_cpu_dev_symlink(struct cpufreq_policy *policy,···11881180 policy->user_policy.min = policy->min;11891181 policy->user_policy.max = policy->max;1190118211911191- write_lock_irqsave(&cpufreq_driver_lock, flags);11921192- for_each_cpu(j, policy->related_cpus)11831183+ for_each_cpu(j, policy->related_cpus) {11931184 per_cpu(cpufreq_cpu_data, j) = policy;11941194- write_unlock_irqrestore(&cpufreq_driver_lock, flags);11851185+ add_cpu_dev_symlink(policy, j);11861186+ }11951187 } else {11961188 policy->min = policy->user_policy.min;11971189 policy->max = policy->user_policy.max;···1283127512841276 if (cpufreq_driver->exit)12851277 cpufreq_driver->exit(policy);12781278+12791279+ for_each_cpu(j, policy->real_cpus)12801280+ remove_cpu_dev_symlink(policy, get_cpu_device(j));12811281+12861282out_free_policy:12871283 cpufreq_policy_free(policy);12881284 return ret;12891285}12901290-12911291-static int cpufreq_offline(unsigned int cpu);1292128612931287/**12941288 * cpufreq_add_dev - the cpufreq interface for a CPU device.···1313130313141304 /* Create sysfs link on CPU registration */13151305 policy = per_cpu(cpufreq_cpu_data, cpu);13161316- if (!policy || cpumask_test_and_set_cpu(cpu, policy->real_cpus))13171317- return 0;13061306+ if (policy)13071307+ add_cpu_dev_symlink(policy, cpu);1318130813191319- ret = add_cpu_dev_symlink(policy, dev);13201320- if (ret) {13211321- cpumask_clear_cpu(cpu, policy->real_cpus);13221322- cpufreq_offline(cpu);13231323- }13241324-13251325- return ret;13091309+ return 0;13261310}1327131113281312static int cpufreq_offline(unsigned int cpu)
+18
drivers/cpuidle/cpuidle-powernv.c
···175175 drv->state_count += 1;176176 }177177178178+ /*179179+ * On the PowerNV platform cpu_present may be less than cpu_possible in180180+ * cases when firmware detects the CPU, but it is not available to the181181+ * OS. If CONFIG_HOTPLUG_CPU=n, then such CPUs are not hotplugable at182182+ * run time and hence cpu_devices are not created for those CPUs by the183183+ * generic topology_init().184184+ *185185+ * drv->cpumask defaults to cpu_possible_mask in186186+ * __cpuidle_driver_init(). This breaks cpuidle on PowerNV where187187+ * cpu_devices are not created for CPUs in cpu_possible_mask that188188+ * cannot be hot-added later at run time.189189+ *190190+ * Trying cpuidle_register_device() on a CPU without a cpu_device is191191+ * incorrect, so pass a correct CPU mask to the generic cpuidle driver.192192+ */193193+194194+ drv->cpumask = (struct cpumask *)cpu_present_mask;195195+178196 return 0;179197}180198
···179179180180/* ------------------------ General CCP Defines ------------------------ */181181182182+#define CCP_DMA_DFLT 0x0183183+#define CCP_DMA_PRIV 0x1184184+#define CCP_DMA_PUB 0x2185185+182186#define CCP_DMAPOOL_MAX_SIZE 64183187#define CCP_DMAPOOL_ALIGN BIT(5)184188···640636/* Structure to hold CCP version-specific values */641637struct ccp_vdata {642638 const unsigned int version;639639+ const unsigned int dma_chan_attr;643640 void (*setup)(struct ccp_device *);644641 const struct ccp_actions *perform;645642 const unsigned int bar;
+41
drivers/crypto/ccp/ccp-dmaengine.c
···1010 * published by the Free Software Foundation.1111 */12121313+#include <linux/module.h>1314#include <linux/kernel.h>1415#include <linux/dmaengine.h>1516#include <linux/spinlock.h>···2524 u64 mask = _mask + 1; \2625 (mask == 0) ? 64 : fls64(mask); \2726})2727+2828+/* The CCP as a DMA provider can be configured for public or private2929+ * channels. Default is specified in the vdata for the device (PCI ID).3030+ * This module parameter will override for all channels on all devices:3131+ * dma_chan_attr = 0x2 to force all channels public3232+ * = 0x1 to force all channels private3333+ * = 0x0 to defer to the vdata setting3434+ * = any other value: warning, revert to 0x03535+ */3636+static unsigned int dma_chan_attr = CCP_DMA_DFLT;3737+module_param(dma_chan_attr, uint, 0444);3838+MODULE_PARM_DESC(dma_chan_attr, "Set DMA channel visibility: 0 (default) = device defaults, 1 = make private, 2 = make public");3939+4040+unsigned int ccp_get_dma_chan_attr(struct ccp_device *ccp)4141+{4242+ switch (dma_chan_attr) {4343+ case CCP_DMA_DFLT:4444+ return ccp->vdata->dma_chan_attr;4545+4646+ case CCP_DMA_PRIV:4747+ return DMA_PRIVATE;4848+4949+ case CCP_DMA_PUB:5050+ return 0;5151+5252+ default:5353+ dev_info_once(ccp->dev, "Invalid value for dma_chan_attr: %d\n",5454+ dma_chan_attr);5555+ return ccp->vdata->dma_chan_attr;5656+ }5757+}28582959static void ccp_free_cmd_resources(struct ccp_device *ccp,3060 struct list_head *list)···706674 dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask);707675 dma_cap_set(DMA_SG, dma_dev->cap_mask);708676 dma_cap_set(DMA_INTERRUPT, dma_dev->cap_mask);677677+678678+ /* The DMA channels for this device can be set to public or private,679679+ * and overridden by the module parameter dma_chan_attr.680680+ * Default: according to the value in vdata (dma_chan_attr=0)681681+ * dma_chan_attr=0x1: all channels private (override vdata)682682+ * dma_chan_attr=0x2: all channels public (override vdata)683683+ */684684+ if (ccp_get_dma_chan_attr(ccp) == DMA_PRIVATE)685685+ dma_cap_set(DMA_PRIVATE, dma_dev->cap_mask);709686710687 INIT_LIST_HEAD(&dma_dev->channels);711688 for (i = 0; i < ccp->cmd_q_count; i++) {
+4-1
drivers/dma/bcm2835-dma.c
···251251 */252252253253 /* have we filled in period_length yet? */254254- if (*total_len + control_block->length < period_len)254254+ if (*total_len + control_block->length < period_len) {255255+ /* update number of bytes in this period so far */256256+ *total_len += control_block->length;255257 return;258258+ }256259257260 /* calculate the length that remains to reach period_length */258261 control_block->length = period_len - *total_len;
···254254255255 rc = efi_mem_desc_lookup(efi.esrt, &md);256256 if (rc < 0) {257257- pr_err("ESRT header is not in the memory map.\n");257257+ pr_warn("ESRT header is not in the memory map.\n");258258 return;259259 }260260
+9-1
drivers/gpio/gpiolib-acpi.c
···266266 goto fail_free_event;267267 }268268269269+ if (agpio->wake_capable == ACPI_WAKE_CAPABLE)270270+ enable_irq_wake(irq);271271+269272 list_add_tail(&event->node, &acpi_gpio->events);270273 return AE_OK;271274···341338342339 list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) {343340 struct gpio_desc *desc;341341+342342+ if (irqd_is_wakeup_set(irq_get_irq_data(event->irq)))343343+ disable_irq_wake(event->irq);344344345345 free_irq(event->irq, event);346346 desc = event->desc;···577571 }578572579573 desc = acpi_get_gpiod_by_index(adev, propname, idx, &info);580580- if (!IS_ERR(desc) || (PTR_ERR(desc) == -EPROBE_DEFER))574574+ if (!IS_ERR(desc))581575 break;576576+ if (PTR_ERR(desc) == -EPROBE_DEFER)577577+ return ERR_CAST(desc);582578 }583579584580 /* Then from plain _CRS GPIOs */
···495495 unsigned char val = edid_get_byte(vgpu);496496497497 aux_data_for_write = (val << 16);498498- }498498+ } else499499+ aux_data_for_write = (0xff << 16);499500 }500501 /* write the return value in AUX_CH_DATA reg which includes:501502 * ACK of I2C_WRITE
+6-2
drivers/gpu/drm/i915/gvt/gtt.c
···18371837 ret = gtt_entry_p2m(vgpu, &e, &m);18381838 if (ret) {18391839 gvt_vgpu_err("fail to translate guest gtt entry\n");18401840- return ret;18401840+ /* guest driver may read/write the entry when partial18411841+ * update the entry in this situation p2m will fail18421842+ * settting the shadow entry to point to a scratch page18431843+ */18441844+ ops->set_pfn(&m, gvt->gtt.scratch_ggtt_mfn);18411845 }18421846 } else {18431847 m = e;18441844- m.val64 = 0;18481848+ ops->set_pfn(&m, gvt->gtt.scratch_ggtt_mfn);18451849 }1846185018471851 ggtt_set_shadow_entry(ggtt_mm, &m, g_gtt_index);
+9-1
drivers/gpu/drm/i915/gvt/handlers.c
···970970 return 0;971971}972972973973+static int mbctl_write(struct intel_vgpu *vgpu, unsigned int offset,974974+ void *p_data, unsigned int bytes)975975+{976976+ *(u32 *)p_data &= (~GEN6_MBCTL_ENABLE_BOOT_FETCH);977977+ write_vreg(vgpu, offset, p_data, bytes);978978+ return 0;979979+}980980+973981static int vga_control_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,974982 void *p_data, unsigned int bytes)975983{···22462238 MMIO_D(0x7180, D_ALL);22472239 MMIO_D(0x7408, D_ALL);22482240 MMIO_D(0x7c00, D_ALL);22492249- MMIO_D(GEN6_MBCTL, D_ALL);22412241+ MMIO_DH(GEN6_MBCTL, D_ALL, NULL, mbctl_write);22502242 MMIO_D(0x911c, D_ALL);22512243 MMIO_D(0x9120, D_ALL);22522244 MMIO_DFH(GEN7_UCGCTL4, D_ALL, F_CMD_ACCESS, NULL, NULL);
···207207 l3_offset.reg = 0xb020;208208 for (i = 0; i < 32; i++) {209209 gen9_render_mocs_L3[i] = I915_READ(l3_offset);210210- I915_WRITE(l3_offset, vgpu_vreg(vgpu, offset));210210+ I915_WRITE(l3_offset, vgpu_vreg(vgpu, l3_offset));211211 POSTING_READ(l3_offset);212212 l3_offset.reg += 4;213213 }
+6-1
drivers/gpu/drm/i915/gvt/scheduler.c
···127127 return 0;128128}129129130130+static inline bool is_gvt_request(struct drm_i915_gem_request *req)131131+{132132+ return i915_gem_context_force_single_submission(req->ctx);133133+}134134+130135static int shadow_context_status_change(struct notifier_block *nb,131136 unsigned long action, void *data)132137{···142137 struct intel_vgpu_workload *workload =143138 scheduler->current_workload[req->engine->id];144139145145- if (unlikely(!workload))140140+ if (!is_gvt_request(req) || unlikely(!workload))146141 return NOTIFY_OK;147142148143 switch (action) {
+2
drivers/gpu/drm/i915/intel_ringbuffer.c
···20242024 ret = context_pin(ctx, flags);20252025 if (ret)20262026 goto error;20272027+20282028+ ce->state->obj->mm.dirty = true;20272029 }2028203020292031 /* The kernel context is only used as a placeholder for flushing the
+4-2
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
···11-/* Copyright (c) 2016 The Linux Foundation. All rights reserved.11+/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.22 *33 * This program is free software; you can redistribute it and/or modify44 * it under the terms of the GNU General Public License version 2 and···534534 }535535536536 if (a5xx_gpu->gpmu_bo) {537537- if (a5xx_gpu->gpmu_bo)537537+ if (a5xx_gpu->gpmu_iova)538538 msm_gem_put_iova(a5xx_gpu->gpmu_bo, gpu->id);539539 drm_gem_object_unreference_unlocked(a5xx_gpu->gpmu_bo);540540 }···860860 .idle = a5xx_idle,861861 .irq = a5xx_irq,862862 .destroy = a5xx_destroy,863863+#ifdef CONFIG_DEBUG_FS863864 .show = a5xx_show,865865+#endif864866 },865867 .get_timestamp = a5xx_get_timestamp,866868};
+19-10
drivers/gpu/drm/msm/adreno/adreno_gpu.c
···418418 return 0;419419}420420421421-void adreno_gpu_cleanup(struct adreno_gpu *gpu)421421+void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)422422{423423- if (gpu->memptrs_bo) {424424- if (gpu->memptrs)425425- msm_gem_put_vaddr(gpu->memptrs_bo);423423+ struct msm_gpu *gpu = &adreno_gpu->base;426424427427- if (gpu->memptrs_iova)428428- msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);425425+ if (adreno_gpu->memptrs_bo) {426426+ if (adreno_gpu->memptrs)427427+ msm_gem_put_vaddr(adreno_gpu->memptrs_bo);429428430430- drm_gem_object_unreference_unlocked(gpu->memptrs_bo);429429+ if (adreno_gpu->memptrs_iova)430430+ msm_gem_put_iova(adreno_gpu->memptrs_bo, gpu->id);431431+432432+ drm_gem_object_unreference_unlocked(adreno_gpu->memptrs_bo);431433 }432432- release_firmware(gpu->pm4);433433- release_firmware(gpu->pfp);434434- msm_gpu_cleanup(&gpu->base);434434+ release_firmware(adreno_gpu->pm4);435435+ release_firmware(adreno_gpu->pfp);436436+437437+ msm_gpu_cleanup(gpu);438438+439439+ if (gpu->aspace) {440440+ gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu,441441+ iommu_ports, ARRAY_SIZE(iommu_ports));442442+ msm_gem_address_space_destroy(gpu->aspace);443443+ }435444}
+1-1
drivers/gpu/drm/msm/dsi/dsi_manager.c
···171171 }172172 }173173 } else {174174- msm_dsi_host_reset_phy(mdsi->host);174174+ msm_dsi_host_reset_phy(msm_dsi->host);175175 ret = enable_phy(msm_dsi, src_pll_id, &shared_timings[id]);176176 if (ret)177177 return ret;
-7
drivers/gpu/drm/msm/hdmi/hdmi_audio.c
···1818#include <linux/hdmi.h>1919#include "hdmi.h"20202121-2222-/* Supported HDMI Audio channels */2323-#define MSM_HDMI_AUDIO_CHANNEL_2 02424-#define MSM_HDMI_AUDIO_CHANNEL_4 12525-#define MSM_HDMI_AUDIO_CHANNEL_6 22626-#define MSM_HDMI_AUDIO_CHANNEL_8 32727-2821/* maps MSM_HDMI_AUDIO_CHANNEL_n consts used by audio driver to # of channels: */2922static int nchannels[] = { 2, 4, 6, 8 };3023
+2-1
drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.h
···1818#ifndef __MDP5_PIPE_H__1919#define __MDP5_PIPE_H__20202121-#define SSPP_MAX (SSPP_RGB3 + 1) /* TODO: Add SSPP_MAX in mdp5.xml.h */2121+/* TODO: Add SSPP_MAX in mdp5.xml.h */2222+#define SSPP_MAX (SSPP_CURSOR1 + 1)22232324/* represents a hw pipe, which is dynamically assigned to a plane */2425struct mdp5_hw_pipe {
+6
drivers/gpu/drm/msm/msm_gem.c
···812812813813 size = PAGE_ALIGN(size);814814815815+ /* Disallow zero sized objects as they make the underlying816816+ * infrastructure grumpy817817+ */818818+ if (size == 0)819819+ return ERR_PTR(-EINVAL);820820+815821 ret = msm_gem_new_impl(dev, size, flags, NULL, &obj);816822 if (ret)817823 goto fail;
-3
drivers/gpu/drm/msm/msm_gpu.c
···706706 msm_ringbuffer_destroy(gpu->rb);707707 }708708709709- if (gpu->aspace)710710- msm_gem_address_space_destroy(gpu->aspace);711711-712709 if (gpu->fctx)713710 msm_fence_context_free(gpu->fctx);714711}
+2-2
drivers/gpu/drm/radeon/radeon_ttm.c
···213213 rbo->placement.num_busy_placement = 0;214214 for (i = 0; i < rbo->placement.num_placement; i++) {215215 if (rbo->placements[i].flags & TTM_PL_FLAG_VRAM) {216216- if (rbo->placements[0].fpfn < fpfn)217217- rbo->placements[0].fpfn = fpfn;216216+ if (rbo->placements[i].fpfn < fpfn)217217+ rbo->placements[i].fpfn = fpfn;218218 } else {219219 rbo->placement.busy_placement =220220 &rbo->placements[i];
+8-6
drivers/gpu/drm/ttm/ttm_object.c
···179179 if (unlikely(ret != 0))180180 goto out_err0;181181182182- ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL);182182+ ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);183183 if (unlikely(ret != 0))184184 goto out_err1;185185···318318319319int ttm_ref_object_add(struct ttm_object_file *tfile,320320 struct ttm_base_object *base,321321- enum ttm_ref_type ref_type, bool *existed)321321+ enum ttm_ref_type ref_type, bool *existed,322322+ bool require_existed)322323{323324 struct drm_open_hash *ht = &tfile->ref_hash[ref_type];324325 struct ttm_ref_object *ref;···346345 }347346348347 rcu_read_unlock();348348+ if (require_existed)349349+ return -EPERM;350350+349351 ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),350352 false, false);351353 if (unlikely(ret != 0))···453449 ttm_ref_object_release(&ref->kref);454450 }455451452452+ spin_unlock(&tfile->lock);456453 for (i = 0; i < TTM_REF_NUM; ++i)457454 drm_ht_remove(&tfile->ref_hash[i]);458455459459- spin_unlock(&tfile->lock);460456 ttm_object_file_unref(&tfile);461457}462458EXPORT_SYMBOL(ttm_object_file_release);···533529534530 *p_tdev = NULL;535531536536- spin_lock(&tdev->object_lock);537532 drm_ht_remove(&tdev->object_hash);538538- spin_unlock(&tdev->object_lock);539533540534 kfree(tdev);541535}···637635 prime = (struct ttm_prime_object *) dma_buf->priv;638636 base = &prime->base;639637 *handle = base->hash.key;640640- ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL);638638+ ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);641639642640 dma_buf_put(dma_buf);643641
···6161 ret = st->core.read_ec_sensors_data(indio_dev, 1 << idx, &data);6262 if (ret < 0)6363 break;6464-6464+ ret = IIO_VAL_INT;6565 *val = data;6666 break;6767 case IIO_CHAN_INFO_CALIBBIAS:···7676 for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)7777 st->core.calib[i] =7878 st->core.resp->sensor_offset.offset[i];7979-7979+ ret = IIO_VAL_INT;8080 *val = st->core.calib[idx];8181 break;8282 case IIO_CHAN_INFO_SCALE:
···379379{380380381381 struct hid_sensor_hub_attribute_info timestamp;382382+ s32 value;383383+ int ret;382384383385 hid_sensor_get_reporting_interval(hsdev, usage_id, st);384386···418416 st->power_state.index, st->power_state.report_id,419417 st->sensitivity.index, st->sensitivity.report_id,420418 timestamp.index, timestamp.report_id);419419+420420+ ret = sensor_hub_get_feature(hsdev,421421+ st->power_state.report_id,422422+ st->power_state.index, sizeof(value), &value);423423+ if (ret < 0)424424+ return ret;425425+ if (value < 0)426426+ return -EINVAL;421427422428 return 0;423429}
+12
drivers/iio/gyro/bmg160_core.c
···2727#include <linux/iio/trigger_consumer.h>2828#include <linux/iio/triggered_buffer.h>2929#include <linux/regmap.h>3030+#include <linux/delay.h>3031#include "bmg160.h"31323233#define BMG160_IRQ_NAME "bmg160_event"···5251#define BMG160_NO_FILTER 05352#define BMG160_DEF_BW 1005453#define BMG160_REG_PMU_BW_RES BIT(7)5454+5555+#define BMG160_GYRO_REG_RESET 0x145656+#define BMG160_GYRO_RESET_VAL 0xb655575658#define BMG160_REG_INT_MAP_0 0x175759#define BMG160_INT_MAP_0_BIT_ANY BIT(1)···239235 struct device *dev = regmap_get_device(data->regmap);240236 int ret;241237 unsigned int val;238238+239239+ /*240240+ * Reset chip to get it in a known good state. A delay of 30ms after241241+ * reset is required according to the datasheet.242242+ */243243+ regmap_write(data->regmap, BMG160_GYRO_REG_RESET,244244+ BMG160_GYRO_RESET_VAL);245245+ usleep_range(30000, 30700);242246243247 ret = regmap_read(data->regmap, BMG160_REG_CHIP_ID, &val);244248 if (ret < 0) {
···461461 return 0;462462}463463464464+int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)465465+{466466+ union acpi_object *obj;467467+ union acpi_object obj_args, argv4;468468+469469+ obj_args.integer.type = ACPI_TYPE_INTEGER;470470+ obj_args.integer.value = mac_cb->mac_id;471471+472472+ argv4.type = ACPI_TYPE_PACKAGE,473473+ argv4.package.count = 1,474474+ argv4.package.elements = &obj_args,475475+476476+ obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),477477+ hns_dsaf_acpi_dsm_uuid, 0,478478+ HNS_OP_GET_SFP_STAT_FUNC, &argv4);479479+480480+ if (!obj || obj->type != ACPI_TYPE_INTEGER)481481+ return -ENODEV;482482+483483+ *sfp_prsnt = obj->integer.value;484484+485485+ ACPI_FREE(obj);486486+487487+ return 0;488488+}489489+464490/**465491 * hns_mac_config_sds_loopback - set loop back for serdes466492 * @mac_cb: mac control block···618592 misc_op->hns_dsaf_roce_srst = hns_dsaf_roce_srst_acpi;619593620594 misc_op->get_phy_if = hns_mac_get_phy_if_acpi;621621- misc_op->get_sfp_prsnt = hns_mac_get_sfp_prsnt;595595+ misc_op->get_sfp_prsnt = hns_mac_get_sfp_prsnt_acpi;622596623597 misc_op->cfg_serdes_loopback = hns_mac_config_sds_loopback_acpi;624598 } else {
+1-1
drivers/net/ethernet/intel/e1000e/netdev.c
···62746274 /* Quiesce the device without resetting the hardware */62756275 e1000e_down(adapter, false);62766276 e1000_free_irq(adapter);62776277- e1000e_reset_interrupt_capability(adapter);62786277 }62786278+ e1000e_reset_interrupt_capability(adapter);6279627962806280 /* Allow time for pending master requests to run */62816281 e1000e_disable_pcie_master(&adapter->hw);
+12-4
drivers/net/ethernet/intel/i40e/i40e_main.c
···44384438 if (!vsi->netdev)44394439 return;4440444044414441- for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)44424442- napi_enable(&vsi->q_vectors[q_idx]->napi);44414441+ for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {44424442+ struct i40e_q_vector *q_vector = vsi->q_vectors[q_idx];44434443+44444444+ if (q_vector->rx.ring || q_vector->tx.ring)44454445+ napi_enable(&q_vector->napi);44464446+ }44434447}4444444844454449/**···44574453 if (!vsi->netdev)44584454 return;4459445544604460- for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++)44614461- napi_disable(&vsi->q_vectors[q_idx]->napi);44564456+ for (q_idx = 0; q_idx < vsi->num_q_vectors; q_idx++) {44574457+ struct i40e_q_vector *q_vector = vsi->q_vectors[q_idx];44584458+44594459+ if (q_vector->rx.ring || q_vector->tx.ring)44604460+ napi_disable(&q_vector->napi);44614461+ }44624462}4463446344644464/**
+3-2
drivers/net/ethernet/mellanox/mlx5/core/lag.c
···294294 struct netdev_notifier_changeupper_info *info)295295{296296 struct net_device *upper = info->upper_dev, *ndev_tmp;297297- struct netdev_lag_upper_info *lag_upper_info;297297+ struct netdev_lag_upper_info *lag_upper_info = NULL;298298 bool is_bonded;299299 int bond_status = 0;300300 int num_slaves = 0;···303303 if (!netif_is_lag_master(upper))304304 return 0;305305306306- lag_upper_info = info->upper_info;306306+ if (info->linking)307307+ lag_upper_info = info->upper_info;307308308309 /* The event may still be of interest if the slave does not belong to309310 * us, but is enslaved to a master which has one or more of our netdevs
+18-2
drivers/net/ethernet/moxa/moxart_ether.c
···2525#include <linux/of_irq.h>2626#include <linux/crc32.h>2727#include <linux/crc32c.h>2828+#include <linux/circ_buf.h>28292930#include "moxart_ether.h"3031···279278 return rx;280279}281280281281+static int moxart_tx_queue_space(struct net_device *ndev)282282+{283283+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);284284+285285+ return CIRC_SPACE(priv->tx_head, priv->tx_tail, TX_DESC_NUM);286286+}287287+282288static void moxart_tx_finished(struct net_device *ndev)283289{284290 struct moxart_mac_priv_t *priv = netdev_priv(ndev);···305297 tx_tail = TX_NEXT(tx_tail);306298 }307299 priv->tx_tail = tx_tail;300300+ if (netif_queue_stopped(ndev) &&301301+ moxart_tx_queue_space(ndev) >= TX_WAKE_THRESHOLD)302302+ netif_wake_queue(ndev);308303}309304310305static irqreturn_t moxart_mac_interrupt(int irq, void *dev_id)···335324 struct moxart_mac_priv_t *priv = netdev_priv(ndev);336325 void *desc;337326 unsigned int len;338338- unsigned int tx_head = priv->tx_head;327327+ unsigned int tx_head;339328 u32 txdes1;340329 int ret = NETDEV_TX_BUSY;341330331331+ spin_lock_irq(&priv->txlock);332332+333333+ tx_head = priv->tx_head;342334 desc = priv->tx_desc_base + (TX_REG_DESC_SIZE * tx_head);343335344344- spin_lock_irq(&priv->txlock);336336+ if (moxart_tx_queue_space(ndev) == 1)337337+ netif_stop_queue(ndev);338338+345339 if (moxart_desc_read(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) {346340 net_dbg_ratelimited("no TX space for packet\n");347341 priv->stats.tx_dropped++;
···24012401 return;2402240224032403 rcu_read_lock();24042404- sta = mvm->fw_id_to_mac_id[notif->sta_id];24042404+ sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]);24052405 if (WARN_ON(IS_ERR_OR_NULL(sta))) {24062406 rcu_read_unlock();24072407 return;
+6-3
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
···18061806 iwl_mvm_get_wd_timeout(mvm, vif, false, false);18071807 int queue;1808180818091809- if (vif->type == NL80211_IFTYPE_AP)18091809+ if (vif->type == NL80211_IFTYPE_AP ||18101810+ vif->type == NL80211_IFTYPE_ADHOC)18101811 queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE;18111812 else if (vif->type == NL80211_IFTYPE_P2P_DEVICE)18121813 queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE;···18381837 * enabled-cab_queue to the mask)18391838 */18401839 if (iwl_mvm_is_dqa_supported(mvm) &&18411841- vif->type == NL80211_IFTYPE_AP) {18401840+ (vif->type == NL80211_IFTYPE_AP ||18411841+ vif->type == NL80211_IFTYPE_ADHOC)) {18421842 struct iwl_trans_txq_scd_cfg cfg = {18431843 .fifo = IWL_MVM_TX_FIFO_MCAST,18441844 .sta_id = mvmvif->bcast_sta.sta_id,···1864186218651863 lockdep_assert_held(&mvm->mutex);1866186418671867- if (vif->type == NL80211_IFTYPE_AP)18651865+ if (vif->type == NL80211_IFTYPE_AP ||18661866+ vif->type == NL80211_IFTYPE_ADHOC)18681867 iwl_mvm_disable_txq(mvm, vif->cab_queue, vif->cab_queue,18691868 IWL_MAX_TID_COUNT, 0);18701869
+5-2
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
···506506507507 switch (info->control.vif->type) {508508 case NL80211_IFTYPE_AP:509509+ case NL80211_IFTYPE_ADHOC:509510 /*510511 * Handle legacy hostapd as well, where station may be added511512 * only after assoc. Take care of the case where we send a···518517 if (info->hw_queue == info->control.vif->cab_queue)519518 return info->hw_queue;520519521521- WARN_ONCE(1, "fc=0x%02x", le16_to_cpu(fc));520520+ WARN_ONCE(info->control.vif->type != NL80211_IFTYPE_ADHOC,521521+ "fc=0x%02x", le16_to_cpu(fc));522522 return IWL_MVM_DQA_AP_PROBE_RESP_QUEUE;523523 case NL80211_IFTYPE_P2P_DEVICE:524524 if (ieee80211_is_mgmt(fc))···586584 iwl_mvm_vif_from_mac80211(info.control.vif);587585588586 if (info.control.vif->type == NL80211_IFTYPE_P2P_DEVICE ||589589- info.control.vif->type == NL80211_IFTYPE_AP) {587587+ info.control.vif->type == NL80211_IFTYPE_AP ||588588+ info.control.vif->type == NL80211_IFTYPE_ADHOC) {590589 sta_id = mvmvif->bcast_sta.sta_id;591590 queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info,592591 hdr->frame_control);
···8989 depends on PCI_MSI_IRQ_DOMAIN9090 select PCIEPORTBUS9191 select PCIE_DW_HOST9292+ select PCI_HOST_COMMON9293 help9394 Say Y here if you want PCIe controller support on HiSilicon9495 Hip05 and Hip06 SoCs
···38373837 * @card: qeth card structure, to check max. elems.38383838 * @skb: SKB address38393839 * @extra_elems: extra elems needed, to check against max.38403840+ * @data_offset: range starts at skb->data + data_offset38403841 *38413842 * Returns the number of pages, and thus QDIO buffer elements, needed to cover38423843 * skb data, including linear part and fragments. Checks if the result plus···38453844 * Note: extra_elems is not included in the returned result.38463845 */38473846int qeth_get_elements_no(struct qeth_card *card,38483848- struct sk_buff *skb, int extra_elems)38473847+ struct sk_buff *skb, int extra_elems, int data_offset)38493848{38503849 int elements = qeth_get_elements_for_range(38513851- (addr_t)skb->data,38503850+ (addr_t)skb->data + data_offset,38523851 (addr_t)skb->data + skb_headlen(skb)) +38533852 qeth_get_elements_for_frags(skb);38543853
+3-2
drivers/s390/net/qeth_l2_main.c
···849849 * chaining we can not send long frag lists850850 */851851 if ((card->info.type != QETH_CARD_TYPE_IQD) &&852852- !qeth_get_elements_no(card, new_skb, 0)) {852852+ !qeth_get_elements_no(card, new_skb, 0, 0)) {853853 int lin_rc = skb_linearize(new_skb);854854855855 if (card->options.performance_stats) {···894894 }895895 }896896897897- elements = qeth_get_elements_no(card, new_skb, elements_needed);897897+ elements = qeth_get_elements_no(card, new_skb, elements_needed,898898+ (data_offset > 0) ? data_offset : 0);898899 if (!elements) {899900 if (data_offset >= 0)900901 kmem_cache_free(qeth_core_header_cache, hdr);
···520520 struct lpfc_hba *phba = ctxp->phba;521521 struct lpfc_iocbq *nvmewqeq;522522 unsigned long iflags;523523- int rc, id;523523+ int rc;524524525525#ifdef CONFIG_SCSI_LPFC_DEBUG_FS526526 if (phba->ktime_on) {···530530 ctxp->ts_nvme_data = ktime_get_ns();531531 }532532 if (phba->cpucheck_on & LPFC_CHECK_NVMET_IO) {533533- id = smp_processor_id();533533+ int id = smp_processor_id();534534 ctxp->cpu = id;535535 if (id < LPFC_CHECK_CPU_CNT)536536 phba->cpucheck_xmt_io[id]++;
···16511651 /* Don't abort commands in adapter during EEH16521652 * recovery as it's not accessible/responding.16531653 */16541654- if (GET_CMD_SP(sp) && !ha->flags.eeh_busy) {16541654+ if (GET_CMD_SP(sp) && !ha->flags.eeh_busy &&16551655+ (sp->type == SRB_SCSI_CMD)) {16551656 /* Get a reference to the sp and drop the lock.16561657 * The reference ensures this sp->done() call16571658 * - and not the call in qla2xxx_eh_abort() -
+3-3
drivers/scsi/scsi_lib.c
···496496 scsi_starved_list_run(sdev->host);497497498498 if (q->mq_ops)499499- blk_mq_start_stopped_hw_queues(q, false);499499+ blk_mq_run_hw_queues(q, false);500500 else501501 blk_run_queue(q);502502}···667667 !list_empty(&sdev->host->starved_list))668668 kblockd_schedule_work(&sdev->requeue_work);669669 else670670- blk_mq_start_stopped_hw_queues(q, true);670670+ blk_mq_run_hw_queues(q, true);671671 } else {672672 unsigned long flags;673673···19741974 case BLK_MQ_RQ_QUEUE_BUSY:19751975 if (atomic_read(&sdev->device_busy) == 0 &&19761976 !scsi_device_blocked(sdev))19771977- blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);19771977+ blk_mq_delay_run_hw_queue(hctx, SCSI_QUEUE_DELAY);19781978 break;19791979 case BLK_MQ_RQ_QUEUE_ERROR:19801980 /*
+2
drivers/scsi/sg.c
···996996 result = get_user(val, ip);997997 if (result)998998 return result;999999+ if (val > SG_MAX_CDB_SIZE)10001000+ return -ENOMEM;9991001 sfp->next_cmd_len = (val > 0) ? val : 0;10001002 return 0;10011003 case SG_GET_VERSION_NUM:
···107107};108108static DEFINE_IDA(cpufreq_ida);109109110110-static unsigned int cpufreq_dev_count;111111-112110static DEFINE_MUTEX(cooling_list_lock);113111static LIST_HEAD(cpufreq_dev_list);114112···393395394396 opp = dev_pm_opp_find_freq_exact(cpufreq_device->cpu_dev, freq_hz,395397 true);398398+ if (IS_ERR(opp)) {399399+ dev_warn_ratelimited(cpufreq_device->cpu_dev,400400+ "Failed to find OPP for frequency %lu: %ld\n",401401+ freq_hz, PTR_ERR(opp));402402+ return -EINVAL;403403+ }404404+396405 voltage = dev_pm_opp_get_voltage(opp);397406 dev_pm_opp_put(opp);398407399408 if (voltage == 0) {400400- dev_warn_ratelimited(cpufreq_device->cpu_dev,401401- "Failed to get voltage for frequency %lu: %ld\n",402402- freq_hz, IS_ERR(opp) ? PTR_ERR(opp) : 0);409409+ dev_err_ratelimited(cpufreq_device->cpu_dev,410410+ "Failed to get voltage for frequency %lu\n",411411+ freq_hz);403412 return -EINVAL;404413 }405414···698693699694 *state = cpufreq_cooling_get_level(cpu, target_freq);700695 if (*state == THERMAL_CSTATE_INVALID) {701701- dev_warn_ratelimited(&cdev->device,702702- "Failed to convert %dKHz for cpu %d into a cdev state\n",703703- target_freq, cpu);696696+ dev_err_ratelimited(&cdev->device,697697+ "Failed to convert %dKHz for cpu %d into a cdev state\n",698698+ target_freq, cpu);704699 return -EINVAL;705700 }706701···776771 unsigned int freq, i, num_cpus;777772 int ret;778773 struct thermal_cooling_device_ops *cooling_ops;774774+ bool first;779775780776 if (!alloc_cpumask_var(&temp_mask, GFP_KERNEL))781777 return ERR_PTR(-ENOMEM);···880874 cpufreq_dev->cool_dev = cool_dev;881875882876 mutex_lock(&cooling_list_lock);883883- list_add(&cpufreq_dev->node, &cpufreq_dev_list);884884-885877 /* Register the notifier for first cpufreq cooling device */886886- if (!cpufreq_dev_count++)878878+ first = list_empty(&cpufreq_dev_list);879879+ list_add(&cpufreq_dev->node, &cpufreq_dev_list);880880+ mutex_unlock(&cooling_list_lock);881881+882882+ if (first)887883 cpufreq_register_notifier(&thermal_cpufreq_notifier_block,888884 CPUFREQ_POLICY_NOTIFIER);889889- mutex_unlock(&cooling_list_lock);890885891886 goto put_policy;892887···10281021void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)10291022{10301023 struct cpufreq_cooling_device *cpufreq_dev;10241024+ bool last;1031102510321026 if (!cdev)10331027 return;···10361028 cpufreq_dev = cdev->devdata;1037102910381030 mutex_lock(&cooling_list_lock);10311031+ list_del(&cpufreq_dev->node);10391032 /* Unregister the notifier for the last cpufreq cooling device */10401040- if (!--cpufreq_dev_count)10331033+ last = list_empty(&cpufreq_dev_list);10341034+ mutex_unlock(&cooling_list_lock);10351035+10361036+ if (last)10411037 cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,10421038 CPUFREQ_POLICY_NOTIFIER);10431043-10441044- list_del(&cpufreq_dev->node);10451045- mutex_unlock(&cooling_list_lock);1046103910471040 thermal_cooling_device_unregister(cpufreq_dev->cool_dev);10481041 ida_simple_remove(&cpufreq_ida, cpufreq_dev->id);
+10-4
drivers/thermal/devfreq_cooling.c
···186186 return 0;187187188188 opp = dev_pm_opp_find_freq_exact(dev, freq, true);189189- if (IS_ERR(opp) && (PTR_ERR(opp) == -ERANGE))189189+ if (PTR_ERR(opp) == -ERANGE)190190 opp = dev_pm_opp_find_freq_exact(dev, freq, false);191191+192192+ if (IS_ERR(opp)) {193193+ dev_err_ratelimited(dev, "Failed to find OPP for frequency %lu: %ld\n",194194+ freq, PTR_ERR(opp));195195+ return 0;196196+ }191197192198 voltage = dev_pm_opp_get_voltage(opp) / 1000; /* mV */193199 dev_pm_opp_put(opp);194200195201 if (voltage == 0) {196196- dev_warn_ratelimited(dev,197197- "Failed to get voltage for frequency %lu: %ld\n",198198- freq, IS_ERR(opp) ? PTR_ERR(opp) : 0);202202+ dev_err_ratelimited(dev,203203+ "Failed to get voltage for frequency %lu\n",204204+ freq);199205 return 0;200206 }201207
+6-2
drivers/tty/serial/8250/Kconfig
···128128 by the parport_serial driver, enabled with CONFIG_PARPORT_SERIAL.129129130130config SERIAL_8250_EXAR131131- tristate "8250/16550 PCI device support"132132- depends on SERIAL_8250_PCI131131+ tristate "8250/16550 Exar/Commtech PCI/PCIe device support"132132+ depends on SERIAL_8250_PCI133133 default SERIAL_8250134134+ help135135+ This builds support for XR17C1xx, XR17V3xx and some Commtech136136+ 422x PCIe serial cards that are not covered by the more generic137137+ SERIAL_8250_PCI option.134138135139config SERIAL_8250_HP300136140 tristate
+21-2
drivers/tty/serial/amba-pl011.c
···24522452 uart_console_write(&dev->port, s, n, pl011_putc);24532453}2454245424552455+/*24562456+ * On non-ACPI systems, earlycon is enabled by specifying24572457+ * "earlycon=pl011,<address>" on the kernel command line.24582458+ *24592459+ * On ACPI ARM64 systems, an "early" console is enabled via the SPCR table,24602460+ * by specifying only "earlycon" on the command line. Because it requires24612461+ * SPCR, the console starts after ACPI is parsed, which is later than a24622462+ * traditional early console.24632463+ *24642464+ * To get the traditional early console that starts before ACPI is parsed,24652465+ * specify the full "earlycon=pl011,<address>" option.24662466+ */24552467static int __init pl011_early_console_setup(struct earlycon_device *device,24562468 const char *opt)24572469{24582470 if (!device->port.membase)24592471 return -ENODEV;2460247224612461- device->con->write = qdf2400_e44_present ?24622462- qdf2400_e44_early_write : pl011_early_write;24732473+ /* On QDF2400 SOCs affected by Erratum 44, the "qdf2400_e44" must24742474+ * also be specified, e.g. "earlycon=pl011,<address>,qdf2400_e44".24752475+ */24762476+ if (!strcmp(device->options, "qdf2400_e44"))24772477+ device->con->write = qdf2400_e44_early_write;24782478+ else24792479+ device->con->write = pl011_early_write;24802480+24632481 return 0;24642482}24652483OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);24662484OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);24852485+EARLYCON_DECLARE(qdf2400_e44, pl011_early_console_setup);2467248624682487#else24692488#define AMBA_CONSOLE NULL
+8
drivers/tty/serial/atmel_serial.c
···19511951 atmel_uart_writel(port, ATMEL_PDC_TCR, 0);19521952 atmel_port->pdc_tx.ofs = 0;19531953 }19541954+ /*19551955+ * in uart_flush_buffer(), the xmit circular buffer has just19561956+ * been cleared, so we have to reset tx_len accordingly.19571957+ */19581958+ atmel_port->tx_len = 0;19541959}1955196019561961/*···24872482 /* Store PDC transmit status and disable it */24882483 pdc_tx = atmel_uart_readl(port, ATMEL_PDC_PTSR) & ATMEL_PDC_TXTEN;24892484 atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS);24852485+24862486+ /* Make sure that tx path is actually able to send characters */24872487+ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN);2490248824912489 uart_console_write(port, s, count, atmel_console_putchar);24922490
···2584258425852585 if (tree->ops) {25862586 ret = tree->ops->readpage_io_failed_hook(page, mirror);25872587- if (!ret && !bio->bi_error)25882588- uptodate = 1;25892589- } else {25902590- /*25912591- * The generic bio_readpage_error handles errors the25922592- * following way: If possible, new read requests are25932593- * created and submitted and will end up in25942594- * end_bio_extent_readpage as well (if we're lucky, not25952595- * in the !uptodate case). In that case it returns 0 and25962596- * we just go on with the next page in our bio. If it25972597- * can't handle the error it will return -EIO and we25982598- * remain responsible for that page.25992599- */26002600- ret = bio_readpage_error(bio, offset, page, start, end,26012601- mirror);26022602- if (ret == 0) {26032603- uptodate = !bio->bi_error;26042604- offset += len;26052605- continue;25872587+ if (ret == -EAGAIN) {25882588+ /*25892589+ * Data inode's readpage_io_failed_hook() always25902590+ * returns -EAGAIN.25912591+ *25922592+ * The generic bio_readpage_error handles errors25932593+ * the following way: If possible, new read25942594+ * requests are created and submitted and will25952595+ * end up in end_bio_extent_readpage as well (if25962596+ * we're lucky, not in the !uptodate case). In25972597+ * that case it returns 0 and we just go on with25982598+ * the next page in our bio. If it can't handle25992599+ * the error it will return -EIO and we remain26002600+ * responsible for that page.26012601+ */26022602+ ret = bio_readpage_error(bio, offset, page,26032603+ start, end, mirror);26042604+ if (ret == 0) {26052605+ uptodate = !bio->bi_error;26062606+ offset += len;26072607+ continue;26082608+ }26062609 }26102610+26112611+ /*26122612+ * metadata's readpage_io_failed_hook() always returns26132613+ * -EIO and fixes nothing. -EIO is also returned if26142614+ * data inode error could not be fixed.26152615+ */26162616+ ASSERT(ret == -EIO);26072617 }26082618readpage_ok:26092619 if (likely(uptodate)) {
···63056305 goto out;63066306 }6307630763086308+ /*63096309+ * Check that we don't overflow at later allocations, we request63106310+ * clone_sources_count + 1 items, and compare to unsigned long inside63116311+ * access_ok.63126312+ */63086313 if (arg->clone_sources_count >63096309- ULLONG_MAX / sizeof(*arg->clone_sources)) {63146314+ ULONG_MAX / sizeof(struct clone_root) - 1) {63106315 ret = -EINVAL;63116316 goto out;63126317 }
+87
fs/cifs/cifsfs.c
···972972 return rc;973973}974974975975+ssize_t cifs_file_copychunk_range(unsigned int xid,976976+ struct file *src_file, loff_t off,977977+ struct file *dst_file, loff_t destoff,978978+ size_t len, unsigned int flags)979979+{980980+ struct inode *src_inode = file_inode(src_file);981981+ struct inode *target_inode = file_inode(dst_file);982982+ struct cifsFileInfo *smb_file_src;983983+ struct cifsFileInfo *smb_file_target;984984+ struct cifs_tcon *src_tcon;985985+ struct cifs_tcon *target_tcon;986986+ ssize_t rc;987987+988988+ cifs_dbg(FYI, "copychunk range\n");989989+990990+ if (src_inode == target_inode) {991991+ rc = -EINVAL;992992+ goto out;993993+ }994994+995995+ if (!src_file->private_data || !dst_file->private_data) {996996+ rc = -EBADF;997997+ cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");998998+ goto out;999999+ }10001000+10011001+ rc = -EXDEV;10021002+ smb_file_target = dst_file->private_data;10031003+ smb_file_src = src_file->private_data;10041004+ src_tcon = tlink_tcon(smb_file_src->tlink);10051005+ target_tcon = tlink_tcon(smb_file_target->tlink);10061006+10071007+ if (src_tcon->ses != target_tcon->ses) {10081008+ cifs_dbg(VFS, "source and target of copy not on same server\n");10091009+ goto out;10101010+ }10111011+10121012+ /*10131013+ * Note: cifs case is easier than btrfs since server responsible for10141014+ * checks for proper open modes and file type and if it wants10151015+ * server could even support copy of range where source = target10161016+ */10171017+ lock_two_nondirectories(target_inode, src_inode);10181018+10191019+ cifs_dbg(FYI, "about to flush pages\n");10201020+ /* should we flush first and last page first */10211021+ truncate_inode_pages(&target_inode->i_data, 0);10221022+10231023+ if (target_tcon->ses->server->ops->copychunk_range)10241024+ rc = target_tcon->ses->server->ops->copychunk_range(xid,10251025+ smb_file_src, smb_file_target, off, len, destoff);10261026+ else10271027+ rc = -EOPNOTSUPP;10281028+10291029+ /* force revalidate of size and timestamps of target file now10301030+ * that target is updated on the server10311031+ */10321032+ CIFS_I(target_inode)->time = 0;10331033+ /* although unlocking in the reverse order from locking is not10341034+ * strictly necessary here it is a little cleaner to be consistent10351035+ */10361036+ unlock_two_nondirectories(src_inode, target_inode);10371037+10381038+out:10391039+ return rc;10401040+}10411041+10421042+static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,10431043+ struct file *dst_file, loff_t destoff,10441044+ size_t len, unsigned int flags)10451045+{10461046+ unsigned int xid = get_xid();10471047+ ssize_t rc;10481048+10491049+ rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff,10501050+ len, flags);10511051+ free_xid(xid);10521052+ return rc;10531053+}10541054+9751055const struct file_operations cifs_file_ops = {9761056 .read_iter = cifs_loose_read_iter,9771057 .write_iter = cifs_file_write_iter,···1064984 .splice_read = generic_file_splice_read,1065985 .llseek = cifs_llseek,1066986 .unlocked_ioctl = cifs_ioctl,987987+ .copy_file_range = cifs_copy_file_range,1067988 .clone_file_range = cifs_clone_file_range,1068989 .setlease = cifs_setlease,1069990 .fallocate = cifs_fallocate,···10821001 .splice_read = generic_file_splice_read,10831002 .llseek = cifs_llseek,10841003 .unlocked_ioctl = cifs_ioctl,10041004+ .copy_file_range = cifs_copy_file_range,10851005 .clone_file_range = cifs_clone_file_range,10861006 .setlease = cifs_setlease,10871007 .fallocate = cifs_fallocate,···11001018 .mmap = cifs_file_mmap,11011019 .splice_read = generic_file_splice_read,11021020 .unlocked_ioctl = cifs_ioctl,10211021+ .copy_file_range = cifs_copy_file_range,11031022 .clone_file_range = cifs_clone_file_range,11041023 .llseek = cifs_llseek,11051024 .setlease = cifs_setlease,···11181035 .splice_read = generic_file_splice_read,11191036 .llseek = cifs_llseek,11201037 .unlocked_ioctl = cifs_ioctl,10381038+ .copy_file_range = cifs_copy_file_range,11211039 .clone_file_range = cifs_clone_file_range,11221040 .setlease = cifs_setlease,11231041 .fallocate = cifs_fallocate,···11351051 .splice_read = generic_file_splice_read,11361052 .llseek = cifs_llseek,11371053 .unlocked_ioctl = cifs_ioctl,10541054+ .copy_file_range = cifs_copy_file_range,11381055 .clone_file_range = cifs_clone_file_range,11391056 .setlease = cifs_setlease,11401057 .fallocate = cifs_fallocate,···11521067 .mmap = cifs_file_mmap,11531068 .splice_read = generic_file_splice_read,11541069 .unlocked_ioctl = cifs_ioctl,10701070+ .copy_file_range = cifs_copy_file_range,11551071 .clone_file_range = cifs_clone_file_range,11561072 .llseek = cifs_llseek,11571073 .setlease = cifs_setlease,···11641078 .release = cifs_closedir,11651079 .read = generic_read_dir,11661080 .unlocked_ioctl = cifs_ioctl,10811081+ .copy_file_range = cifs_copy_file_range,11671082 .clone_file_range = cifs_clone_file_range,11681083 .llseek = generic_file_llseek,11691084};
+5
fs/cifs/cifsfs.h
···139139# define cifs_listxattr NULL140140#endif141141142142+extern ssize_t cifs_file_copychunk_range(unsigned int xid,143143+ struct file *src_file, loff_t off,144144+ struct file *dst_file, loff_t destoff,145145+ size_t len, unsigned int flags);146146+142147extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);143148#ifdef CONFIG_CIFS_NFSD_EXPORT144149extern const struct export_operations cifs_export_ops;
+15-3
fs/cifs/cifsglob.h
···243243 /* verify the message */244244 int (*check_message)(char *, unsigned int, struct TCP_Server_Info *);245245 bool (*is_oplock_break)(char *, struct TCP_Server_Info *);246246+ int (*handle_cancelled_mid)(char *, struct TCP_Server_Info *);246247 void (*downgrade_oplock)(struct TCP_Server_Info *,247248 struct cifsInodeInfo *, bool);248249 /* process transaction2 response */···408407 char * (*create_lease_buf)(u8 *, u8);409408 /* parse lease context buffer and return oplock/epoch info */410409 __u8 (*parse_lease_buf)(void *, unsigned int *);411411- int (*clone_range)(const unsigned int, struct cifsFileInfo *src_file,412412- struct cifsFileInfo *target_file, u64 src_off, u64 len,413413- u64 dest_off);410410+ ssize_t (*copychunk_range)(const unsigned int,411411+ struct cifsFileInfo *src_file,412412+ struct cifsFileInfo *target_file,413413+ u64 src_off, u64 len, u64 dest_off);414414 int (*duplicate_extents)(const unsigned int, struct cifsFileInfo *src,415415 struct cifsFileInfo *target_file, u64 src_off, u64 len,416416 u64 dest_off);···13451343 void *callback_data; /* general purpose pointer for callback */13461344 void *resp_buf; /* pointer to received SMB header */13471345 int mid_state; /* wish this were enum but can not pass to wait_event */13461346+ unsigned int mid_flags;13481347 __le16 command; /* smb command code */13491348 bool large_buf:1; /* if valid response, is pointer to large buf */13501349 bool multiRsp:1; /* multiple trans2 responses for one request */13511350 bool multiEnd:1; /* both received */13521351 bool decrypted:1; /* decrypted entry */13521352+};13531353+13541354+struct close_cancelled_open {13551355+ struct cifs_fid fid;13561356+ struct cifs_tcon *tcon;13571357+ struct work_struct work;13531358};1354135913551360/* Make code in transport.c a little cleaner by moving···14891480#define MID_RETRY_NEEDED 8 /* session closed while this request out */14901481#define MID_RESPONSE_MALFORMED 0x1014911482#define MID_SHUTDOWN 0x2014831483+14841484+/* Flags */14851485+#define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */1492148614931487/* Types of response buffer returned from SendReceive2 */14941488#define CIFS_NO_BUFFER 0 /* Response buffer not returned */
+2-1
fs/cifs/cifsproto.h
···7979extern void cifs_wake_up_task(struct mid_q_entry *mid);8080extern int cifs_handle_standard(struct TCP_Server_Info *server,8181 struct mid_q_entry *mid);8282-extern int cifs_discard_remaining_data(struct TCP_Server_Info *server);8282+extern int cifs_discard_remaining_data(struct TCP_Server_Info *server,8383+ char *buf);8384extern int cifs_call_async(struct TCP_Server_Info *server,8485 struct smb_rqst *rqst,8586 mid_receive_t *receive, mid_callback_t *callback,
+7-4
fs/cifs/cifssmb.c
···14001400 * current bigbuf.14011401 */14021402int14031403-cifs_discard_remaining_data(struct TCP_Server_Info *server)14031403+cifs_discard_remaining_data(struct TCP_Server_Info *server, char *buf)14041404{14051405- unsigned int rfclen = get_rfc1002_length(server->smallbuf);14051405+ unsigned int rfclen = get_rfc1002_length(buf);14061406 int remaining = rfclen + 4 - server->total_read;1407140714081408 while (remaining > 0) {···14261426 int length;14271427 struct cifs_readdata *rdata = mid->callback_data;1428142814291429- length = cifs_discard_remaining_data(server);14291429+ length = cifs_discard_remaining_data(server, mid->resp_buf);14301430 dequeue_mid(mid, rdata->result);14311431 return length;14321432}···1459145914601460 if (server->ops->is_status_pending &&14611461 server->ops->is_status_pending(buf, server, 0)) {14621462- cifs_discard_remaining_data(server);14621462+ cifs_discard_remaining_data(server, buf);14631463 return -1;14641464 }14651465···15181518 rdata->iov[1].iov_len = server->total_read - 4;15191519 cifs_dbg(FYI, "0: iov_base=%p iov_len=%u\n",15201520 rdata->iov[0].iov_base, server->total_read);15211521+15221522+ mid->resp_buf = server->smallbuf;15231523+ server->smallbuf = NULL;1521152415221525 /* how much data is in the response? */15231526 data_len = server->ops->read_data_length(buf);
+11-2
fs/cifs/connect.c
···904904905905 server->lstrp = jiffies;906906 if (mid_entry != NULL) {907907+ if ((mid_entry->mid_flags & MID_WAIT_CANCELLED) &&908908+ mid_entry->mid_state == MID_RESPONSE_RECEIVED &&909909+ server->ops->handle_cancelled_mid)910910+ server->ops->handle_cancelled_mid(911911+ mid_entry->resp_buf,912912+ server);913913+907914 if (!mid_entry->multiRsp || mid_entry->multiEnd)908915 mid_entry->callback(mid_entry);909909- } else if (!server->ops->is_oplock_break ||910910- !server->ops->is_oplock_break(buf, server)) {916916+ } else if (server->ops->is_oplock_break &&917917+ server->ops->is_oplock_break(buf, server)) {918918+ cifs_dbg(FYI, "Received oplock break\n");919919+ } else {911920 cifs_dbg(VFS, "No task to wake, unknown frame received! NumMids %d\n",912921 atomic_read(&midCount));913922 cifs_dump_mem("Received Data is: ", buf,
+5-61
fs/cifs/ioctl.c
···3434#include "cifs_ioctl.h"3535#include <linux/btrfs.h>36363737-static int cifs_file_clone_range(unsigned int xid, struct file *src_file,3838- struct file *dst_file)3939-{4040- struct inode *src_inode = file_inode(src_file);4141- struct inode *target_inode = file_inode(dst_file);4242- struct cifsFileInfo *smb_file_src;4343- struct cifsFileInfo *smb_file_target;4444- struct cifs_tcon *src_tcon;4545- struct cifs_tcon *target_tcon;4646- int rc;4747-4848- cifs_dbg(FYI, "ioctl clone range\n");4949-5050- if (!src_file->private_data || !dst_file->private_data) {5151- rc = -EBADF;5252- cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");5353- goto out;5454- }5555-5656- rc = -EXDEV;5757- smb_file_target = dst_file->private_data;5858- smb_file_src = src_file->private_data;5959- src_tcon = tlink_tcon(smb_file_src->tlink);6060- target_tcon = tlink_tcon(smb_file_target->tlink);6161-6262- if (src_tcon->ses != target_tcon->ses) {6363- cifs_dbg(VFS, "source and target of copy not on same server\n");6464- goto out;6565- }6666-6767- /*6868- * Note: cifs case is easier than btrfs since server responsible for6969- * checks for proper open modes and file type and if it wants7070- * server could even support copy of range where source = target7171- */7272- lock_two_nondirectories(target_inode, src_inode);7373-7474- cifs_dbg(FYI, "about to flush pages\n");7575- /* should we flush first and last page first */7676- truncate_inode_pages(&target_inode->i_data, 0);7777-7878- if (target_tcon->ses->server->ops->clone_range)7979- rc = target_tcon->ses->server->ops->clone_range(xid,8080- smb_file_src, smb_file_target, 0, src_inode->i_size, 0);8181- else8282- rc = -EOPNOTSUPP;8383-8484- /* force revalidate of size and timestamps of target file now8585- that target is updated on the server */8686- CIFS_I(target_inode)->time = 0;8787- /* although unlocking in the reverse order from locking is not8888- strictly necessary here it is a little cleaner to be consistent */8989- unlock_two_nondirectories(src_inode, target_inode);9090-out:9191- return rc;9292-}9393-9494-static long cifs_ioctl_clone(unsigned int xid, struct file *dst_file,3737+static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file,9538 unsigned long srcfd)9639{9740 int rc;9841 struct fd src_file;9942 struct inode *src_inode;10043101101- cifs_dbg(FYI, "ioctl clone range\n");4444+ cifs_dbg(FYI, "ioctl copychunk range\n");10245 /* the destination must be opened for writing */10346 if (!(dst_file->f_mode & FMODE_WRITE)) {10447 cifs_dbg(FYI, "file target not open for write\n");···72129 if (S_ISDIR(src_inode->i_mode))73130 goto out_fput;741317575- rc = cifs_file_clone_range(xid, src_file.file, dst_file);132132+ rc = cifs_file_copychunk_range(xid, src_file.file, 0, dst_file, 0,133133+ src_inode->i_size, 0);7613477135out_fput:78136 fdput(src_file);···195251 }196252 break;197253 case CIFS_IOC_COPYCHUNK_FILE:198198- rc = cifs_ioctl_clone(xid, filep, arg);254254+ rc = cifs_ioctl_copychunk(xid, filep, arg);199255 break;200256 case CIFS_IOC_SET_INTEGRITY:201257 if (pSMBFile == NULL)
···373373 }374374 spin_lock_irq(&mapping->tree_lock);375375376376+ if (!entry) {377377+ /*378378+ * We needed to drop the page_tree lock while calling379379+ * radix_tree_preload() and we didn't have an entry to380380+ * lock. See if another thread inserted an entry at381381+ * our index during this time.382382+ */383383+ entry = __radix_tree_lookup(&mapping->page_tree, index,384384+ NULL, &slot);385385+ if (entry) {386386+ radix_tree_preload_end();387387+ spin_unlock_irq(&mapping->tree_lock);388388+ goto restart;389389+ }390390+ }391391+376392 if (pmd_downgrade) {377393 radix_tree_delete(&mapping->page_tree, index);378394 mapping->nrexceptional--;···404388 if (err) {405389 spin_unlock_irq(&mapping->tree_lock);406390 /*407407- * Someone already created the entry? This is a408408- * normal failure when inserting PMDs in a range409409- * that already contains PTEs. In that case we want410410- * to return -EEXIST immediately.411411- */412412- if (err == -EEXIST && !(size_flag & RADIX_DAX_PMD))413413- goto restart;414414- /*415415- * Our insertion of a DAX PMD entry failed, most416416- * likely because it collided with a PTE sized entry417417- * at a different index in the PMD range. We haven't418418- * inserted anything into the radix tree and have no419419- * waiters to wake.391391+ * Our insertion of a DAX entry failed, most likely392392+ * because we were inserting a PMD entry and it393393+ * collided with a PTE sized entry at a different394394+ * index in the PMD range. We haven't inserted395395+ * anything into the radix tree and have no waiters to396396+ * wake.420397 */421398 return ERR_PTR(err);422399 }
···695695696696 inode = new_inode(sb);697697 if (inode) {698698- struct hugetlbfs_inode_info *info;699698 inode->i_ino = get_next_ino();700699 inode->i_mode = S_IFDIR | config->mode;701700 inode->i_uid = config->uid;702701 inode->i_gid = config->gid;703702 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);704704- info = HUGETLBFS_I(inode);705705- mpol_shared_policy_init(&info->policy, NULL);706703 inode->i_op = &hugetlbfs_dir_inode_operations;707704 inode->i_fop = &simple_dir_operations;708705 /* directory inodes start off with i_nlink == 2 (for "." entry) */···730733731734 inode = new_inode(sb);732735 if (inode) {733733- struct hugetlbfs_inode_info *info;734736 inode->i_ino = get_next_ino();735737 inode_init_owner(inode, dir, mode);736738 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,···737741 inode->i_mapping->a_ops = &hugetlbfs_aops;738742 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);739743 inode->i_mapping->private_data = resv_map;740740- info = HUGETLBFS_I(inode);741741- /*742742- * The policy is initialized here even if we are creating a743743- * private inode because initialization simply creates an744744- * an empty rb tree and calls rwlock_init(), later when we745745- * call mpol_free_shared_policy() it will just return because746746- * the rb tree will still be empty.747747- */748748- mpol_shared_policy_init(&info->policy, NULL);749744 switch (mode & S_IFMT) {750745 default:751746 init_special_inode(inode, mode, dev);···924937 hugetlbfs_inc_free_inodes(sbinfo);925938 return NULL;926939 }940940+941941+ /*942942+ * Any time after allocation, hugetlbfs_destroy_inode can be called943943+ * for the inode. mpol_free_shared_policy is unconditionally called944944+ * as part of hugetlbfs_destroy_inode. So, initialize policy here945945+ * in case of a quick call to destroy.946946+ *947947+ * Note that the policy is initialized even if we are creating a948948+ * private inode. This simplifies hugetlbfs_destroy_inode.949949+ */950950+ mpol_shared_policy_init(&p->policy, NULL);951951+927952 return &p->vfs_inode;928953}929954
+2-7
fs/nfs/dir.c
···20552055{20562056 struct inode *old_inode = d_inode(old_dentry);20572057 struct inode *new_inode = d_inode(new_dentry);20582058- struct dentry *dentry = NULL, *rehash = NULL;20582058+ struct dentry *dentry = NULL;20592059 struct rpc_task *task;20602060 int error = -EBUSY;20612061···20782078 * To prevent any new references to the target during the20792079 * rename, we unhash the dentry in advance.20802080 */20812081- if (!d_unhashed(new_dentry)) {20812081+ if (!d_unhashed(new_dentry))20822082 d_drop(new_dentry);20832083- rehash = new_dentry;20842084- }2085208320862084 if (d_count(new_dentry) > 2) {20872085 int err;···20962098 goto out;2097209920982100 new_dentry = dentry;20992099- rehash = NULL;21002101 new_inode = NULL;21012102 }21022103 }···21162119 error = task->tk_status;21172120 rpc_put_task(task);21182121out:21192119- if (rehash)21202120- d_rehash(rehash);21212122 trace_nfs_rename_exit(old_dir, old_dentry,21222123 new_dir, new_dentry, error);21232124 /* new dentry created? */
+101-60
fs/nfs/filelayout/filelayout.c
···202202 task->tk_status);203203 nfs4_mark_deviceid_unavailable(devid);204204 pnfs_error_mark_layout_for_return(inode, lseg);205205- pnfs_set_lo_fail(lseg);206205 rpc_wake_up(&tbl->slot_tbl_waitq);207206 /* fall through */208207 default:208208+ pnfs_set_lo_fail(lseg);209209reset:210210 dprintk("%s Retry through MDS. Error %d\n", __func__,211211 task->tk_status);···560560 return PNFS_ATTEMPTED;561561}562562563563-/*564564- * filelayout_check_layout()565565- *566566- * Make sure layout segment parameters are sane WRT the device.567567- * At this point no generic layer initialization of the lseg has occurred,568568- * and nothing has been added to the layout_hdr cache.569569- *570570- */571563static int572572-filelayout_check_layout(struct pnfs_layout_hdr *lo,573573- struct nfs4_filelayout_segment *fl,574574- struct nfs4_layoutget_res *lgr,575575- struct nfs4_deviceid *id,576576- gfp_t gfp_flags)564564+filelayout_check_deviceid(struct pnfs_layout_hdr *lo,565565+ struct nfs4_filelayout_segment *fl,566566+ gfp_t gfp_flags)577567{578568 struct nfs4_deviceid_node *d;579569 struct nfs4_file_layout_dsaddr *dsaddr;580570 int status = -EINVAL;581571582582- dprintk("--> %s\n", __func__);583583-584584- /* FIXME: remove this check when layout segment support is added */585585- if (lgr->range.offset != 0 ||586586- lgr->range.length != NFS4_MAX_UINT64) {587587- dprintk("%s Only whole file layouts supported. Use MDS i/o\n",588588- __func__);589589- goto out;590590- }591591-592592- if (fl->pattern_offset > lgr->range.offset) {593593- dprintk("%s pattern_offset %lld too large\n",594594- __func__, fl->pattern_offset);595595- goto out;596596- }597597-598598- if (!fl->stripe_unit) {599599- dprintk("%s Invalid stripe unit (%u)\n",600600- __func__, fl->stripe_unit);601601- goto out;602602- }603603-604572 /* find and reference the deviceid */605605- d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), id,573573+ d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), &fl->deviceid,606574 lo->plh_lc_cred, gfp_flags);607575 if (d == NULL)608576 goto out;···596628 __func__, fl->num_fh);597629 goto out_put;598630 }631631+ status = 0;632632+out:633633+ return status;634634+out_put:635635+ nfs4_fl_put_deviceid(dsaddr);636636+ goto out;637637+}638638+639639+/*640640+ * filelayout_check_layout()641641+ *642642+ * Make sure layout segment parameters are sane WRT the device.643643+ * At this point no generic layer initialization of the lseg has occurred,644644+ * and nothing has been added to the layout_hdr cache.645645+ *646646+ */647647+static int648648+filelayout_check_layout(struct pnfs_layout_hdr *lo,649649+ struct nfs4_filelayout_segment *fl,650650+ struct nfs4_layoutget_res *lgr,651651+ gfp_t gfp_flags)652652+{653653+ int status = -EINVAL;654654+655655+ dprintk("--> %s\n", __func__);656656+657657+ /* FIXME: remove this check when layout segment support is added */658658+ if (lgr->range.offset != 0 ||659659+ lgr->range.length != NFS4_MAX_UINT64) {660660+ dprintk("%s Only whole file layouts supported. Use MDS i/o\n",661661+ __func__);662662+ goto out;663663+ }664664+665665+ if (fl->pattern_offset > lgr->range.offset) {666666+ dprintk("%s pattern_offset %lld too large\n",667667+ __func__, fl->pattern_offset);668668+ goto out;669669+ }670670+671671+ if (!fl->stripe_unit) {672672+ dprintk("%s Invalid stripe unit (%u)\n",673673+ __func__, fl->stripe_unit);674674+ goto out;675675+ }599676600677 status = 0;601678out:602679 dprintk("--> %s returns %d\n", __func__, status);603680 return status;604604-out_put:605605- nfs4_fl_put_deviceid(dsaddr);606606- goto out;607681}608682609683static void _filelayout_free_lseg(struct nfs4_filelayout_segment *fl)···667657filelayout_decode_layout(struct pnfs_layout_hdr *flo,668658 struct nfs4_filelayout_segment *fl,669659 struct nfs4_layoutget_res *lgr,670670- struct nfs4_deviceid *id,671660 gfp_t gfp_flags)672661{673662 struct xdr_stream stream;···691682 if (unlikely(!p))692683 goto out_err;693684694694- memcpy(id, p, sizeof(*id));685685+ memcpy(&fl->deviceid, p, sizeof(fl->deviceid));695686 p += XDR_QUADLEN(NFS4_DEVICEID4_SIZE);696696- nfs4_print_deviceid(id);687687+ nfs4_print_deviceid(&fl->deviceid);697688698689 nfl_util = be32_to_cpup(p++);699690 if (nfl_util & NFL4_UFLG_COMMIT_THRU_MDS)···840831{841832 struct nfs4_filelayout_segment *fl;842833 int rc;843843- struct nfs4_deviceid id;844834845835 dprintk("--> %s\n", __func__);846836 fl = kzalloc(sizeof(*fl), gfp_flags);847837 if (!fl)848838 return NULL;849839850850- rc = filelayout_decode_layout(layoutid, fl, lgr, &id, gfp_flags);851851- if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, &id, gfp_flags)) {840840+ rc = filelayout_decode_layout(layoutid, fl, lgr, gfp_flags);841841+ if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, gfp_flags)) {852842 _filelayout_free_lseg(fl);853843 return NULL;854844 }···896888 return min(stripe_unit - (unsigned int)stripe_offset, size);897889}898890891891+static struct pnfs_layout_segment *892892+fl_pnfs_update_layout(struct inode *ino,893893+ struct nfs_open_context *ctx,894894+ loff_t pos,895895+ u64 count,896896+ enum pnfs_iomode iomode,897897+ bool strict_iomode,898898+ gfp_t gfp_flags)899899+{900900+ struct pnfs_layout_segment *lseg = NULL;901901+ struct pnfs_layout_hdr *lo;902902+ struct nfs4_filelayout_segment *fl;903903+ int status;904904+905905+ lseg = pnfs_update_layout(ino, ctx, pos, count, iomode, strict_iomode,906906+ gfp_flags);907907+ if (!lseg)908908+ lseg = ERR_PTR(-ENOMEM);909909+ if (IS_ERR(lseg))910910+ goto out;911911+912912+ lo = NFS_I(ino)->layout;913913+ fl = FILELAYOUT_LSEG(lseg);914914+915915+ status = filelayout_check_deviceid(lo, fl, gfp_flags);916916+ if (status)917917+ lseg = ERR_PTR(status);918918+out:919919+ if (IS_ERR(lseg))920920+ pnfs_put_lseg(lseg);921921+ return lseg;922922+}923923+899924static void900925filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,901926 struct nfs_page *req)902927{903928 if (!pgio->pg_lseg) {904904- pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,905905- req->wb_context,906906- 0,907907- NFS4_MAX_UINT64,908908- IOMODE_READ,909909- false,910910- GFP_KERNEL);929929+ pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode,930930+ req->wb_context,931931+ 0,932932+ NFS4_MAX_UINT64,933933+ IOMODE_READ,934934+ false,935935+ GFP_KERNEL);911936 if (IS_ERR(pgio->pg_lseg)) {912937 pgio->pg_error = PTR_ERR(pgio->pg_lseg);913938 pgio->pg_lseg = NULL;···960919 int status;961920962921 if (!pgio->pg_lseg) {963963- pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,964964- req->wb_context,965965- 0,966966- NFS4_MAX_UINT64,967967- IOMODE_RW,968968- false,969969- GFP_NOFS);922922+ pgio->pg_lseg = fl_pnfs_update_layout(pgio->pg_inode,923923+ req->wb_context,924924+ 0,925925+ NFS4_MAX_UINT64,926926+ IOMODE_RW,927927+ false,928928+ GFP_NOFS);970929 if (IS_ERR(pgio->pg_lseg)) {971930 pgio->pg_error = PTR_ERR(pgio->pg_lseg);972931 pgio->pg_lseg = NULL;
+10-9
fs/nfs/filelayout/filelayout.h
···5555};56565757struct nfs4_filelayout_segment {5858- struct pnfs_layout_segment generic_hdr;5959- u32 stripe_type;6060- u32 commit_through_mds;6161- u32 stripe_unit;6262- u32 first_stripe_index;6363- u64 pattern_offset;6464- struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */6565- unsigned int num_fh;6666- struct nfs_fh **fh_array;5858+ struct pnfs_layout_segment generic_hdr;5959+ u32 stripe_type;6060+ u32 commit_through_mds;6161+ u32 stripe_unit;6262+ u32 first_stripe_index;6363+ u64 pattern_offset;6464+ struct nfs4_deviceid deviceid;6565+ struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */6666+ unsigned int num_fh;6767+ struct nfs_fh **fh_array;6768};68696970struct nfs4_filelayout {
···167167168168int nfsd_minorversion(u32 minorversion, enum vers_op change)169169{170170- if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)170170+ if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&171171+ change != NFSD_AVAIL)171172 return -1;172173 switch(change) {173174 case NFSD_SET:···416415417416void nfsd_reset_versions(void)418417{419419- int found_one = 0;420418 int i;421419422422- for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) {423423- if (nfsd_program.pg_vers[i])424424- found_one = 1;425425- }420420+ for (i = 0; i < NFSD_NRVERS; i++)421421+ if (nfsd_vers(i, NFSD_TEST))422422+ return;426423427427- if (!found_one) {428428- for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++)429429- nfsd_program.pg_vers[i] = nfsd_version[i];430430-#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)431431- for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++)432432- nfsd_acl_program.pg_vers[i] =433433- nfsd_acl_version[i];434434-#endif435435- }424424+ for (i = 0; i < NFSD_NRVERS; i++)425425+ if (i != 4)426426+ nfsd_vers(i, NFSD_SET);427427+ else {428428+ int minor = 0;429429+ while (nfsd_minorversion(minor, NFSD_SET) >= 0)430430+ minor++;431431+ }436432}437433438434/*
+7-2
fs/orangefs/super.c
···263263 if (!new_op)264264 return -ENOMEM;265265 new_op->upcall.req.features.features = 0;266266- ret = service_operation(new_op, "orangefs_features", 0);267267- orangefs_features = new_op->downcall.resp.features.features;266266+ ret = service_operation(new_op, "orangefs_features",267267+ ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);268268+ if (!ret)269269+ orangefs_features =270270+ new_op->downcall.resp.features.features;271271+ else272272+ orangefs_features = 0;268273 op_release(new_op);269274 } else {270275 orangefs_features = 0;
···125125extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);126126extern int xfs_dir2_sf_removename(struct xfs_da_args *args);127127extern int xfs_dir2_sf_replace(struct xfs_da_args *args);128128-extern int xfs_dir2_sf_verify(struct xfs_mount *mp, struct xfs_dir2_sf_hdr *sfp,129129- int size);128128+extern int xfs_dir2_sf_verify(struct xfs_inode *ip);130129131130/* xfs_dir2_readdir.c */132131extern int xfs_readdir(struct xfs_inode *dp, struct dir_context *ctx,
+41-22
fs/xfs/libxfs/xfs_dir2_sf.c
···632632/* Verify the consistency of an inline directory. */633633int634634xfs_dir2_sf_verify(635635- struct xfs_mount *mp,636636- struct xfs_dir2_sf_hdr *sfp,637637- int size)635635+ struct xfs_inode *ip)638636{637637+ struct xfs_mount *mp = ip->i_mount;638638+ struct xfs_dir2_sf_hdr *sfp;639639 struct xfs_dir2_sf_entry *sfep;640640 struct xfs_dir2_sf_entry *next_sfep;641641 char *endp;642642 const struct xfs_dir_ops *dops;643643+ struct xfs_ifork *ifp;643644 xfs_ino_t ino;644645 int i;645646 int i8count;646647 int offset;648648+ int size;649649+ int error;647650 __uint8_t filetype;648651652652+ ASSERT(ip->i_d.di_format == XFS_DINODE_FMT_LOCAL);653653+ /*654654+ * xfs_iread calls us before xfs_setup_inode sets up ip->d_ops,655655+ * so we can only trust the mountpoint to have the right pointer.656656+ */649657 dops = xfs_dir_get_ops(mp, NULL);658658+659659+ ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);660660+ sfp = (struct xfs_dir2_sf_hdr *)ifp->if_u1.if_data;661661+ size = ifp->if_bytes;650662651663 /*652664 * Give up if the directory is way too short.653665 */654654- XFS_WANT_CORRUPTED_RETURN(mp, size >655655- offsetof(struct xfs_dir2_sf_hdr, parent));656656- XFS_WANT_CORRUPTED_RETURN(mp, size >=657657- xfs_dir2_sf_hdr_size(sfp->i8count));666666+ if (size <= offsetof(struct xfs_dir2_sf_hdr, parent) ||667667+ size < xfs_dir2_sf_hdr_size(sfp->i8count))668668+ return -EFSCORRUPTED;658669659670 endp = (char *)sfp + size;660671661672 /* Check .. entry */662673 ino = dops->sf_get_parent_ino(sfp);663674 i8count = ino > XFS_DIR2_MAX_SHORT_INUM;664664- XFS_WANT_CORRUPTED_RETURN(mp, !xfs_dir_ino_validate(mp, ino));675675+ error = xfs_dir_ino_validate(mp, ino);676676+ if (error)677677+ return error;665678 offset = dops->data_first_offset;666679667680 /* Check all reported entries */···685672 * Check the fixed-offset parts of the structure are686673 * within the data buffer.687674 */688688- XFS_WANT_CORRUPTED_RETURN(mp,689689- ((char *)sfep + sizeof(*sfep)) < endp);675675+ if (((char *)sfep + sizeof(*sfep)) >= endp)676676+ return -EFSCORRUPTED;690677691678 /* Don't allow names with known bad length. */692692- XFS_WANT_CORRUPTED_RETURN(mp, sfep->namelen > 0);693693- XFS_WANT_CORRUPTED_RETURN(mp, sfep->namelen < MAXNAMELEN);679679+ if (sfep->namelen == 0)680680+ return -EFSCORRUPTED;694681695682 /*696683 * Check that the variable-length part of the structure is···698685 * name component, so nextentry is an acceptable test.699686 */700687 next_sfep = dops->sf_nextentry(sfp, sfep);701701- XFS_WANT_CORRUPTED_RETURN(mp, endp >= (char *)next_sfep);688688+ if (endp < (char *)next_sfep)689689+ return -EFSCORRUPTED;702690703691 /* Check that the offsets always increase. */704704- XFS_WANT_CORRUPTED_RETURN(mp,705705- xfs_dir2_sf_get_offset(sfep) >= offset);692692+ if (xfs_dir2_sf_get_offset(sfep) < offset)693693+ return -EFSCORRUPTED;706694707695 /* Check the inode number. */708696 ino = dops->sf_get_ino(sfp, sfep);709697 i8count += ino > XFS_DIR2_MAX_SHORT_INUM;710710- XFS_WANT_CORRUPTED_RETURN(mp, !xfs_dir_ino_validate(mp, ino));698698+ error = xfs_dir_ino_validate(mp, ino);699699+ if (error)700700+ return error;711701712702 /* Check the file type. */713703 filetype = dops->sf_get_ftype(sfep);714714- XFS_WANT_CORRUPTED_RETURN(mp, filetype < XFS_DIR3_FT_MAX);704704+ if (filetype >= XFS_DIR3_FT_MAX)705705+ return -EFSCORRUPTED;715706716707 offset = xfs_dir2_sf_get_offset(sfep) +717708 dops->data_entsize(sfep->namelen);718709719710 sfep = next_sfep;720711 }721721- XFS_WANT_CORRUPTED_RETURN(mp, i8count == sfp->i8count);722722- XFS_WANT_CORRUPTED_RETURN(mp, (void *)sfep == (void *)endp);712712+ if (i8count != sfp->i8count)713713+ return -EFSCORRUPTED;714714+ if ((void *)sfep != (void *)endp)715715+ return -EFSCORRUPTED;723716724717 /* Make sure this whole thing ought to be in local format. */725725- XFS_WANT_CORRUPTED_RETURN(mp, offset +726726- (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) +727727- (uint)sizeof(xfs_dir2_block_tail_t) <= mp->m_dir_geo->blksize);718718+ if (offset + (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) +719719+ (uint)sizeof(xfs_dir2_block_tail_t) > mp->m_dir_geo->blksize)720720+ return -EFSCORRUPTED;728721729722 return 0;730723}
+13-22
fs/xfs/libxfs/xfs_inode_fork.c
···212212 if (error)213213 return error;214214215215+ /* Check inline dir contents. */216216+ if (S_ISDIR(VFS_I(ip)->i_mode) &&217217+ dip->di_format == XFS_DINODE_FMT_LOCAL) {218218+ error = xfs_dir2_sf_verify(ip);219219+ if (error) {220220+ xfs_idestroy_fork(ip, XFS_DATA_FORK);221221+ return error;222222+ }223223+ }224224+215225 if (xfs_is_reflink_inode(ip)) {216226 ASSERT(ip->i_cowfp == NULL);217227 xfs_ifork_init_cow(ip);···332322 int whichfork,333323 int size)334324{335335- int error;336336-337325 /*338326 * If the size is unreasonable, then something339327 * is wrong and we just bail out rather than crash in···345337 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,346338 ip->i_mount, dip);347339 return -EFSCORRUPTED;348348- }349349-350350- if (S_ISDIR(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK) {351351- error = xfs_dir2_sf_verify(ip->i_mount,352352- (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip),353353- size);354354- if (error)355355- return error;356340 }357341358342 xfs_init_local_fork(ip, whichfork, XFS_DFORK_PTR(dip, whichfork), size);···867867 * In these cases, the format always takes precedence, because the868868 * format indicates the current state of the fork.869869 */870870-int870870+void871871xfs_iflush_fork(872872 xfs_inode_t *ip,873873 xfs_dinode_t *dip,···877877 char *cp;878878 xfs_ifork_t *ifp;879879 xfs_mount_t *mp;880880- int error;881880 static const short brootflag[2] =882881 { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT };883882 static const short dataflag[2] =···885886 { XFS_ILOG_DEXT, XFS_ILOG_AEXT };886887887888 if (!iip)888888- return 0;889889+ return;889890 ifp = XFS_IFORK_PTR(ip, whichfork);890891 /*891892 * This can happen if we gave up in iformat in an error path,···893894 */894895 if (!ifp) {895896 ASSERT(whichfork == XFS_ATTR_FORK);896896- return 0;897897+ return;897898 }898899 cp = XFS_DFORK_PTR(dip, whichfork);899900 mp = ip->i_mount;900901 switch (XFS_IFORK_FORMAT(ip, whichfork)) {901902 case XFS_DINODE_FMT_LOCAL:902902- if (S_ISDIR(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK) {903903- error = xfs_dir2_sf_verify(mp,904904- (struct xfs_dir2_sf_hdr *)ifp->if_u1.if_data,905905- ifp->if_bytes);906906- if (error)907907- return error;908908- }909903 if ((iip->ili_fields & dataflag[whichfork]) &&910904 (ifp->if_bytes > 0)) {911905 ASSERT(ifp->if_u1.if_data != NULL);···951959 ASSERT(0);952960 break;953961 }954954- return 0;955962}956963957964/*
···13111311 /*13121312 * Now that we've unmap all full blocks we'll have to zero out any13131313 * partial block at the beginning and/or end. xfs_zero_range is13141314- * smart enough to skip any holes, including those we just created.13141314+ * smart enough to skip any holes, including those we just created,13151315+ * but we must take care not to zero beyond EOF and enlarge i_size.13151316 */13171317+13181318+ if (offset >= XFS_ISIZE(ip))13191319+ return 0;13201320+13211321+ if (offset + len > XFS_ISIZE(ip))13221322+ len = XFS_ISIZE(ip) - offset;13231323+13161324 return xfs_zero_range(ip, offset, len, NULL);13171325}13181326
+10-9
fs/xfs/xfs_inode.c
···5050#include "xfs_log.h"5151#include "xfs_bmap_btree.h"5252#include "xfs_reflink.h"5353+#include "xfs_dir2_priv.h"53545455kmem_zone_t *xfs_inode_zone;5556···34763475 struct xfs_inode_log_item *iip = ip->i_itemp;34773476 struct xfs_dinode *dip;34783477 struct xfs_mount *mp = ip->i_mount;34793479- int error;3480347834813479 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));34823480 ASSERT(xfs_isiflocked(ip));···35473547 if (ip->i_d.di_version < 3)35483548 ip->i_d.di_flushiter++;3549354935503550+ /* Check the inline directory data. */35513551+ if (S_ISDIR(VFS_I(ip)->i_mode) &&35523552+ ip->i_d.di_format == XFS_DINODE_FMT_LOCAL &&35533553+ xfs_dir2_sf_verify(ip))35543554+ goto corrupt_out;35553555+35503556 /*35513557 * Copy the dirty parts of the inode into the on-disk inode. We always35523558 * copy out the core of the inode, because if the inode is dirty at all···35643558 if (ip->i_d.di_flushiter == DI_MAX_FLUSH)35653559 ip->i_d.di_flushiter = 0;3566356035673567- error = xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK);35683568- if (error)35693569- return error;35703570- if (XFS_IFORK_Q(ip)) {35713571- error = xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK);35723572- if (error)35733573- return error;35743574- }35613561+ xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK);35623562+ if (XFS_IFORK_Q(ip))35633563+ xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK);35753564 xfs_inobp_check(mp, bp);3576356535773566 /*
+14
fs/xfs/xfs_iops.c
···516516 stat->blocks =517517 XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);518518519519+ if (ip->i_d.di_version == 3) {520520+ if (request_mask & STATX_BTIME) {521521+ stat->result_mask |= STATX_BTIME;522522+ stat->btime.tv_sec = ip->i_d.di_crtime.t_sec;523523+ stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec;524524+ }525525+ }526526+527527+ if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)528528+ stat->attributes |= STATX_ATTR_IMMUTABLE;529529+ if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)530530+ stat->attributes |= STATX_ATTR_APPEND;531531+ if (ip->i_d.di_flags & XFS_DIFLAG_NODUMP)532532+ stat->attributes |= STATX_ATTR_NODUMP;519533520534 switch (inode->i_mode & S_IFMT) {521535 case S_IFBLK:
···229229 * @ref_type: The type of reference.230230 * @existed: Upon completion, indicates that an identical reference object231231 * already existed, and the refcount was upped on that object instead.232232+ * @require_existed: Fail with -EPERM if an identical ref object didn't233233+ * already exist.232234 *233235 * Checks that the base object is shareable and adds a ref object to it.234236 *···245243 */246244extern int ttm_ref_object_add(struct ttm_object_file *tfile,247245 struct ttm_base_object *base,248248- enum ttm_ref_type ref_type, bool *existed);246246+ enum ttm_ref_type ref_type, bool *existed,247247+ bool require_existed);249248250249extern bool ttm_ref_object_exists(struct ttm_object_file *tfile,251250 struct ttm_base_object *base);
+1
include/kvm/arm_vgic.h
···295295void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu);296296int kvm_vgic_map_resources(struct kvm *kvm);297297int kvm_vgic_hyp_init(void);298298+void kvm_vgic_init_cpu_hardware(void);298299299300int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,300301 bool level);
···3535 * Max bus-specific overhead incurred by request/responses.3636 * I2C requires 1 additional byte for requests.3737 * I2C requires 2 additional bytes for responses.3838+ * SPI requires up to 32 additional bytes for responses.3839 * */3940#define EC_PROTO_VERSION_UNKNOWN 04041#define EC_MAX_REQUEST_OVERHEAD 14141-#define EC_MAX_RESPONSE_OVERHEAD 24242+#define EC_MAX_RESPONSE_OVERHEAD 3242434344/*4445 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
+2
include/linux/mm.h
···3232struct writeback_control;3333struct bdi_writeback;34343535+void init_mm_internals(void);3636+3537#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */3638extern unsigned long max_mapnr;3739
···145145extern int pinctrl_register_and_init(struct pinctrl_desc *pctldesc,146146 struct device *dev, void *driver_data,147147 struct pinctrl_dev **pctldev);148148+extern int pinctrl_enable(struct pinctrl_dev *pctldev);148149149149-/* Please use pinctrl_register_and_init() instead */150150+/* Please use pinctrl_register_and_init() and pinctrl_enable() instead */150151extern struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,151152 struct device *dev, void *driver_data);152153
+7-6
include/linux/sched/clock.h
···5454}5555#else5656extern void sched_clock_init_late(void);5757-/*5858- * Architectures can set this to 1 if they have specified5959- * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig,6060- * but then during bootup it turns out that sched_clock()6161- * is reliable after all:6262- */6357extern int sched_clock_stable(void);6458extern void clear_sched_clock_stable(void);5959+6060+/*6161+ * When sched_clock_stable(), __sched_clock_offset provides the offset6262+ * between local_clock() and sched_clock().6363+ */6464+extern u64 __sched_clock_offset;6565+65666667extern void sched_clock_tick(void);6768extern void sched_clock_idle_sleep_event(void);
···377377 __u64 hb_nonce;378378} sctp_sender_hb_info_t;379379380380-struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp);380380+int sctp_stream_new(struct sctp_association *asoc, gfp_t gfp);381381+int sctp_stream_init(struct sctp_association *asoc, gfp_t gfp);381382void sctp_stream_free(struct sctp_stream *stream);382383void sctp_stream_clear(struct sctp_stream *stream);383384···500499 /* Did the messenge fail to send? */501500 int send_error;502501 u8 send_failed:1,503503- force_delay:1,504502 can_delay; /* should this message be Nagle delayed */505503};506504···952952void sctp_transport_burst_limited(struct sctp_transport *);953953void sctp_transport_burst_reset(struct sctp_transport *);954954unsigned long sctp_transport_timeout(struct sctp_transport *);955955-void sctp_transport_reset(struct sctp_transport *);956956-void sctp_transport_update_pmtu(struct sock *, struct sctp_transport *, u32);955955+void sctp_transport_reset(struct sctp_transport *t);956956+void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu);957957void sctp_transport_immediate_rtx(struct sctp_transport *);958958void sctp_transport_dst_release(struct sctp_transport *t);959959void sctp_transport_dst_confirm(struct sctp_transport *t);···1878187818791879 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */18801880 temp:1, /* Is it a temporary association? */18811881+ force_delay:1,18811882 prsctp_enable:1,18821883 reconf_enable:1;18831884···1954195319551954__u32 sctp_association_get_next_tsn(struct sctp_association *);1956195519571957-void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);19561956+void sctp_assoc_sync_pmtu(struct sctp_association *asoc);19581957void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);19591958void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);19601959void sctp_assoc_set_primary(struct sctp_association *,
+3-2
include/uapi/linux/stat.h
···114114 __u64 stx_ino; /* Inode number */115115 __u64 stx_size; /* File size */116116 __u64 stx_blocks; /* Number of 512-byte blocks allocated */117117- __u64 __spare1[1];117117+ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */118118 /* 0x40 */119119 struct statx_timestamp stx_atime; /* Last access time */120120 struct statx_timestamp stx_btime; /* File creation time */···152152#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */153153#define STATX_BTIME 0x00000800U /* Want/got stx_btime */154154#define STATX_ALL 0x00000fffU /* All currently supported flags */155155+#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */155156156157/*157157- * Attributes to be found in stx_attributes158158+ * Attributes to be found in stx_attributes and masked in stx_attributes_mask.158159 *159160 * These give information about the features or the state of a file that might160161 * be of use to ordinary userspace programs such as GUIs or ls rather than
···184184185185 WARN_ON(!task->ptrace || task->parent != current);186186187187+ /*188188+ * PTRACE_LISTEN can allow ptrace_trap_notify to wake us up remotely.189189+ * Recheck state under the lock to close this race.190190+ */187191 spin_lock_irq(&task->sighand->siglock);188188- if (__fatal_signal_pending(task))189189- wake_up_state(task, __TASK_TRACED);190190- else191191- task->state = TASK_TRACED;192192+ if (task->state == __TASK_TRACED) {193193+ if (__fatal_signal_pending(task))194194+ wake_up_state(task, __TASK_TRACED);195195+ else196196+ task->state = TASK_TRACED;197197+ }192198 spin_unlock_irq(&task->sighand->siglock);193199}194200
···48264826 rb_data[cpu].cnt = cpu;48274827 rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu],48284828 "rbtester/%d", cpu);48294829- if (WARN_ON(!rb_threads[cpu])) {48294829+ if (WARN_ON(IS_ERR(rb_threads[cpu]))) {48304830 pr_cont("FAILED\n");48314831- ret = -1;48314831+ ret = PTR_ERR(rb_threads[cpu]);48324832 goto out_free;48334833 }48344834···4838483848394839 /* Now create the rb hammer! */48404840 rb_hammer = kthread_run(rb_hammer_test, NULL, "rbhammer");48414841- if (WARN_ON(!rb_hammer)) {48414841+ if (WARN_ON(IS_ERR(rb_hammer))) {48424842 pr_cont("FAILED\n");48434843- ret = -1;48434843+ ret = PTR_ERR(rb_hammer);48444844 goto out_free;48454845 }48464846
+1
lib/syscall.c
···12121313 if (!try_get_task_stack(target)) {1414 /* Task has no stack, so the task isn't in a syscall. */1515+ *sp = *pc = 0;1516 *callno = -1;1617 return 0;1718 }
+10
lib/test_kasan.c
···2020#include <linux/string.h>2121#include <linux/uaccess.h>2222#include <linux/module.h>2323+#include <linux/kasan.h>23242425/*2526 * Note: test functions are marked noinline so that their names appear in···475474476475static int __init kmalloc_tests_init(void)477476{477477+ /*478478+ * Temporarily enable multi-shot mode. Otherwise, we'd only get a479479+ * report for the first case.480480+ */481481+ bool multishot = kasan_save_enable_multi_shot();482482+478483 kmalloc_oob_right();479484 kmalloc_oob_left();480485 kmalloc_node_oob_right();···506499 ksize_unpoisons_memory();507500 copy_user_test();508501 use_after_scope_test();502502+503503+ kasan_restore_multi_shot(multishot);504504+509505 return -EAGAIN;510506}511507
···44034403 return 0;44044404out_err:44054405 if (!vma || vma->vm_flags & VM_MAYSHARE)44064406- region_abort(resv_map, from, to);44064406+ /* Don't call region_abort if region_chg failed */44074407+ if (chg >= 0)44084408+ region_abort(resv_map, from, to);44074409 if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER))44084410 kref_put(&resv_map->refs, resv_map_release);44094411 return ret;···46534651{46544652 struct page *page = NULL;46554653 spinlock_t *ptl;46544654+ pte_t pte;46564655retry:46574656 ptl = pmd_lockptr(mm, pmd);46584657 spin_lock(ptl);···46634660 */46644661 if (!pmd_huge(*pmd))46654662 goto out;46664666- if (pmd_present(*pmd)) {46634663+ pte = huge_ptep_get((pte_t *)pmd);46644664+ if (pte_present(pte)) {46674665 page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);46684666 if (flags & FOLL_GET)46694667 get_page(page);46704668 } else {46714671- if (is_hugetlb_entry_migration(huge_ptep_get((pte_t *)pmd))) {46694669+ if (is_hugetlb_entry_migration(pte)) {46724670 spin_unlock(ptl);46734671 __migration_entry_wait(mm, (pte_t *)pmd, ptl);46744672 goto retry;
+7
mm/internal.h
···481481enum ttu_flags;482482struct tlbflush_unmap_batch;483483484484+485485+/*486486+ * only for MM internal work items which do not depend on487487+ * any allocations or locks which might depend on allocations488488+ */489489+extern struct workqueue_struct *mm_percpu_wq;490490+484491#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH485492void try_to_unmap_flush(void);486493void try_to_unmap_flush_dirty(void);
···111111 if (pvmw->pmd && !pvmw->pte)112112 return not_found(pvmw);113113114114- /* Only for THP, seek to next pte entry makes sense */115115- if (pvmw->pte) {116116- if (!PageTransHuge(pvmw->page) || PageHuge(pvmw->page))117117- return not_found(pvmw);114114+ if (pvmw->pte)118115 goto next_pte;119119- }120116121117 if (unlikely(PageHuge(pvmw->page))) {122118 /* when pud is not present, pte will be NULL */···161165 while (1) {162166 if (check_pte(pvmw))163167 return true;164164-next_pte: do {168168+next_pte:169169+ /* Seek to next pte only makes sense for THP */170170+ if (!PageTransHuge(pvmw->page) || PageHuge(pvmw->page))171171+ return not_found(pvmw);172172+ do {165173 pvmw->address += PAGE_SIZE;166166- if (pvmw->address >=174174+ if (pvmw->address >= pvmw->vma->vm_end ||175175+ pvmw->address >=167176 __vma_address(pvmw->page, pvmw->vma) +168177 hpage_nr_pages(pvmw->page) * PAGE_SIZE)169178 return not_found(pvmw);
···126126#define REXMIT_LOST 1 /* retransmit packets marked lost */127127#define REXMIT_NEW 2 /* FRTO-style transmit of unsent/new packets */128128129129-static void tcp_gro_dev_warn(struct sock *sk, const struct sk_buff *skb)129129+static void tcp_gro_dev_warn(struct sock *sk, const struct sk_buff *skb,130130+ unsigned int len)130131{131132 static bool __once __read_mostly;132133···138137139138 rcu_read_lock();140139 dev = dev_get_by_index_rcu(sock_net(sk), skb->skb_iif);141141- pr_warn("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n",142142- dev ? dev->name : "Unknown driver");140140+ if (!dev || len >= dev->mtu)141141+ pr_warn("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n",142142+ dev ? dev->name : "Unknown driver");143143 rcu_read_unlock();144144 }145145}···163161 if (len >= icsk->icsk_ack.rcv_mss) {164162 icsk->icsk_ack.rcv_mss = min_t(unsigned int, len,165163 tcp_sk(sk)->advmss);166166- if (unlikely(icsk->icsk_ack.rcv_mss != len))167167- tcp_gro_dev_warn(sk, skb);164164+ /* Account for possibly-removed options */165165+ if (unlikely(len > icsk->icsk_ack.rcv_mss +166166+ MAX_TCP_OPTION_SPACE))167167+ tcp_gro_dev_warn(sk, skb, len);168168 } else {169169 /* Otherwise, we make more careful check taking into account,170170 * that SACKs block is variable.···878874 const int ts)879875{880876 struct tcp_sock *tp = tcp_sk(sk);881881- if (metric > tp->reordering) {882882- int mib_idx;877877+ int mib_idx;883878879879+ if (metric > tp->reordering) {884880 tp->reordering = min(sysctl_tcp_max_reordering, metric);885881886886- /* This exciting event is worth to be remembered. 8) */887887- if (ts)888888- mib_idx = LINUX_MIB_TCPTSREORDER;889889- else if (tcp_is_reno(tp))890890- mib_idx = LINUX_MIB_TCPRENOREORDER;891891- else if (tcp_is_fack(tp))892892- mib_idx = LINUX_MIB_TCPFACKREORDER;893893- else894894- mib_idx = LINUX_MIB_TCPSACKREORDER;895895-896896- NET_INC_STATS(sock_net(sk), mib_idx);897882#if FASTRETRANS_DEBUG > 1898883 pr_debug("Disorder%d %d %u f%u s%u rr%d\n",899884 tp->rx_opt.sack_ok, inet_csk(sk)->icsk_ca_state,···895902 }896903897904 tp->rack.reord = 1;905905+906906+ /* This exciting event is worth to be remembered. 8) */907907+ if (ts)908908+ mib_idx = LINUX_MIB_TCPTSREORDER;909909+ else if (tcp_is_reno(tp))910910+ mib_idx = LINUX_MIB_TCPRENOREORDER;911911+ else if (tcp_is_fack(tp))912912+ mib_idx = LINUX_MIB_TCPFACKREORDER;913913+ else914914+ mib_idx = LINUX_MIB_TCPSACKREORDER;915915+916916+ NET_INC_STATS(sock_net(sk), mib_idx);898917}899918900919/* This must be called before lost_out is incremented */
+2-1
net/ipv4/tcp_recovery.c
···1212 /* Account for retransmits that are lost again */1313 TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;1414 tp->retrans_out -= tcp_skb_pcount(skb);1515- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT);1515+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT,1616+ tcp_skb_pcount(skb));1617 }1718}1819
···278278}279279EXPORT_SYMBOL_GPL(l2tp_session_find);280280281281-struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)281281+/* Like l2tp_session_find() but takes a reference on the returned session.282282+ * Optionally calls session->ref() too if do_ref is true.283283+ */284284+struct l2tp_session *l2tp_session_get(struct net *net,285285+ struct l2tp_tunnel *tunnel,286286+ u32 session_id, bool do_ref)287287+{288288+ struct hlist_head *session_list;289289+ struct l2tp_session *session;290290+291291+ if (!tunnel) {292292+ struct l2tp_net *pn = l2tp_pernet(net);293293+294294+ session_list = l2tp_session_id_hash_2(pn, session_id);295295+296296+ rcu_read_lock_bh();297297+ hlist_for_each_entry_rcu(session, session_list, global_hlist) {298298+ if (session->session_id == session_id) {299299+ l2tp_session_inc_refcount(session);300300+ if (do_ref && session->ref)301301+ session->ref(session);302302+ rcu_read_unlock_bh();303303+304304+ return session;305305+ }306306+ }307307+ rcu_read_unlock_bh();308308+309309+ return NULL;310310+ }311311+312312+ session_list = l2tp_session_id_hash(tunnel, session_id);313313+ read_lock_bh(&tunnel->hlist_lock);314314+ hlist_for_each_entry(session, session_list, hlist) {315315+ if (session->session_id == session_id) {316316+ l2tp_session_inc_refcount(session);317317+ if (do_ref && session->ref)318318+ session->ref(session);319319+ read_unlock_bh(&tunnel->hlist_lock);320320+321321+ return session;322322+ }323323+ }324324+ read_unlock_bh(&tunnel->hlist_lock);325325+326326+ return NULL;327327+}328328+EXPORT_SYMBOL_GPL(l2tp_session_get);329329+330330+struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth,331331+ bool do_ref)282332{283333 int hash;284334 struct l2tp_session *session;···338288 for (hash = 0; hash < L2TP_HASH_SIZE; hash++) {339289 hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) {340290 if (++count > nth) {291291+ l2tp_session_inc_refcount(session);292292+ if (do_ref && session->ref)293293+ session->ref(session);341294 read_unlock_bh(&tunnel->hlist_lock);342295 return session;343296 }···351298352299 return NULL;353300}354354-EXPORT_SYMBOL_GPL(l2tp_session_find_nth);301301+EXPORT_SYMBOL_GPL(l2tp_session_get_nth);355302356303/* Lookup a session by interface name.357304 * This is very inefficient but is only used by management interfaces.358305 */359359-struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname)306306+struct l2tp_session *l2tp_session_get_by_ifname(struct net *net, char *ifname,307307+ bool do_ref)360308{361309 struct l2tp_net *pn = l2tp_pernet(net);362310 int hash;···367313 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) {368314 hlist_for_each_entry_rcu(session, &pn->l2tp_session_hlist[hash], global_hlist) {369315 if (!strcmp(session->ifname, ifname)) {316316+ l2tp_session_inc_refcount(session);317317+ if (do_ref && session->ref)318318+ session->ref(session);370319 rcu_read_unlock_bh();320320+371321 return session;372322 }373323 }···381323382324 return NULL;383325}384384-EXPORT_SYMBOL_GPL(l2tp_session_find_by_ifname);326326+EXPORT_SYMBOL_GPL(l2tp_session_get_by_ifname);327327+328328+static int l2tp_session_add_to_tunnel(struct l2tp_tunnel *tunnel,329329+ struct l2tp_session *session)330330+{331331+ struct l2tp_session *session_walk;332332+ struct hlist_head *g_head;333333+ struct hlist_head *head;334334+ struct l2tp_net *pn;335335+336336+ head = l2tp_session_id_hash(tunnel, session->session_id);337337+338338+ write_lock_bh(&tunnel->hlist_lock);339339+ hlist_for_each_entry(session_walk, head, hlist)340340+ if (session_walk->session_id == session->session_id)341341+ goto exist;342342+343343+ if (tunnel->version == L2TP_HDR_VER_3) {344344+ pn = l2tp_pernet(tunnel->l2tp_net);345345+ g_head = l2tp_session_id_hash_2(l2tp_pernet(tunnel->l2tp_net),346346+ session->session_id);347347+348348+ spin_lock_bh(&pn->l2tp_session_hlist_lock);349349+ hlist_for_each_entry(session_walk, g_head, global_hlist)350350+ if (session_walk->session_id == session->session_id)351351+ goto exist_glob;352352+353353+ hlist_add_head_rcu(&session->global_hlist, g_head);354354+ spin_unlock_bh(&pn->l2tp_session_hlist_lock);355355+ }356356+357357+ hlist_add_head(&session->hlist, head);358358+ write_unlock_bh(&tunnel->hlist_lock);359359+360360+ return 0;361361+362362+exist_glob:363363+ spin_unlock_bh(&pn->l2tp_session_hlist_lock);364364+exist:365365+ write_unlock_bh(&tunnel->hlist_lock);366366+367367+ return -EEXIST;368368+}385369386370/* Lookup a tunnel by id387371 */···733633 * a data (not control) frame before coming here. Fields up to the734634 * session-id have already been parsed and ptr points to the data735635 * after the session-id.636636+ *637637+ * session->ref() must have been called prior to l2tp_recv_common().638638+ * session->deref() will be called automatically after skb is processed.736639 */737640void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,738641 unsigned char *ptr, unsigned char *optr, u16 hdrflags,···744641 struct l2tp_tunnel *tunnel = session->tunnel;745642 int offset;746643 u32 ns, nr;747747-748748- /* The ref count is increased since we now hold a pointer to749749- * the session. Take care to decrement the refcnt when exiting750750- * this function from now on...751751- */752752- l2tp_session_inc_refcount(session);753753- if (session->ref)754754- (*session->ref)(session);755644756645 /* Parse and check optional cookie */757646 if (session->peer_cookie_len > 0) {···897802 /* Try to dequeue as many skbs from reorder_q as we can. */898803 l2tp_recv_dequeue(session);899804900900- l2tp_session_dec_refcount(session);901901-902805 return;903806904807discard:···905812906813 if (session->deref)907814 (*session->deref)(session);908908-909909- l2tp_session_dec_refcount(session);910815}911816EXPORT_SYMBOL(l2tp_recv_common);912817···1011920 }10129211013922 /* Find the session context */10141014- session = l2tp_session_find(tunnel->l2tp_net, tunnel, session_id);923923+ session = l2tp_session_get(tunnel->l2tp_net, tunnel, session_id, true);1015924 if (!session || !session->recv_skb) {925925+ if (session) {926926+ if (session->deref)927927+ session->deref(session);928928+ l2tp_session_dec_refcount(session);929929+ }930930+1016931 /* Not found? Pass to userspace to deal with */1017932 l2tp_info(tunnel, L2TP_MSG_DATA,1018933 "%s: no session found (%u/%u). Passing up.\n",···1027930 }10289311029932 l2tp_recv_common(session, skb, ptr, optr, hdrflags, length, payload_hook);933933+ l2tp_session_dec_refcount(session);10309341031935 return 0;1032936···18361738struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg)18371739{18381740 struct l2tp_session *session;17411741+ int err;1839174218401743 session = kzalloc(sizeof(struct l2tp_session) + priv_size, GFP_KERNEL);18411744 if (session != NULL) {···1892179318931794 l2tp_session_set_header_len(session, tunnel->version);1894179517961796+ err = l2tp_session_add_to_tunnel(tunnel, session);17971797+ if (err) {17981798+ kfree(session);17991799+18001800+ return ERR_PTR(err);18011801+ }18021802+18951803 /* Bump the reference count. The session context is deleted18961804 * only when this drops to zero.18971805 */···19081802 /* Ensure tunnel socket isn't deleted */19091803 sock_hold(tunnel->sock);1910180419111911- /* Add session to the tunnel's hash list */19121912- write_lock_bh(&tunnel->hlist_lock);19131913- hlist_add_head(&session->hlist,19141914- l2tp_session_id_hash(tunnel, session_id));19151915- write_unlock_bh(&tunnel->hlist_lock);19161916-19171917- /* And to the global session list if L2TPv3 */19181918- if (tunnel->version != L2TP_HDR_VER_2) {19191919- struct l2tp_net *pn = l2tp_pernet(tunnel->l2tp_net);19201920-19211921- spin_lock_bh(&pn->l2tp_session_hlist_lock);19221922- hlist_add_head_rcu(&session->global_hlist,19231923- l2tp_session_id_hash_2(pn, session_id));19241924- spin_unlock_bh(&pn->l2tp_session_hlist_lock);19251925- }19261926-19271805 /* Ignore management session in session count value */19281806 if (session->session_id != 0)19291807 atomic_inc(&l2tp_session_count);18081808+18091809+ return session;19301810 }1931181119321932- return session;18121812+ return ERR_PTR(-ENOMEM);19331813}19341814EXPORT_SYMBOL_GPL(l2tp_session_create);19351815
+7-2
net/l2tp/l2tp_core.h
···230230 return tunnel;231231}232232233233+struct l2tp_session *l2tp_session_get(struct net *net,234234+ struct l2tp_tunnel *tunnel,235235+ u32 session_id, bool do_ref);233236struct l2tp_session *l2tp_session_find(struct net *net,234237 struct l2tp_tunnel *tunnel,235238 u32 session_id);236236-struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth);237237-struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname);239239+struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth,240240+ bool do_ref);241241+struct l2tp_session *l2tp_session_get_by_ifname(struct net *net, char *ifname,242242+ bool do_ref);238243struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id);239244struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth);240245
+7-3
net/l2tp/l2tp_debugfs.c
···53535454static void l2tp_dfs_next_session(struct l2tp_dfs_seq_data *pd)5555{5656- pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);5656+ pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx, true);5757 pd->session_idx++;58585959 if (pd->session == NULL) {···238238 }239239240240 /* Show the tunnel or session context */241241- if (pd->session == NULL)241241+ if (!pd->session) {242242 l2tp_dfs_seq_tunnel_show(m, pd->tunnel);243243- else243243+ } else {244244 l2tp_dfs_seq_session_show(m, pd->session);245245+ if (pd->session->deref)246246+ pd->session->deref(pd->session);247247+ l2tp_session_dec_refcount(pd->session);248248+ }245249246250out:247251 return 0;
+2-8
net/l2tp/l2tp_eth.c
···221221 goto out;222222 }223223224224- session = l2tp_session_find(net, tunnel, session_id);225225- if (session) {226226- rc = -EEXIST;227227- goto out;228228- }229229-230224 if (cfg->ifname) {231225 dev = dev_get_by_name(net, cfg->ifname);232226 if (dev) {···234240235241 session = l2tp_session_create(sizeof(*spriv), tunnel, session_id,236242 peer_session_id, cfg);237237- if (!session) {238238- rc = -ENOMEM;243243+ if (IS_ERR(session)) {244244+ rc = PTR_ERR(session);239245 goto out;240246 }241247
+15-7
net/l2tp/l2tp_ip.c
···143143 }144144145145 /* Ok, this is a data packet. Lookup the session. */146146- session = l2tp_session_find(net, NULL, session_id);147147- if (session == NULL)146146+ session = l2tp_session_get(net, NULL, session_id, true);147147+ if (!session)148148 goto discard;149149150150 tunnel = session->tunnel;151151- if (tunnel == NULL)152152- goto discard;151151+ if (!tunnel)152152+ goto discard_sess;153153154154 /* Trace packet contents, if enabled */155155 if (tunnel->debug & L2TP_MSG_DATA) {156156 length = min(32u, skb->len);157157 if (!pskb_may_pull(skb, length))158158- goto discard;158158+ goto discard_sess;159159160160 /* Point to L2TP header */161161 optr = ptr = skb->data;···165165 }166166167167 l2tp_recv_common(session, skb, ptr, optr, 0, skb->len, tunnel->recv_payload_hook);168168+ l2tp_session_dec_refcount(session);168169169170 return 0;170171···179178180179 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);181180 tunnel = l2tp_tunnel_find(net, tunnel_id);182182- if (tunnel != NULL)181181+ if (tunnel) {183182 sk = tunnel->sock;184184- else {183183+ sock_hold(sk);184184+ } else {185185 struct iphdr *iph = (struct iphdr *) skb_network_header(skb);186186187187 read_lock_bh(&l2tp_ip_lock);···203201 nf_reset(skb);204202205203 return sk_receive_skb(sk, skb, 1);204204+205205+discard_sess:206206+ if (session->deref)207207+ session->deref(session);208208+ l2tp_session_dec_refcount(session);209209+ goto discard;206210207211discard_put:208212 sock_put(sk);
+16-7
net/l2tp/l2tp_ip6.c
···156156 }157157158158 /* Ok, this is a data packet. Lookup the session. */159159- session = l2tp_session_find(net, NULL, session_id);160160- if (session == NULL)159159+ session = l2tp_session_get(net, NULL, session_id, true);160160+ if (!session)161161 goto discard;162162163163 tunnel = session->tunnel;164164- if (tunnel == NULL)165165- goto discard;164164+ if (!tunnel)165165+ goto discard_sess;166166167167 /* Trace packet contents, if enabled */168168 if (tunnel->debug & L2TP_MSG_DATA) {169169 length = min(32u, skb->len);170170 if (!pskb_may_pull(skb, length))171171- goto discard;171171+ goto discard_sess;172172173173 /* Point to L2TP header */174174 optr = ptr = skb->data;···179179180180 l2tp_recv_common(session, skb, ptr, optr, 0, skb->len,181181 tunnel->recv_payload_hook);182182+ l2tp_session_dec_refcount(session);183183+182184 return 0;183185184186pass_up:···193191194192 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);195193 tunnel = l2tp_tunnel_find(net, tunnel_id);196196- if (tunnel != NULL)194194+ if (tunnel) {197195 sk = tunnel->sock;198198- else {196196+ sock_hold(sk);197197+ } else {199198 struct ipv6hdr *iph = ipv6_hdr(skb);200199201200 read_lock_bh(&l2tp_ip6_lock);···217214 nf_reset(skb);218215219216 return sk_receive_skb(sk, skb, 1);217217+218218+discard_sess:219219+ if (session->deref)220220+ session->deref(session);221221+ l2tp_session_dec_refcount(session);222222+ goto discard;220223221224discard_put:222225 sock_put(sk);
···450450static void pppol2tp_session_destruct(struct sock *sk)451451{452452 struct l2tp_session *session = sk->sk_user_data;453453+454454+ skb_queue_purge(&sk->sk_receive_queue);455455+ skb_queue_purge(&sk->sk_write_queue);456456+453457 if (session) {454458 sk->sk_user_data = NULL;455459 BUG_ON(session->magic != L2TP_SESSION_MAGIC);···492488 l2tp_session_queue_purge(session);493489 sock_put(sk);494490 }495495- skb_queue_purge(&sk->sk_receive_queue);496496- skb_queue_purge(&sk->sk_write_queue);497497-498491 release_sock(sk);499492500493 /* This will delete the session context via···583582 int error = 0;584583 u32 tunnel_id, peer_tunnel_id;585584 u32 session_id, peer_session_id;585585+ bool drop_refcnt = false;586586 int ver = 2;587587 int fd;588588···685683 if (tunnel->peer_tunnel_id == 0)686684 tunnel->peer_tunnel_id = peer_tunnel_id;687685688688- /* Create session if it doesn't already exist. We handle the689689- * case where a session was previously created by the netlink690690- * interface by checking that the session doesn't already have691691- * a socket and its tunnel socket are what we expect. If any692692- * of those checks fail, return EEXIST to the caller.693693- */694694- session = l2tp_session_find(sock_net(sk), tunnel, session_id);695695- if (session == NULL) {696696- /* Default MTU must allow space for UDP/L2TP/PPP697697- * headers.698698- */699699- cfg.mtu = cfg.mru = 1500 - PPPOL2TP_HEADER_OVERHEAD;686686+ session = l2tp_session_get(sock_net(sk), tunnel, session_id, false);687687+ if (session) {688688+ drop_refcnt = true;689689+ ps = l2tp_session_priv(session);700690701701- /* Allocate and initialize a new session context. */702702- session = l2tp_session_create(sizeof(struct pppol2tp_session),703703- tunnel, session_id,704704- peer_session_id, &cfg);705705- if (session == NULL) {706706- error = -ENOMEM;691691+ /* Using a pre-existing session is fine as long as it hasn't692692+ * been connected yet.693693+ */694694+ if (ps->sock) {695695+ error = -EEXIST;696696+ goto end;697697+ }698698+699699+ /* consistency checks */700700+ if (ps->tunnel_sock != tunnel->sock) {701701+ error = -EEXIST;707702 goto end;708703 }709704 } else {710710- ps = l2tp_session_priv(session);711711- error = -EEXIST;712712- if (ps->sock != NULL)713713- goto end;705705+ /* Default MTU must allow space for UDP/L2TP/PPP headers */706706+ cfg.mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;707707+ cfg.mru = cfg.mtu;714708715715- /* consistency checks */716716- if (ps->tunnel_sock != tunnel->sock)709709+ session = l2tp_session_create(sizeof(struct pppol2tp_session),710710+ tunnel, session_id,711711+ peer_session_id, &cfg);712712+ if (IS_ERR(session)) {713713+ error = PTR_ERR(session);717714 goto end;715715+ }718716 }719717720718 /* Associate session with its PPPoL2TP socket */···779777 session->name);780778781779end:780780+ if (drop_refcnt)781781+ l2tp_session_dec_refcount(session);782782 release_sock(sk);783783784784 return error;···808804 if (tunnel->sock == NULL)809805 goto out;810806811811- /* Check that this session doesn't already exist */812812- error = -EEXIST;813813- session = l2tp_session_find(net, tunnel, session_id);814814- if (session != NULL)815815- goto out;816816-817807 /* Default MTU values. */818808 if (cfg->mtu == 0)819809 cfg->mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;···815817 cfg->mru = cfg->mtu;816818817819 /* Allocate and initialize a new session context. */818818- error = -ENOMEM;819820 session = l2tp_session_create(sizeof(struct pppol2tp_session),820821 tunnel, session_id,821822 peer_session_id, cfg);822822- if (session == NULL)823823+ if (IS_ERR(session)) {824824+ error = PTR_ERR(session);823825 goto out;826826+ }824827825828 ps = l2tp_session_priv(session);826829 ps->tunnel_sock = tunnel->sock;···11391140 if (stats.session_id != 0) {11401141 /* resend to session ioctl handler */11411142 struct l2tp_session *session =11421142- l2tp_session_find(sock_net(sk), tunnel, stats.session_id);11431143- if (session != NULL)11441144- err = pppol2tp_session_ioctl(session, cmd, arg);11451145- else11431143+ l2tp_session_get(sock_net(sk), tunnel,11441144+ stats.session_id, true);11451145+11461146+ if (session) {11471147+ err = pppol2tp_session_ioctl(session, cmd,11481148+ arg);11491149+ if (session->deref)11501150+ session->deref(session);11511151+ l2tp_session_dec_refcount(session);11521152+ } else {11461153 err = -EBADR;11541154+ }11471155 break;11481156 }11491157#ifdef CONFIG_XFRM···1560155415611555static void pppol2tp_next_session(struct net *net, struct pppol2tp_seq_data *pd)15621556{15631563- pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);15571557+ pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx, true);15641558 pd->session_idx++;1565155915661560 if (pd->session == NULL) {···1687168116881682 /* Show the tunnel or session context.16891683 */16901690- if (pd->session == NULL)16841684+ if (!pd->session) {16911685 pppol2tp_seq_tunnel_show(m, pd->tunnel);16921692- else16861686+ } else {16931687 pppol2tp_seq_session_show(m, pd->session);16881688+ if (pd->session->deref)16891689+ pd->session->deref(pd->session);16901690+ l2tp_session_dec_refcount(pd->session);16911691+ }1694169216951693out:16961694 return 0;···18531843MODULE_LICENSE("GPL");18541844MODULE_VERSION(PPPOL2TP_DRV_VERSION);18551845MODULE_ALIAS_NET_PF_PROTO(PF_PPPOX, PX_PROTO_OL2TP);18561856-MODULE_ALIAS_L2TP_PWTYPE(11);18461846+MODULE_ALIAS_L2TP_PWTYPE(7);
+2-1
net/mac80211/iface.c
···718718 ieee80211_recalc_ps(local);719719720720 if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||721721- sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {721721+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||722722+ local->ops->wake_tx_queue) {722723 /* XXX: for AP_VLAN, actually track AP queues */723724 netif_tx_start_all_queues(dev);724725 } else if (dev) {
+2
net/netfilter/nf_conntrack_ecache.c
···290290 BUG_ON(notify != new);291291 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL);292292 mutex_unlock(&nf_ct_ecache_mutex);293293+ /* synchronize_rcu() is called from ctnetlink_exit. */293294}294295EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);295296···327326 BUG_ON(notify != new);328327 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL);329328 mutex_unlock(&nf_ct_ecache_mutex);329329+ /* synchronize_rcu() is called from ctnetlink_exit. */330330}331331EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier);332332
+10-3
net/netfilter/nf_conntrack_extend.c
···53535454 rcu_read_lock();5555 t = rcu_dereference(nf_ct_ext_types[id]);5656- BUG_ON(t == NULL);5656+ if (!t) {5757+ rcu_read_unlock();5858+ return NULL;5959+ }6060+5761 off = ALIGN(sizeof(struct nf_ct_ext), t->align);5862 len = off + t->len + var_alloc_len;5963 alloc_size = t->alloc_size + var_alloc_len;···92889389 rcu_read_lock();9490 t = rcu_dereference(nf_ct_ext_types[id]);9595- BUG_ON(t == NULL);9191+ if (!t) {9292+ rcu_read_unlock();9393+ return NULL;9494+ }96959796 newoff = ALIGN(old->len, t->align);9897 newlen = newoff + t->len + var_alloc_len;···182175 RCU_INIT_POINTER(nf_ct_ext_types[type->id], NULL);183176 update_alloc_size(type);184177 mutex_unlock(&nf_ct_ext_type_mutex);185185- rcu_barrier(); /* Wait for completion of call_rcu()'s */178178+ synchronize_rcu();186179}187180EXPORT_SYMBOL_GPL(nf_ct_extend_unregister);
···903903#ifdef CONFIG_XFRM904904 RCU_INIT_POINTER(nf_nat_decode_session_hook, NULL);905905#endif906906+ synchronize_rcu();907907+906908 for (i = 0; i < NFPROTO_NUMPROTO; i++)907909 kfree(nf_nat_l4protos[i]);908910
+184-109
net/netfilter/nfnetlink_cthelper.c
···3232MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");3333MODULE_DESCRIPTION("nfnl_cthelper: User-space connection tracking helpers");34343535+struct nfnl_cthelper {3636+ struct list_head list;3737+ struct nf_conntrack_helper helper;3838+};3939+4040+static LIST_HEAD(nfnl_cthelper_list);4141+3542static int3643nfnl_userspace_cthelper(struct sk_buff *skb, unsigned int protoff,3744 struct nf_conn *ct, enum ip_conntrack_info ctinfo)···168161 int i, ret;169162 struct nf_conntrack_expect_policy *expect_policy;170163 struct nlattr *tb[NFCTH_POLICY_SET_MAX+1];164164+ unsigned int class_max;171165172166 ret = nla_parse_nested(tb, NFCTH_POLICY_SET_MAX, attr,173167 nfnl_cthelper_expect_policy_set);···178170 if (!tb[NFCTH_POLICY_SET_NUM])179171 return -EINVAL;180172181181- helper->expect_class_max =182182- ntohl(nla_get_be32(tb[NFCTH_POLICY_SET_NUM]));183183-184184- if (helper->expect_class_max != 0 &&185185- helper->expect_class_max > NF_CT_MAX_EXPECT_CLASSES)173173+ class_max = ntohl(nla_get_be32(tb[NFCTH_POLICY_SET_NUM]));174174+ if (class_max == 0)175175+ return -EINVAL;176176+ if (class_max > NF_CT_MAX_EXPECT_CLASSES)186177 return -EOVERFLOW;187178188179 expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) *189189- helper->expect_class_max, GFP_KERNEL);180180+ class_max, GFP_KERNEL);190181 if (expect_policy == NULL)191182 return -ENOMEM;192183193193- for (i=0; i<helper->expect_class_max; i++) {184184+ for (i = 0; i < class_max; i++) {194185 if (!tb[NFCTH_POLICY_SET+i])195186 goto err;196187···198191 if (ret < 0)199192 goto err;200193 }194194+195195+ helper->expect_class_max = class_max - 1;201196 helper->expect_policy = expect_policy;202197 return 0;203198err:···212203 struct nf_conntrack_tuple *tuple)213204{214205 struct nf_conntrack_helper *helper;206206+ struct nfnl_cthelper *nfcth;215207 int ret;216208217209 if (!tb[NFCTH_TUPLE] || !tb[NFCTH_POLICY] || !tb[NFCTH_PRIV_DATA_LEN])218210 return -EINVAL;219211220220- helper = kzalloc(sizeof(struct nf_conntrack_helper), GFP_KERNEL);221221- if (helper == NULL)212212+ nfcth = kzalloc(sizeof(*nfcth), GFP_KERNEL);213213+ if (nfcth == NULL)222214 return -ENOMEM;215215+ helper = &nfcth->helper;223216224217 ret = nfnl_cthelper_parse_expect_policy(helper, tb[NFCTH_POLICY]);225218 if (ret < 0)226226- goto err;219219+ goto err1;227220228221 strncpy(helper->name, nla_data(tb[NFCTH_NAME]), NF_CT_HELPER_NAME_LEN);229222 helper->data_len = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));···256245257246 ret = nf_conntrack_helper_register(helper);258247 if (ret < 0)259259- goto err;248248+ goto err2;249249+250250+ list_add_tail(&nfcth->list, &nfnl_cthelper_list);251251+ return 0;252252+err2:253253+ kfree(helper->expect_policy);254254+err1:255255+ kfree(nfcth);256256+ return ret;257257+}258258+259259+static int260260+nfnl_cthelper_update_policy_one(const struct nf_conntrack_expect_policy *policy,261261+ struct nf_conntrack_expect_policy *new_policy,262262+ const struct nlattr *attr)263263+{264264+ struct nlattr *tb[NFCTH_POLICY_MAX + 1];265265+ int err;266266+267267+ err = nla_parse_nested(tb, NFCTH_POLICY_MAX, attr,268268+ nfnl_cthelper_expect_pol);269269+ if (err < 0)270270+ return err;271271+272272+ if (!tb[NFCTH_POLICY_NAME] ||273273+ !tb[NFCTH_POLICY_EXPECT_MAX] ||274274+ !tb[NFCTH_POLICY_EXPECT_TIMEOUT])275275+ return -EINVAL;276276+277277+ if (nla_strcmp(tb[NFCTH_POLICY_NAME], policy->name))278278+ return -EBUSY;279279+280280+ new_policy->max_expected =281281+ ntohl(nla_get_be32(tb[NFCTH_POLICY_EXPECT_MAX]));282282+ new_policy->timeout =283283+ ntohl(nla_get_be32(tb[NFCTH_POLICY_EXPECT_TIMEOUT]));260284261285 return 0;262262-err:263263- kfree(helper);264264- return ret;286286+}287287+288288+static int nfnl_cthelper_update_policy_all(struct nlattr *tb[],289289+ struct nf_conntrack_helper *helper)290290+{291291+ struct nf_conntrack_expect_policy new_policy[helper->expect_class_max + 1];292292+ struct nf_conntrack_expect_policy *policy;293293+ int i, err;294294+295295+ /* Check first that all policy attributes are well-formed, so we don't296296+ * leave things in inconsistent state on errors.297297+ */298298+ for (i = 0; i < helper->expect_class_max + 1; i++) {299299+300300+ if (!tb[NFCTH_POLICY_SET + i])301301+ return -EINVAL;302302+303303+ err = nfnl_cthelper_update_policy_one(&helper->expect_policy[i],304304+ &new_policy[i],305305+ tb[NFCTH_POLICY_SET + i]);306306+ if (err < 0)307307+ return err;308308+ }309309+ /* Now we can safely update them. */310310+ for (i = 0; i < helper->expect_class_max + 1; i++) {311311+ policy = (struct nf_conntrack_expect_policy *)312312+ &helper->expect_policy[i];313313+ policy->max_expected = new_policy->max_expected;314314+ policy->timeout = new_policy->timeout;315315+ }316316+317317+ return 0;318318+}319319+320320+static int nfnl_cthelper_update_policy(struct nf_conntrack_helper *helper,321321+ const struct nlattr *attr)322322+{323323+ struct nlattr *tb[NFCTH_POLICY_SET_MAX + 1];324324+ unsigned int class_max;325325+ int err;326326+327327+ err = nla_parse_nested(tb, NFCTH_POLICY_SET_MAX, attr,328328+ nfnl_cthelper_expect_policy_set);329329+ if (err < 0)330330+ return err;331331+332332+ if (!tb[NFCTH_POLICY_SET_NUM])333333+ return -EINVAL;334334+335335+ class_max = ntohl(nla_get_be32(tb[NFCTH_POLICY_SET_NUM]));336336+ if (helper->expect_class_max + 1 != class_max)337337+ return -EBUSY;338338+339339+ return nfnl_cthelper_update_policy_all(tb, helper);265340}266341267342static int···360263 return -EBUSY;361264362265 if (tb[NFCTH_POLICY]) {363363- ret = nfnl_cthelper_parse_expect_policy(helper,364364- tb[NFCTH_POLICY]);266266+ ret = nfnl_cthelper_update_policy(helper, tb[NFCTH_POLICY]);365267 if (ret < 0)366268 return ret;367269 }···389293 const char *helper_name;390294 struct nf_conntrack_helper *cur, *helper = NULL;391295 struct nf_conntrack_tuple tuple;392392- int ret = 0, i;296296+ struct nfnl_cthelper *nlcth;297297+ int ret = 0;393298394299 if (!tb[NFCTH_NAME] || !tb[NFCTH_TUPLE])395300 return -EINVAL;···401304 if (ret < 0)402305 return ret;403306404404- rcu_read_lock();405405- for (i = 0; i < nf_ct_helper_hsize && !helper; i++) {406406- hlist_for_each_entry_rcu(cur, &nf_ct_helper_hash[i], hnode) {307307+ list_for_each_entry(nlcth, &nfnl_cthelper_list, list) {308308+ cur = &nlcth->helper;407309408408- /* skip non-userspace conntrack helpers. */409409- if (!(cur->flags & NF_CT_HELPER_F_USERSPACE))410410- continue;310310+ if (strncmp(cur->name, helper_name, NF_CT_HELPER_NAME_LEN))311311+ continue;411312412412- if (strncmp(cur->name, helper_name,413413- NF_CT_HELPER_NAME_LEN) != 0)414414- continue;313313+ if ((tuple.src.l3num != cur->tuple.src.l3num ||314314+ tuple.dst.protonum != cur->tuple.dst.protonum))315315+ continue;415316416416- if ((tuple.src.l3num != cur->tuple.src.l3num ||417417- tuple.dst.protonum != cur->tuple.dst.protonum))418418- continue;317317+ if (nlh->nlmsg_flags & NLM_F_EXCL)318318+ return -EEXIST;419319420420- if (nlh->nlmsg_flags & NLM_F_EXCL) {421421- ret = -EEXIST;422422- goto err;423423- }424424- helper = cur;425425- break;426426- }320320+ helper = cur;321321+ break;427322 }428428- rcu_read_unlock();429323430324 if (helper == NULL)431325 ret = nfnl_cthelper_create(tb, &tuple);432326 else433327 ret = nfnl_cthelper_update(tb, helper);434328435435- return ret;436436-err:437437- rcu_read_unlock();438329 return ret;439330}440331···462377 goto nla_put_failure;463378464379 if (nla_put_be32(skb, NFCTH_POLICY_SET_NUM,465465- htonl(helper->expect_class_max)))380380+ htonl(helper->expect_class_max + 1)))466381 goto nla_put_failure;467382468468- for (i=0; i<helper->expect_class_max; i++) {383383+ for (i = 0; i < helper->expect_class_max + 1; i++) {469384 nest_parms2 = nla_nest_start(skb,470385 (NFCTH_POLICY_SET+i) | NLA_F_NESTED);471386 if (nest_parms2 == NULL)···587502 struct sk_buff *skb, const struct nlmsghdr *nlh,588503 const struct nlattr * const tb[])589504{590590- int ret = -ENOENT, i;505505+ int ret = -ENOENT;591506 struct nf_conntrack_helper *cur;592507 struct sk_buff *skb2;593508 char *helper_name = NULL;594509 struct nf_conntrack_tuple tuple;510510+ struct nfnl_cthelper *nlcth;595511 bool tuple_set = false;596512597513 if (nlh->nlmsg_flags & NLM_F_DUMP) {···613527 tuple_set = true;614528 }615529616616- for (i = 0; i < nf_ct_helper_hsize; i++) {617617- hlist_for_each_entry_rcu(cur, &nf_ct_helper_hash[i], hnode) {530530+ list_for_each_entry(nlcth, &nfnl_cthelper_list, list) {531531+ cur = &nlcth->helper;532532+ if (helper_name &&533533+ strncmp(cur->name, helper_name, NF_CT_HELPER_NAME_LEN))534534+ continue;618535619619- /* skip non-userspace conntrack helpers. */620620- if (!(cur->flags & NF_CT_HELPER_F_USERSPACE))621621- continue;536536+ if (tuple_set &&537537+ (tuple.src.l3num != cur->tuple.src.l3num ||538538+ tuple.dst.protonum != cur->tuple.dst.protonum))539539+ continue;622540623623- if (helper_name && strncmp(cur->name, helper_name,624624- NF_CT_HELPER_NAME_LEN) != 0) {625625- continue;626626- }627627- if (tuple_set &&628628- (tuple.src.l3num != cur->tuple.src.l3num ||629629- tuple.dst.protonum != cur->tuple.dst.protonum))630630- continue;631631-632632- skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);633633- if (skb2 == NULL) {634634- ret = -ENOMEM;635635- break;636636- }637637-638638- ret = nfnl_cthelper_fill_info(skb2, NETLINK_CB(skb).portid,639639- nlh->nlmsg_seq,640640- NFNL_MSG_TYPE(nlh->nlmsg_type),641641- NFNL_MSG_CTHELPER_NEW, cur);642642- if (ret <= 0) {643643- kfree_skb(skb2);644644- break;645645- }646646-647647- ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,648648- MSG_DONTWAIT);649649- if (ret > 0)650650- ret = 0;651651-652652- /* this avoids a loop in nfnetlink. */653653- return ret == -EAGAIN ? -ENOBUFS : ret;541541+ skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);542542+ if (skb2 == NULL) {543543+ ret = -ENOMEM;544544+ break;654545 }546546+547547+ ret = nfnl_cthelper_fill_info(skb2, NETLINK_CB(skb).portid,548548+ nlh->nlmsg_seq,549549+ NFNL_MSG_TYPE(nlh->nlmsg_type),550550+ NFNL_MSG_CTHELPER_NEW, cur);551551+ if (ret <= 0) {552552+ kfree_skb(skb2);553553+ break;554554+ }555555+556556+ ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,557557+ MSG_DONTWAIT);558558+ if (ret > 0)559559+ ret = 0;560560+561561+ /* this avoids a loop in nfnetlink. */562562+ return ret == -EAGAIN ? -ENOBUFS : ret;655563 }656564 return ret;657565}···656576{657577 char *helper_name = NULL;658578 struct nf_conntrack_helper *cur;659659- struct hlist_node *tmp;660579 struct nf_conntrack_tuple tuple;661580 bool tuple_set = false, found = false;662662- int i, j = 0, ret;581581+ struct nfnl_cthelper *nlcth, *n;582582+ int j = 0, ret;663583664584 if (tb[NFCTH_NAME])665585 helper_name = nla_data(tb[NFCTH_NAME]);···672592 tuple_set = true;673593 }674594675675- for (i = 0; i < nf_ct_helper_hsize; i++) {676676- hlist_for_each_entry_safe(cur, tmp, &nf_ct_helper_hash[i],677677- hnode) {678678- /* skip non-userspace conntrack helpers. */679679- if (!(cur->flags & NF_CT_HELPER_F_USERSPACE))680680- continue;595595+ list_for_each_entry_safe(nlcth, n, &nfnl_cthelper_list, list) {596596+ cur = &nlcth->helper;597597+ j++;681598682682- j++;599599+ if (helper_name &&600600+ strncmp(cur->name, helper_name, NF_CT_HELPER_NAME_LEN))601601+ continue;683602684684- if (helper_name && strncmp(cur->name, helper_name,685685- NF_CT_HELPER_NAME_LEN) != 0) {686686- continue;687687- }688688- if (tuple_set &&689689- (tuple.src.l3num != cur->tuple.src.l3num ||690690- tuple.dst.protonum != cur->tuple.dst.protonum))691691- continue;603603+ if (tuple_set &&604604+ (tuple.src.l3num != cur->tuple.src.l3num ||605605+ tuple.dst.protonum != cur->tuple.dst.protonum))606606+ continue;692607693693- found = true;694694- nf_conntrack_helper_unregister(cur);695695- }608608+ found = true;609609+ nf_conntrack_helper_unregister(cur);610610+ kfree(cur->expect_policy);611611+612612+ list_del(&nlcth->list);613613+ kfree(nlcth);696614 }615615+697616 /* Make sure we return success if we flush and there is no helpers */698617 return (found || j == 0) ? 0 : -ENOENT;699618}···741662static void __exit nfnl_cthelper_exit(void)742663{743664 struct nf_conntrack_helper *cur;744744- struct hlist_node *tmp;745745- int i;665665+ struct nfnl_cthelper *nlcth, *n;746666747667 nfnetlink_subsys_unregister(&nfnl_cthelper_subsys);748668749749- for (i=0; i<nf_ct_helper_hsize; i++) {750750- hlist_for_each_entry_safe(cur, tmp, &nf_ct_helper_hash[i],751751- hnode) {752752- /* skip non-userspace conntrack helpers. */753753- if (!(cur->flags & NF_CT_HELPER_F_USERSPACE))754754- continue;669669+ list_for_each_entry_safe(nlcth, n, &nfnl_cthelper_list, list) {670670+ cur = &nlcth->helper;755671756756- nf_conntrack_helper_unregister(cur);757757- }672672+ nf_conntrack_helper_unregister(cur);673673+ kfree(cur->expect_policy);674674+ kfree(nlcth);758675 }759676}760677
···527527528528 /* Link layer. */529529 clear_vlan(key);530530- if (key->mac_proto == MAC_PROTO_NONE) {530530+ if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) {531531 if (unlikely(eth_type_vlan(skb->protocol)))532532 return -EINVAL;533533···745745746746int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key)747747{748748- return key_extract(skb, key);748748+ int res;749749+750750+ res = key_extract(skb, key);751751+ if (!res)752752+ key->mac_proto &= ~SW_FLOW_KEY_INVALID;753753+754754+ return res;749755}750756751757static int key_extract_mac_proto(struct sk_buff *skb)
+6-2
net/packet/af_packet.c
···36653665 return -EBUSY;36663666 if (copy_from_user(&val, optval, sizeof(val)))36673667 return -EFAULT;36683668+ if (val > INT_MAX)36693669+ return -EINVAL;36683670 po->tp_reserve = val;36693671 return 0;36703672 }···41954193 if (unlikely(!PAGE_ALIGNED(req->tp_block_size)))41964194 goto out;41974195 if (po->tp_version >= TPACKET_V3 &&41984198- (int)(req->tp_block_size -41994199- BLK_PLUS_PRIV(req_u->req3.tp_sizeof_priv)) <= 0)41964196+ req->tp_block_size <=41974197+ BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv))42004198 goto out;42014199 if (unlikely(req->tp_frame_size < po->tp_hdrlen +42024200 po->tp_reserve))···4206420442074205 rb->frames_per_block = req->tp_block_size / req->tp_frame_size;42084206 if (unlikely(rb->frames_per_block == 0))42074207+ goto out;42084208+ if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr))42094209 goto out;42104210 if (unlikely((rb->frames_per_block * req->tp_block_nr) !=42114211 req->tp_frame_nr))
+9-4
net/sctp/associola.c
···246246 if (!sctp_ulpq_init(&asoc->ulpq, asoc))247247 goto fail_init;248248249249+ if (sctp_stream_new(asoc, gfp))250250+ goto fail_init;251251+249252 /* Assume that peer would support both address types unless we are250253 * told otherwise.251254 */···267264 /* AUTH related initializations */268265 INIT_LIST_HEAD(&asoc->endpoint_shared_keys);269266 if (sctp_auth_asoc_copy_shkeys(ep, asoc, gfp))270270- goto fail_init;267267+ goto stream_free;271268272269 asoc->active_key_id = ep->active_key_id;273270 asoc->prsctp_enable = ep->prsctp_enable;···290287291288 return asoc;292289290290+stream_free:291291+ sctp_stream_free(asoc->stream);293292fail_init:294293 sock_put(asoc->base.sk);295294 sctp_endpoint_put(asoc->ep);···14121407/* Update the association's pmtu and frag_point by going through all the14131408 * transports. This routine is called when a transport's PMTU has changed.14141409 */14151415-void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)14101410+void sctp_assoc_sync_pmtu(struct sctp_association *asoc)14161411{14171412 struct sctp_transport *t;14181413 __u32 pmtu = 0;···14241419 list_for_each_entry(t, &asoc->peer.transport_addr_list,14251420 transports) {14261421 if (t->pmtu_pending && t->dst) {14271427- sctp_transport_update_pmtu(sk, t,14281428- SCTP_TRUNC4(dst_mtu(t->dst)));14221422+ sctp_transport_update_pmtu(14231423+ t, SCTP_TRUNC4(dst_mtu(t->dst)));14291424 t->pmtu_pending = 0;14301425 }14311426 if (!pmtu || (t->pathmtu < pmtu))
+2-2
net/sctp/input.c
···401401402402 if (t->param_flags & SPP_PMTUD_ENABLE) {403403 /* Update transports view of the MTU */404404- sctp_transport_update_pmtu(sk, t, pmtu);404404+ sctp_transport_update_pmtu(t, pmtu);405405406406 /* Update association pmtu. */407407- sctp_assoc_sync_pmtu(sk, asoc);407407+ sctp_assoc_sync_pmtu(asoc);408408 }409409410410 /* Retransmit with the new pmtu setting.
+37-32
net/sctp/output.c
···8686{8787 struct sctp_transport *tp = packet->transport;8888 struct sctp_association *asoc = tp->asoc;8989+ struct sock *sk;89909091 pr_debug("%s: packet:%p vtag:0x%x\n", __func__, packet, vtag);9191-9292 packet->vtag = vtag;93939494- if (asoc && tp->dst) {9595- struct sock *sk = asoc->base.sk;9494+ /* do the following jobs only once for a flush schedule */9595+ if (!sctp_packet_empty(packet))9696+ return;96979797- rcu_read_lock();9898- if (__sk_dst_get(sk) != tp->dst) {9999- dst_hold(tp->dst);100100- sk_setup_caps(sk, tp->dst);101101- }9898+ /* set packet max_size with pathmtu */9999+ packet->max_size = tp->pathmtu;100100+ if (!asoc)101101+ return;102102103103- if (sk_can_gso(sk)) {104104- struct net_device *dev = tp->dst->dev;105105-106106- packet->max_size = dev->gso_max_size;107107- } else {108108- packet->max_size = asoc->pathmtu;109109- }110110- rcu_read_unlock();111111-112112- } else {113113- packet->max_size = tp->pathmtu;103103+ /* update dst or transport pathmtu if in need */104104+ sk = asoc->base.sk;105105+ if (!sctp_transport_dst_check(tp)) {106106+ sctp_transport_route(tp, NULL, sctp_sk(sk));107107+ if (asoc->param_flags & SPP_PMTUD_ENABLE)108108+ sctp_assoc_sync_pmtu(asoc);109109+ } else if (!sctp_transport_pmtu_check(tp)) {110110+ if (asoc->param_flags & SPP_PMTUD_ENABLE)111111+ sctp_assoc_sync_pmtu(asoc);114112 }115113116116- if (ecn_capable && sctp_packet_empty(packet)) {117117- struct sctp_chunk *chunk;114114+ /* If there a is a prepend chunk stick it on the list before115115+ * any other chunks get appended.116116+ */117117+ if (ecn_capable) {118118+ struct sctp_chunk *chunk = sctp_get_ecne_prepend(asoc);118119119119- /* If there a is a prepend chunk stick it on the list before120120- * any other chunks get appended.121121- */122122- chunk = sctp_get_ecne_prepend(asoc);123120 if (chunk)124121 sctp_packet_append_chunk(packet, chunk);125122 }123123+124124+ if (!tp->dst)125125+ return;126126+127127+ /* set packet max_size with gso_max_size if gso is enabled*/128128+ rcu_read_lock();129129+ if (__sk_dst_get(sk) != tp->dst) {130130+ dst_hold(tp->dst);131131+ sk_setup_caps(sk, tp->dst);132132+ }133133+ packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size134134+ : asoc->pathmtu;135135+ rcu_read_unlock();126136}127137128138/* Initialize the packet structure. */···592582 sh->vtag = htonl(packet->vtag);593583 sh->checksum = 0;594584595595- /* update dst if in need */596596- if (!sctp_transport_dst_check(tp)) {597597- sctp_transport_route(tp, NULL, sctp_sk(sk));598598- if (asoc && asoc->param_flags & SPP_PMTUD_ENABLE)599599- sctp_assoc_sync_pmtu(sk, asoc);600600- }585585+ /* drop packet if no dst */601586 dst = dst_clone(tp->dst);602587 if (!dst) {603588 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES);···709704 */710705711706 if ((sctp_sk(asoc->base.sk)->nodelay || inflight == 0) &&712712- !chunk->msg->force_delay)707707+ !asoc->force_delay)713708 /* Nothing unacked */714709 return SCTP_XMIT_OK;715710
+1-2
net/sctp/outqueue.c
···10261026 /* RFC 2960 6.5 Every DATA chunk MUST carry a valid10271027 * stream identifier.10281028 */10291029- if (chunk->sinfo.sinfo_stream >=10301030- asoc->c.sinit_num_ostreams) {10291029+ if (chunk->sinfo.sinfo_stream >= asoc->stream->outcnt) {1031103010321031 /* Mark as failed send. */10331032 sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM);
···24602460 * association.24612461 */24622462 if (!asoc->temp) {24632463- int error;24642464-24652465- asoc->stream = sctp_stream_new(asoc->c.sinit_max_instreams,24662466- asoc->c.sinit_num_ostreams, gfp);24672467- if (!asoc->stream)24632463+ if (sctp_stream_init(asoc, gfp))24682464 goto clean_up;2469246524702470- error = sctp_assoc_set_id(asoc, gfp);24712471- if (error)24662466+ if (sctp_assoc_set_id(asoc, gfp))24722467 goto clean_up;24732468 }24742469
+3-3
net/sctp/sm_statefuns.c
···3946394639473947 /* Silently discard the chunk if stream-id is not valid */39483948 sctp_walk_fwdtsn(skip, chunk) {39493949- if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)39493949+ if (ntohs(skip->stream) >= asoc->stream->incnt)39503950 goto discard_noforce;39513951 }39523952···4017401740184018 /* Silently discard the chunk if stream-id is not valid */40194019 sctp_walk_fwdtsn(skip, chunk) {40204020- if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)40204020+ if (ntohs(skip->stream) >= asoc->stream->incnt)40214021 goto gen_shutdown;40224022 }40234023···63536353 * and discard the DATA chunk.63546354 */63556355 sid = ntohs(data_hdr->stream);63566356- if (sid >= asoc->c.sinit_max_instreams) {63566356+ if (sid >= asoc->stream->incnt) {63576357 /* Mark tsn as received even though we drop it */63586358 sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));63596359
+9-9
net/sctp/socket.c
···19071907 }1908190819091909 if (asoc->pmtu_pending)19101910- sctp_assoc_pending_pmtu(sk, asoc);19101910+ sctp_assoc_pending_pmtu(asoc);1911191119121912 /* If fragmentation is disabled and the message length exceeds the19131913 * association fragmentation point, return EMSGSIZE. The I-D···19201920 }1921192119221922 /* Check for invalid stream. */19231923- if (sinfo->sinfo_stream >= asoc->c.sinit_num_ostreams) {19231923+ if (sinfo->sinfo_stream >= asoc->stream->outcnt) {19241924 err = -EINVAL;19251925 goto out_free;19261926 }···19651965 err = PTR_ERR(datamsg);19661966 goto out_free;19671967 }19681968- datamsg->force_delay = !!(msg->msg_flags & MSG_MORE);19681968+ asoc->force_delay = !!(msg->msg_flags & MSG_MORE);1969196919701970 /* Now send the (possibly) fragmented message. */19711971 list_for_each_entry(chunk, &datamsg->chunks, frag_list) {···24352435 if ((params->spp_flags & SPP_PMTUD_DISABLE) && params->spp_pathmtu) {24362436 if (trans) {24372437 trans->pathmtu = params->spp_pathmtu;24382438- sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);24382438+ sctp_assoc_sync_pmtu(asoc);24392439 } else if (asoc) {24402440 asoc->pathmtu = params->spp_pathmtu;24412441 } else {···24512451 (trans->param_flags & ~SPP_PMTUD) | pmtud_change;24522452 if (update) {24532453 sctp_transport_pmtu(trans, sctp_opt2sk(sp));24542454- sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);24542454+ sctp_assoc_sync_pmtu(asoc);24552455 }24562456 } else if (asoc) {24572457 asoc->param_flags =···44614461 info->sctpi_rwnd = asoc->a_rwnd;44624462 info->sctpi_unackdata = asoc->unack_data;44634463 info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);44644464- info->sctpi_instrms = asoc->c.sinit_max_instreams;44654465- info->sctpi_outstrms = asoc->c.sinit_num_ostreams;44644464+ info->sctpi_instrms = asoc->stream->incnt;44654465+ info->sctpi_outstrms = asoc->stream->outcnt;44664466 list_for_each(pos, &asoc->base.inqueue.in_chunk_list)44674467 info->sctpi_inqueue++;44684468 list_for_each(pos, &asoc->outqueue.out_chunk_list)···46914691 status.sstat_unackdata = asoc->unack_data;4692469246934693 status.sstat_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map);46944694- status.sstat_instrms = asoc->c.sinit_max_instreams;46954695- status.sstat_outstrms = asoc->c.sinit_num_ostreams;46944694+ status.sstat_instrms = asoc->stream->incnt;46954695+ status.sstat_outstrms = asoc->stream->outcnt;46964696 status.sstat_fragmentation_point = asoc->frag_point;46974697 status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc);46984698 memcpy(&status.sstat_primary.spinfo_address, &transport->ipaddr,
+35-8
net/sctp/stream.c
···3535#include <net/sctp/sctp.h>3636#include <net/sctp/sm.h>37373838-struct sctp_stream *sctp_stream_new(__u16 incnt, __u16 outcnt, gfp_t gfp)3838+int sctp_stream_new(struct sctp_association *asoc, gfp_t gfp)3939{4040 struct sctp_stream *stream;4141 int i;42424343 stream = kzalloc(sizeof(*stream), gfp);4444 if (!stream)4545- return NULL;4545+ return -ENOMEM;46464747- stream->outcnt = outcnt;4747+ stream->outcnt = asoc->c.sinit_num_ostreams;4848 stream->out = kcalloc(stream->outcnt, sizeof(*stream->out), gfp);4949 if (!stream->out) {5050 kfree(stream);5151- return NULL;5151+ return -ENOMEM;5252 }5353 for (i = 0; i < stream->outcnt; i++)5454 stream->out[i].state = SCTP_STREAM_OPEN;55555656- stream->incnt = incnt;5656+ asoc->stream = stream;5757+5858+ return 0;5959+}6060+6161+int sctp_stream_init(struct sctp_association *asoc, gfp_t gfp)6262+{6363+ struct sctp_stream *stream = asoc->stream;6464+ int i;6565+6666+ /* Initial stream->out size may be very big, so free it and alloc6767+ * a new one with new outcnt to save memory.6868+ */6969+ kfree(stream->out);7070+ stream->outcnt = asoc->c.sinit_num_ostreams;7171+ stream->out = kcalloc(stream->outcnt, sizeof(*stream->out), gfp);7272+ if (!stream->out)7373+ goto nomem;7474+7575+ for (i = 0; i < stream->outcnt; i++)7676+ stream->out[i].state = SCTP_STREAM_OPEN;7777+7878+ stream->incnt = asoc->c.sinit_max_instreams;5779 stream->in = kcalloc(stream->incnt, sizeof(*stream->in), gfp);5880 if (!stream->in) {5981 kfree(stream->out);6060- kfree(stream);6161- return NULL;8282+ goto nomem;6283 }63846464- return stream;8585+ return 0;8686+8787+nomem:8888+ asoc->stream = NULL;8989+ kfree(stream);9090+9191+ return -ENOMEM;6592}66936794void sctp_stream_free(struct sctp_stream *stream)
+7-12
net/sctp/transport.c
···251251 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;252252}253253254254-void sctp_transport_update_pmtu(struct sock *sk, struct sctp_transport *t, u32 pmtu)254254+void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)255255{256256- struct dst_entry *dst;256256+ struct dst_entry *dst = sctp_transport_dst_check(t);257257258258 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {259259 pr_warn("%s: Reported pmtu %d too low, using default minimum of %d\n",260260- __func__, pmtu,261261- SCTP_DEFAULT_MINSEGMENT);260260+ __func__, pmtu, SCTP_DEFAULT_MINSEGMENT);262261 /* Use default minimum segment size and disable263262 * pmtu discovery on this transport.264263 */···266267 t->pathmtu = pmtu;267268 }268269269269- dst = sctp_transport_dst_check(t);270270- if (!dst)271271- t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);272272-273270 if (dst) {274274- dst->ops->update_pmtu(dst, sk, NULL, pmtu);275275-271271+ dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu);276272 dst = sctp_transport_dst_check(t);277277- if (!dst)278278- t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);279273 }274274+275275+ if (!dst)276276+ t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk);280277}281278282279/* Caches the dst entry and source address for a transport's destination
···132132 /* Age scan results with time spent in suspend */133133 cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at);134134135135- if (rdev->ops->resume) {136136- rtnl_lock();137137- if (rdev->wiphy.registered)138138- ret = rdev_resume(rdev);139139- rtnl_unlock();140140- }135135+ rtnl_lock();136136+ if (rdev->wiphy.registered && rdev->ops->resume)137137+ ret = rdev_resume(rdev);138138+ rtnl_unlock();141139142140 return ret;143141}
+8-1
net/xfrm/xfrm_user.c
···412412 up = nla_data(rp);413413 ulen = xfrm_replay_state_esn_len(up);414414415415- if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)415415+ /* Check the overall length and the internal bitmap length to avoid416416+ * potential overflow. */417417+ if (nla_len(rp) < ulen ||418418+ xfrm_replay_state_esn_len(replay_esn) != ulen ||419419+ replay_esn->bmp_len != up->bmp_len)420420+ return -EINVAL;421421+422422+ if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)416423 return -EINVAL;417424418425 return 0;
+8-4
samples/statx/test-statx.c
···141141 if (stx->stx_mask & STATX_BTIME)142142 print_time(" Birth: ", &stx->stx_btime);143143144144- if (stx->stx_attributes) {145145- unsigned char bits;144144+ if (stx->stx_attributes_mask) {145145+ unsigned char bits, mbits;146146 int loop, byte;147147148148 static char attr_representation[64 + 1] =···160160 printf("Attributes: %016llx (", stx->stx_attributes);161161 for (byte = 64 - 8; byte >= 0; byte -= 8) {162162 bits = stx->stx_attributes >> byte;163163+ mbits = stx->stx_attributes_mask >> byte;163164 for (loop = 7; loop >= 0; loop--) {164165 int bit = byte + loop;165166166166- if (bits & 0x80)167167+ if (!(mbits & 0x80))168168+ putchar('.'); /* Not supported */169169+ else if (bits & 0x80)167170 putchar(attr_representation[63 - bit]);168171 else169169- putchar('-');172172+ putchar('-'); /* Not set */170173 bits <<= 1;174174+ mbits <<= 1;171175 }172176 if (byte)173177 putchar(' ');
···155155# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files156156# and locates generated .h files157157# FIXME: Replace both with specific CFLAGS* statements in the makefiles158158-__c_flags = $(if $(obj),-I$(srctree)/$(src) -I$(obj)) \158158+__c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \159159 $(call flags,_c_flags)160160__a_flags = $(call flags,_a_flags)161161__cpp_flags = $(call flags,_cpp_flags)
+1-1
scripts/kconfig/gconf.c
···914914 current = menu;915915 display_tree_part();916916 gtk_widget_set_sensitive(back_btn, TRUE);917917- } else if ((col == COL_OPTION)) {917917+ } else if (col == COL_OPTION) {918918 toggle_sym_value(menu);919919 gtk_tree_view_expand_row(view, path, TRUE);920920 }
+4
sound/core/seq/seq_fifo.c
···267267 /* NOTE: overflow flag is not cleared */268268 spin_unlock_irqrestore(&f->lock, flags);269269270270+ /* close the old pool and wait until all users are gone */271271+ snd_seq_pool_mark_closing(oldpool);272272+ snd_use_lock_sync(&f->use_lock);273273+270274 /* release cells in old pool */271275 for (cell = oldhead; cell; cell = next) {272276 next = cell->next;
···13131414config SND_SOC_MT2701_CS424481515 tristate "ASoc Audio driver for MT2701 with CS42448 codec"1616- depends on SND_SOC_MT27011616+ depends on SND_SOC_MT2701 && I2C1717 select SND_SOC_CS42XX8_I2C1818 select SND_SOC_BT_SCO1919 help
···392392}393393394394/**395395+ * kvm_vgic_init_cpu_hardware - initialize the GIC VE hardware396396+ *397397+ * For a specific CPU, initialize the GIC VE hardware.398398+ */399399+void kvm_vgic_init_cpu_hardware(void)400400+{401401+ BUG_ON(preemptible());402402+403403+ /*404404+ * We want to make sure the list registers start out clear so that we405405+ * only have the program the used registers.406406+ */407407+ if (kvm_vgic_global_state.type == VGIC_V2)408408+ vgic_v2_init_lrs();409409+ else410410+ kvm_call_hyp(__vgic_v3_init_lrs);411411+}412412+413413+/**395414 * kvm_vgic_hyp_init: populates the kvm_vgic_global_state variable396415 * according to the host GIC model. Accordingly calls either397416 * vgic_v2/v3_probe which registers the KVM_DEVICE that can be
+18-2
virt/kvm/arm/vgic/vgic-mmio-v2.c
···229229 val = vmcr.ctlr;230230 break;231231 case GIC_CPU_PRIMASK:232232- val = vmcr.pmr;232232+ /*233233+ * Our KVM_DEV_TYPE_ARM_VGIC_V2 device ABI exports the234234+ * the PMR field as GICH_VMCR.VMPriMask rather than235235+ * GICC_PMR.Priority, so we expose the upper five bits of236236+ * priority mask to userspace using the lower bits in the237237+ * unsigned long.238238+ */239239+ val = (vmcr.pmr & GICV_PMR_PRIORITY_MASK) >>240240+ GICV_PMR_PRIORITY_SHIFT;233241 break;234242 case GIC_CPU_BINPOINT:235243 val = vmcr.bpr;···270262 vmcr.ctlr = val;271263 break;272264 case GIC_CPU_PRIMASK:273273- vmcr.pmr = val;265265+ /*266266+ * Our KVM_DEV_TYPE_ARM_VGIC_V2 device ABI exports the267267+ * the PMR field as GICH_VMCR.VMPriMask rather than268268+ * GICC_PMR.Priority, so we expose the upper five bits of269269+ * priority mask to userspace using the lower bits in the270270+ * unsigned long.271271+ */272272+ vmcr.pmr = (val << GICV_PMR_PRIORITY_SHIFT) &273273+ GICV_PMR_PRIORITY_MASK;274274 break;275275 case GIC_CPU_BINPOINT:276276 vmcr.bpr = val;
···8181 return irq->pending_latch || irq->line_level;8282}83838484+/*8585+ * This struct provides an intermediate representation of the fields contained8686+ * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC8787+ * state to userspace can generate either GICv2 or GICv3 CPU interface8888+ * registers regardless of the hardware backed GIC used.8989+ */8490struct vgic_vmcr {8591 u32 ctlr;8692 u32 abpr;8793 u32 bpr;8888- u32 pmr;9494+ u32 pmr; /* Priority mask field in the GICC_PMR and9595+ * ICC_PMR_EL1 priority field format */8996 /* Below member variable are valid only for GICv3 */9097 u32 grpen0;9198 u32 grpen1;···136129int vgic_v2_map_resources(struct kvm *kvm);137130int vgic_register_dist_iodev(struct kvm *kvm, gpa_t dist_base_address,138131 enum vgic_type);132132+133133+void vgic_v2_init_lrs(void);139134140135static inline void vgic_get_irq_kref(struct vgic_irq *irq)141136{