···2020Optional properties:2121- phy-handle: See ethernet.txt file in the same directory.2222 If absent, davinci_emac driver defaults to 100/FULL.2323+- nvmem-cells: phandle, reference to an nvmem node for the MAC address2424+- nvmem-cell-names: string, should be "mac-address" if nvmem is to be used2325- ti,davinci-rmii-en: 1 byte, 1 means use RMII2426- ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM?2527
···1010 the boot program; should be used in cases where the MAC address assigned to1111 the device by the boot program is different from the "local-mac-address"1212 property;1313-- nvmem-cells: phandle, reference to an nvmem node for the MAC address;1414-- nvmem-cell-names: string, should be "mac-address" if nvmem is to be used;1513- max-speed: number, specifies maximum speed in Mbit/s supported by the device;1614- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than1715 the maximum frame size (there's contradiction in the Devicetree1816 Specification).1917- phy-mode: string, operation mode of the PHY interface. This is now a de-facto2018 standard property; supported values are:2121- * "internal"1919+ * "internal" (Internal means there is not a standard bus between the MAC and2020+ the PHY, something proprietary is being used to embed the PHY in the MAC.)2221 * "mii"2322 * "gmii"2423 * "sgmii"
+4
Documentation/devicetree/bindings/net/macb.txt
···2626 Optional elements: 'tsu_clk'2727- clocks: Phandles to input clocks.28282929+Optional properties:3030+- nvmem-cells: phandle, reference to an nvmem node for the MAC address3131+- nvmem-cell-names: string, should be "mac-address" if nvmem is to be used3232+2933Optional properties for PHY child node:3034- reset-gpios : Should specify the gpio for phy reset3135- magic-packet : If present, indicates that the hardware supports waking
···2222 CONFIG_DECNET_ROUTER (to be able to add/delete routes)2323 CONFIG_NETFILTER (will be required for the DECnet routing daemon)24242525- CONFIG_DECNET_ROUTE_FWMARK is optional2626-2725Don't turn on SIOCGIFCONF support for DECnet unless you are really sure2826that you need it, in general you won't and it can cause ifconfig to2927malfunction.
+1
Documentation/networking/ip-sysctl.txt
···427427 minimum RTT when it is moved to a longer path (e.g., due to traffic428428 engineering). A longer window makes the filter more resistant to RTT429429 inflations such as transient congestion. The unit is seconds.430430+ Possible values: 0 - 86400 (1 day)430431 Default: 300431432432433tcp_moderate_rcvbuf - BOOLEAN
+2-1
MAINTAINERS
···31243124BROADCOM BMIPS MIPS ARCHITECTURE31253125M: Kevin Cernekee <cernekee@gmail.com>31263126M: Florian Fainelli <f.fainelli@gmail.com>31273127+L: bcm-kernel-feedback-list@broadcom.com31273128L: linux-mips@vger.kernel.org31283129T: git git://github.com/broadcom/stblinux.git31293130S: Maintained···73377336F: Documentation/driver-api/i3c73387337F: drivers/i3c/73397338F: include/linux/i3c/73407340-F: include/dt-bindings/i3c/7341733973427340I3C DRIVER FOR SYNOPSYS DESIGNWARE73437341M: Vitor Soares <vitor.soares@synopsys.com>···87118711LED SUBSYSTEM87128712M: Jacek Anaszewski <jacek.anaszewski@gmail.com>87138713M: Pavel Machek <pavel@ucw.cz>87148714+R: Dan Murphy <dmurphy@ti.com>87148715L: linux-leds@vger.kernel.org87158716T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git87168717S: Maintained
···463463532 common getppid sys_getppid464464# all other architectures have common numbers for new syscall, alpha465465# is the exception.466466+534 common pidfd_send_signal sys_pidfd_send_signal467467+535 common io_uring_setup sys_io_uring_setup468468+536 common io_uring_enter sys_io_uring_enter469469+537 common io_uring_register sys_io_uring_register
+4
arch/arm/tools/syscall.tbl
···437437421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait438438422 common futex_time64 sys_futex439439423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval440440+424 common pidfd_send_signal sys_pidfd_send_signal441441+425 common io_uring_setup sys_io_uring_setup442442+426 common io_uring_enter sys_io_uring_enter443443+427 common io_uring_register sys_io_uring_register
+1-1
arch/arm64/include/asm/futex.h
···5050static inline int5151arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr)5252{5353- int oldval, ret, tmp;5353+ int oldval = 0, ret, tmp;5454 u32 __user *uaddr = __uaccess_mask_ptr(_uaddr);55555656 pagefault_disable();
···866866__SYSCALL(__NR_futex_time64, sys_futex)867867#define __NR_sched_rr_get_interval_time64 423868868__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval)869869+#define __NR_pidfd_send_signal 424870870+__SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal)871871+#define __NR_io_uring_setup 425872872+__SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)873873+#define __NR_io_uring_enter 426874874+__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)875875+#define __NR_io_uring_register 427876876+__SYSCALL(__NR_io_uring_register, sys_io_uring_register)869877870878/*871879 * Please add new compat syscalls above this comment and update
+4
arch/ia64/kernel/syscalls/syscall.tbl
···344344332 common pkey_free sys_pkey_free345345333 common rseq sys_rseq346346# 334 through 423 are reserved to sync up with other architectures347347+424 common pidfd_send_signal sys_pidfd_send_signal348348+425 common io_uring_setup sys_io_uring_setup349349+426 common io_uring_enter sys_io_uring_enter350350+427 common io_uring_register sys_io_uring_register
+4
arch/m68k/kernel/syscalls/syscall.tbl
···423423421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait424424422 common futex_time64 sys_futex425425423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval426426+424 common pidfd_send_signal sys_pidfd_send_signal427427+425 common io_uring_setup sys_io_uring_setup428428+426 common io_uring_enter sys_io_uring_enter429429+427 common io_uring_register sys_io_uring_register
+4
arch/microblaze/kernel/syscalls/syscall.tbl
···429429421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait430430422 common futex_time64 sys_futex431431423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval432432+424 common pidfd_send_signal sys_pidfd_send_signal433433+425 common io_uring_setup sys_io_uring_setup434434+426 common io_uring_enter sys_io_uring_enter435435+427 common io_uring_register sys_io_uring_register
-6
arch/mips/ath79/setup.c
···210210 return ath79_sys_type;211211}212212213213-int get_c0_perfcount_int(void)214214-{215215- return ATH79_MISC_IRQ(5);216216-}217217-EXPORT_SYMBOL_GPL(get_c0_perfcount_int);218218-219213unsigned int get_c0_compare_int(void)220214{221215 return CP0_LEGACY_COMPARE_IRQ;
+1-1
arch/mips/kernel/scall64-o32.S
···125125 subu t1, v0, __NR_O32_Linux126126 move a1, v0127127 bnez t1, 1f /* __NR_syscall at offset 0 */128128- lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */128128+ ld a1, PT_R4(sp) /* Arg1 for __NR_syscall case */129129 .set pop1301301311311: jal syscall_trace_enter
···338338327 n64 rseq sys_rseq339339328 n64 io_pgetevents sys_io_pgetevents340340# 329 through 423 are reserved to sync up with other architectures341341+424 n64 pidfd_send_signal sys_pidfd_send_signal342342+425 n64 io_uring_setup sys_io_uring_setup343343+426 n64 io_uring_enter sys_io_uring_enter344344+427 n64 io_uring_register sys_io_uring_register
···23232424 if (flags & KERNEL_FPC)2525 /* Save floating point control */2626- asm volatile("stfpc %0" : "=m" (state->fpc));2626+ asm volatile("stfpc %0" : "=Q" (state->fpc));27272828 if (!MACHINE_HAS_VX) {2929 if (flags & KERNEL_VXR_V0V7) {
+4
arch/s390/kernel/syscalls/syscall.tbl
···426426421 32 rt_sigtimedwait_time64 - compat_sys_rt_sigtimedwait_time64427427422 32 futex_time64 - sys_futex428428423 32 sched_rr_get_interval_time64 - sys_sched_rr_get_interval429429+424 common pidfd_send_signal sys_pidfd_send_signal sys_pidfd_send_signal430430+425 common io_uring_setup sys_io_uring_setup sys_io_uring_setup431431+426 common io_uring_enter sys_io_uring_enter sys_io_uring_enter432432+427 common io_uring_register sys_io_uring_register sys_io_uring_register
+4-4
arch/s390/kernel/vtime.c
···3737{3838 u64 timer;39394040- asm volatile("stpt %0" : "=m" (timer));4040+ asm volatile("stpt %0" : "=Q" (timer));4141 return timer;4242}4343···4848 asm volatile(4949 " stpt %0\n" /* Store current cpu timer value */5050 " spt %1" /* Set new value imm. afterwards */5151- : "=m" (timer) : "m" (expires));5151+ : "=Q" (timer) : "Q" (expires));5252 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;5353 S390_lowcore.last_update_timer = expires;5454}···135135#else136136 " stck %1" /* Store current tod clock value */137137#endif138138- : "=m" (S390_lowcore.last_update_timer),139139- "=m" (S390_lowcore.last_update_clock));138138+ : "=Q" (S390_lowcore.last_update_timer),139139+ "=Q" (S390_lowcore.last_update_clock));140140 clock = S390_lowcore.last_update_clock - clock;141141 timer -= S390_lowcore.last_update_timer;142142
+4
arch/sh/kernel/syscalls/syscall.tbl
···426426421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait427427422 common futex_time64 sys_futex428428423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval429429+424 common pidfd_send_signal sys_pidfd_send_signal430430+425 common io_uring_setup sys_io_uring_setup431431+426 common io_uring_enter sys_io_uring_enter432432+427 common io_uring_register sys_io_uring_register
+4
arch/sparc/kernel/syscalls/syscall.tbl
···469469421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64470470422 32 futex_time64 sys_futex sys_futex471471423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval472472+424 common pidfd_send_signal sys_pidfd_send_signal473473+425 common io_uring_setup sys_io_uring_setup474474+426 common io_uring_enter sys_io_uring_enter475475+427 common io_uring_register sys_io_uring_register
+1-1
arch/x86/Kconfig
···14991499 depends on DEBUG_FS15001500 ---help---15011501 Expose statistics about the Change Page Attribute mechanims, which15021502- helps to determine the effectivness of preserving large and huge15021502+ helps to determine the effectiveness of preserving large and huge15031503 page mappings when mapping protections are changed.1504150415051505config ARCH_HAS_MEM_ENCRYPT
+10-4
arch/x86/crypto/poly1305-avx2-x86_64.S
···323323 vpaddq t2,t1,t1324324 vmovq t1x,d4325325326326+ # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 ->327327+ # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small328328+ # amount. Careful: we must not assume the carry bits 'd0 >> 26',329329+ # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit330330+ # integers. It's true in a single-block implementation, but not here.331331+326332 # d1 += d0 >> 26327333 mov d0,%rax328334 shr $26,%rax···367361 # h0 += (d4 >> 26) * 5368362 mov d4,%rax369363 shr $26,%rax370370- lea (%eax,%eax,4),%eax371371- add %eax,%ebx364364+ lea (%rax,%rax,4),%rax365365+ add %rax,%rbx372366 # h4 = d4 & 0x3ffffff373367 mov d4,%rax374368 and $0x3ffffff,%eax375369 mov %eax,h4376370377371 # h1 += h0 >> 26378378- mov %ebx,%eax379379- shr $26,%eax372372+ mov %rbx,%rax373373+ shr $26,%rax380374 add %eax,h1381375 # h0 = h0 & 0x3ffffff382376 andl $0x3ffffff,%ebx
+14-8
arch/x86/crypto/poly1305-sse2-x86_64.S
···253253 # h0 += (d4 >> 26) * 5254254 mov d4,%rax255255 shr $26,%rax256256- lea (%eax,%eax,4),%eax257257- add %eax,%ebx256256+ lea (%rax,%rax,4),%rax257257+ add %rax,%rbx258258 # h4 = d4 & 0x3ffffff259259 mov d4,%rax260260 and $0x3ffffff,%eax261261 mov %eax,h4262262263263 # h1 += h0 >> 26264264- mov %ebx,%eax265265- shr $26,%eax264264+ mov %rbx,%rax265265+ shr $26,%rax266266 add %eax,h1267267 # h0 = h0 & 0x3ffffff268268 andl $0x3ffffff,%ebx···524524 paddq t2,t1525525 movq t1,d4526526527527+ # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 ->528528+ # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small529529+ # amount. Careful: we must not assume the carry bits 'd0 >> 26',530530+ # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit531531+ # integers. It's true in a single-block implementation, but not here.532532+527533 # d1 += d0 >> 26528534 mov d0,%rax529535 shr $26,%rax···568562 # h0 += (d4 >> 26) * 5569563 mov d4,%rax570564 shr $26,%rax571571- lea (%eax,%eax,4),%eax572572- add %eax,%ebx565565+ lea (%rax,%rax,4),%rax566566+ add %rax,%rbx573567 # h4 = d4 & 0x3ffffff574568 mov d4,%rax575569 and $0x3ffffff,%eax576570 mov %eax,h4577571578572 # h1 += h0 >> 26579579- mov %ebx,%eax580580- shr $26,%eax573573+ mov %rbx,%rax574574+ shr $26,%rax581575 add %eax,h1582576 # h0 = h0 & 0x3ffffff583577 andl $0x3ffffff,%ebx
···611611 if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE)612612 return;613613614614- pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");615615- pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");614614+ pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");615615+ pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");616616 epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;617617 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);618618}
···569569 unsigned long *sara = stack_addr(regs);570570571571 ri->ret_addr = (kprobe_opcode_t *) *sara;572572+ ri->fp = sara;572573573574 /* Replace the return addr with trampoline addr */574575 *sara = (unsigned long) &kretprobe_trampoline;···749748NOKPROBE_SYMBOL(kretprobe_trampoline);750749STACK_FRAME_NON_STANDARD(kretprobe_trampoline);751750751751+static struct kprobe kretprobe_kprobe = {752752+ .addr = (void *)kretprobe_trampoline,753753+};754754+752755/*753756 * Called from kretprobe_trampoline754757 */755758static __used void *trampoline_handler(struct pt_regs *regs)756759{760760+ struct kprobe_ctlblk *kcb;757761 struct kretprobe_instance *ri = NULL;758762 struct hlist_head *head, empty_rp;759763 struct hlist_node *tmp;760764 unsigned long flags, orig_ret_address = 0;761765 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;762766 kprobe_opcode_t *correct_ret_addr = NULL;767767+ void *frame_pointer;768768+ bool skipped = false;769769+770770+ preempt_disable();771771+772772+ /*773773+ * Set a dummy kprobe for avoiding kretprobe recursion.774774+ * Since kretprobe never run in kprobe handler, kprobe must not775775+ * be running at this point.776776+ */777777+ kcb = get_kprobe_ctlblk();778778+ __this_cpu_write(current_kprobe, &kretprobe_kprobe);779779+ kcb->kprobe_status = KPROBE_HIT_ACTIVE;763780764781 INIT_HLIST_HEAD(&empty_rp);765782 kretprobe_hash_lock(current, &head, &flags);766783 /* fixup registers */767784#ifdef CONFIG_X86_64768785 regs->cs = __KERNEL_CS;786786+ /* On x86-64, we use pt_regs->sp for return address holder. */787787+ frame_pointer = ®s->sp;769788#else770789 regs->cs = __KERNEL_CS | get_kernel_rpl();771790 regs->gs = 0;791791+ /* On x86-32, we use pt_regs->flags for return address holder. */792792+ frame_pointer = ®s->flags;772793#endif773794 regs->ip = trampoline_address;774795 regs->orig_ax = ~0UL;···812789 if (ri->task != current)813790 /* another task is sharing our hash bucket */814791 continue;792792+ /*793793+ * Return probes must be pushed on this hash list correct794794+ * order (same as return order) so that it can be poped795795+ * correctly. However, if we find it is pushed it incorrect796796+ * order, this means we find a function which should not be797797+ * probed, because the wrong order entry is pushed on the798798+ * path of processing other kretprobe itself.799799+ */800800+ if (ri->fp != frame_pointer) {801801+ if (!skipped)802802+ pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n");803803+ skipped = true;804804+ continue;805805+ }815806816807 orig_ret_address = (unsigned long)ri->ret_addr;808808+ if (skipped)809809+ pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n",810810+ ri->rp->kp.addr);817811818812 if (orig_ret_address != trampoline_address)819813 /*···848808 if (ri->task != current)849809 /* another task is sharing our hash bucket */850810 continue;811811+ if (ri->fp != frame_pointer)812812+ continue;851813852814 orig_ret_address = (unsigned long)ri->ret_addr;853815 if (ri->rp && ri->rp->handler) {854816 __this_cpu_write(current_kprobe, &ri->rp->kp);855855- get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;856817 ri->ret_addr = correct_ret_addr;857818 ri->rp->handler(ri, regs);858858- __this_cpu_write(current_kprobe, NULL);819819+ __this_cpu_write(current_kprobe, &kretprobe_kprobe);859820 }860821861822 recycle_rp_inst(ri, &empty_rp);···871830 }872831873832 kretprobe_hash_unlock(current, &flags);833833+834834+ __this_cpu_write(current_kprobe, NULL);835835+ preempt_enable();874836875837 hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {876838 hlist_del(&ri->hlist);
+6-2
arch/x86/kernel/process.c
···426426 u64 msr = x86_spec_ctrl_base;427427 bool updmsr = false;428428429429+ lockdep_assert_irqs_disabled();430430+429431 /*430432 * If TIF_SSBD is different, select the proper mitigation431433 * method. Note that if SSBD mitigation is disabled or permanentely···479477480478void speculation_ctrl_update(unsigned long tif)481479{480480+ unsigned long flags;481481+482482 /* Forced update. Make sure all relevant TIF flags are different */483483- preempt_disable();483483+ local_irq_save(flags);484484 __speculation_ctrl_update(~tif, tif);485485- preempt_enable();485485+ local_irq_restore(flags);486486}487487488488/* Called from seccomp/prctl update */
···728728{729729 int cpu;730730731731- struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = {731731+ struct flush_tlb_info info = {732732 .mm = mm,733733 .stride_shift = stride_shift,734734 .freed_tables = freed_tables,
+4
arch/xtensa/kernel/syscalls/syscall.tbl
···394394421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait395395422 common futex_time64 sys_futex396396423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval397397+424 common pidfd_send_signal sys_pidfd_send_signal398398+425 common io_uring_setup sys_io_uring_setup399399+426 common io_uring_enter sys_io_uring_enter400400+427 common io_uring_register sys_io_uring_register
···506506507507 ret = lock_device_hotplug_sysfs();508508 if (ret)509509- goto out;509509+ return ret;510510511511 nid = memory_add_physaddr_to_nid(phys_addr);512512 ret = __add_memory(nid, phys_addr,
+1
drivers/clocksource/Kconfig
···145145config NPCM7XX_TIMER146146 bool "NPCM7xx timer driver" if COMPILE_TEST147147 depends on HAS_IOMEM148148+ select TIMER_OF148149 select CLKSRC_MMIO149150 help150151 Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture,
···585585 return 0;586586}587587588588-/* Optimized set_load which removes costly spin wait in timer_start */589589-static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer,590590- int autoreload, unsigned int load)591591-{592592- u32 l;593593-594594- if (unlikely(!timer))595595- return -EINVAL;596596-597597- omap_dm_timer_enable(timer);598598-599599- l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);600600- if (autoreload) {601601- l |= OMAP_TIMER_CTRL_AR;602602- omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);603603- } else {604604- l &= ~OMAP_TIMER_CTRL_AR;605605- }606606- l |= OMAP_TIMER_CTRL_ST;607607-608608- __omap_dm_timer_load_start(timer, l, load, timer->posted);609609-610610- /* Save the context */611611- timer->context.tclr = l;612612- timer->context.tldr = load;613613- timer->context.tcrr = load;614614- return 0;615615-}616588static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,617589 unsigned int match)618590{
+1-1
drivers/extcon/Kconfig
···116116117117config EXTCON_PTN5150118118 tristate "NXP PTN5150 CC LOGIC USB EXTCON support"119119- depends on I2C && GPIOLIB || COMPILE_TEST119119+ depends on I2C && (GPIOLIB || COMPILE_TEST)120120 select REGMAP_I2C121121 help122122 Say Y here to enable support for USB peripheral and USB host
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
···3165316531663166 /* No need to recover an evicted BO */31673167 if (shadow->tbo.mem.mem_type != TTM_PL_TT ||31683168+ shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET ||31683169 shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM)31693170 continue;31703171
···13771377 return UPDATE_TYPE_FULL;13781378 }1379137913801380+ if (u->surface->force_full_update) {13811381+ update_flags->bits.full_update = 1;13821382+ return UPDATE_TYPE_FULL;13831383+ }13841384+13801385 type = get_plane_info_update_type(u);13811386 elevate_update_type(&overall_type, type);13821387···18071802 }1808180318091804 dc_resource_state_copy_construct(state, context);18051805+18061806+ for (i = 0; i < dc->res_pool->pipe_count; i++) {18071807+ struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i];18081808+ struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];18091809+18101810+ if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state)18111811+ new_pipe->plane_state->force_full_update = true;18121812+ }18101813 }1811181418121815···18511838 dc->current_state = context;18521839 dc_release_state(old);1853184018411841+ for (i = 0; i < dc->res_pool->pipe_count; i++) {18421842+ struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];18431843+18441844+ if (pipe_ctx->plane_state && pipe_ctx->stream == stream)18451845+ pipe_ctx->plane_state->force_full_update = false;18461846+ }18541847 }18551848 /*let's use current_state to update watermark etc*/18561849 if (update_type >= UPDATE_TYPE_FULL)
+3
drivers/gpu/drm/amd/display/dc/dc.h
···503503 struct dc_plane_status status;504504 struct dc_context *ctx;505505506506+ /* HACK: Workaround for forcing full reprogramming under some conditions */507507+ bool force_full_update;508508+506509 /* private to dc_surface.c */507510 enum dc_irq_source irq_source;508511 struct kref refcount;
+6-3
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
···190190 1,191191 0);192192 }193193+194194+ REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);195195+196196+ REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,197197+ 10, aux110->timeout_period/10);198198+193199 /* set the delay and the number of bytes to write */194200195201 /* The length include···248242 }249243 }250244251251- REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);252252- REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,253253- 10, aux110->timeout_period/10);254245 REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1);255246}256247
+3-3
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
···7171 * at most within ~240usec. That means,7272 * increasing this timeout will not affect normal operation,7373 * and we'll timeout after7474- * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec.7474+ * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec.7575 * This timeout is especially important for7676- * resume from S3 and CTS.7676+ * converters, resume from S3, and CTS.7777 */7878- SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 47878+ SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 67979};80808181struct dce_aux {
+5-7
drivers/gpu/drm/i915/intel_fbdev.c
···338338 bool *enabled, int width, int height)339339{340340 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);341341+ unsigned long conn_configured, conn_seq, mask;341342 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);342342- unsigned long conn_configured, conn_seq;343343 int i, j;344344 bool *save_enabled;345345 bool fallback = true, ret = true;···357357 drm_modeset_backoff(&ctx);358358359359 memcpy(save_enabled, enabled, count);360360- conn_seq = GENMASK(count - 1, 0);360360+ mask = GENMASK(count - 1, 0);361361 conn_configured = 0;362362retry:363363+ conn_seq = conn_configured;363364 for (i = 0; i < count; i++) {364365 struct drm_fb_helper_connector *fb_conn;365366 struct drm_connector *connector;···373372 if (conn_configured & BIT(i))374373 continue;375374376376- /* First pass, only consider tiled connectors */377377- if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile)375375+ if (conn_seq == 0 && !connector->has_tile)378376 continue;379377380378 if (connector->status == connector_status_connected)···477477 conn_configured |= BIT(i);478478 }479479480480- if (conn_configured != conn_seq) { /* repeat until no more are found */481481- conn_seq = conn_configured;480480+ if ((conn_configured & mask) != mask && conn_configured != conn_seq)482481 goto retry;483483- }484482485483 /*486484 * If the BIOS didn't enable everything it could, fall back to have the
+9-3
drivers/gpu/drm/tegra/hdmi.c
···1260126012611261 hdmi->dvi = !tegra_output_is_hdmi(output);12621262 if (!hdmi->dvi) {12631263- err = tegra_hdmi_setup_audio(hdmi);12641264- if (err < 0)12651265- hdmi->dvi = true;12631263+ /*12641264+ * Make sure that the audio format has been configured before12651265+ * enabling audio, otherwise we may try to divide by zero.12661266+ */12671267+ if (hdmi->format.sample_rate > 0) {12681268+ err = tegra_hdmi_setup_audio(hdmi);12691269+ if (err < 0)12701270+ hdmi->dvi = true;12711271+ }12661272 }1267127312681274 if (hdmi->config->has_hda)
+3-1
drivers/gpu/drm/ttm/ttm_bo.c
···876876 reservation_object_add_shared_fence(bo->resv, fence);877877878878 ret = reservation_object_reserve_shared(bo->resv, 1);879879- if (unlikely(ret))879879+ if (unlikely(ret)) {880880+ dma_fence_put(fence);880881 return ret;882882+ }881883882884 dma_fence_put(bo->moving);883885 bo->moving = fence;
+7-6
drivers/gpu/drm/ttm/ttm_page_alloc.c
···730730 }731731732732#ifdef CONFIG_TRANSPARENT_HUGEPAGE733733- if (!(flags & TTM_PAGE_FLAG_DMA32)) {734734- for (j = 0; j < HPAGE_PMD_NR; ++j)735735- if (p++ != pages[i + j])733733+ if (!(flags & TTM_PAGE_FLAG_DMA32) &&734734+ (npages - i) >= HPAGE_PMD_NR) {735735+ for (j = 1; j < HPAGE_PMD_NR; ++j)736736+ if (++p != pages[i + j])736737 break;737738738739 if (j == HPAGE_PMD_NR)···760759 unsigned max_size, n2free;761760762761 spin_lock_irqsave(&huge->lock, irq_flags);763763- while (i < npages) {762762+ while ((npages - i) >= HPAGE_PMD_NR) {764763 struct page *p = pages[i];765764 unsigned j;766765767766 if (!p)768767 break;769768770770- for (j = 0; j < HPAGE_PMD_NR; ++j)771771- if (p++ != pages[i + j])769769+ for (j = 1; j < HPAGE_PMD_NR; ++j)770770+ if (++p != pages[i + j])772771 break;773772774773 if (j != HPAGE_PMD_NR)
···680680 break;681681 }682682683683+ if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */684684+ switch (usage->hid & 0xf) {685685+ case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break;686686+ default: goto ignore;687687+ }688688+ break;689689+ }690690+683691 /*684692 * Some lazy vendors declare 255 usages for System Control,685693 * leading to the creation of ABS_X|Y axis and too many others.···910902 case 0x06a: map_key_clear(KEY_GREEN); break;911903 case 0x06b: map_key_clear(KEY_BLUE); break;912904 case 0x06c: map_key_clear(KEY_YELLOW); break;913913- case 0x06d: map_key_clear(KEY_ZOOM); break;905905+ case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break;914906915907 case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break;916908 case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break;···918910 case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break;919911 case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break;920912 case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break;913913+914914+ case 0x079: map_key_clear(KEY_KBDILLUMUP); break;915915+ case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break;916916+ case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break;921917922918 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break;923919 case 0x083: map_key_clear(KEY_LAST); break;···10341022 case 0x22d: map_key_clear(KEY_ZOOMIN); break;10351023 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;10361024 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;10251025+ case 0x232: map_key_clear(KEY_FULL_SCREEN); break;10371026 case 0x233: map_key_clear(KEY_SCROLLUP); break;10381027 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;10391028 case 0x238: /* AC Pan */···10571044 case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break;10581045 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;10591046 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;10471047+10481048+ case 0x29f: map_key_clear(KEY_SCALE); break;1060104910611050 default: map_key_clear(KEY_UNKNOWN);10621051 }
···6464config PMS70036565 tristate "Plantower PMS7003 particulate matter sensor"6666 depends on SERIAL_DEV_BUS6767+ select IIO_TRIGGERED_BUFFER6768 help6869 Say Y here to build support for the Plantower PMS7003 particulate6970 matter sensor.70717172 To compile this driver as a module, choose M here: the module will7273 be called pms7003.7474+7575+config SENSIRION_SGP307676+ tristate "Sensirion SGPxx gas sensors"7777+ depends on I2C7878+ select CRC87979+ help8080+ Say Y here to build I2C interface support for the following8181+ Sensirion SGP gas sensors:8282+ * SGP30 gas sensor8383+ * SGPC3 low power gas sensor8484+8585+ To compile this driver as module, choose M here: the8686+ module will be called sgp30.73877488config SPS307589 tristate "SPS30 particulate matter sensor"
···993993 * will only be one mm, so no big deal.994994 */995995 down_write(&mm->mmap_sem);996996+ if (!mmget_still_valid(mm))997997+ goto skip_mm;996998 mutex_lock(&ufile->umap_lock);997999 list_for_each_entry_safe (priv, next_priv, &ufile->umaps,9981000 list) {···10091007 vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE);10101008 }10111009 mutex_unlock(&ufile->umap_lock);10101010+ skip_mm:10121011 up_write(&mm->mmap_sem);10131012 mmput(mm);10141013 }
···2222#define AR71XX_RESET_REG_MISC_INT_ENABLE 423232424#define ATH79_MISC_IRQ_COUNT 322525+#define ATH79_MISC_PERF_IRQ 52626+2727+static int ath79_perfcount_irq;2828+2929+int get_c0_perfcount_int(void)3030+{3131+ return ath79_perfcount_irq;3232+}3333+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);25342635static void ath79_misc_irq_handler(struct irq_desc *desc)2736{···121112 struct irq_domain *domain, int irq)122113{123114 void __iomem *base = domain->host_data;115115+116116+ ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ);124117125118 /* Disable and clear all interrupts */126119 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
+6-1
drivers/misc/fastrpc.c
···11841184 struct fastrpc_session_ctx *sess;11851185 struct device *dev = &pdev->dev;11861186 int i, sessions = 0;11871187+ int rc;1187118811881189 cctx = dev_get_drvdata(dev->parent);11891190 if (!cctx)···12141213 }12151214 cctx->sesscount++;12161215 spin_unlock(&cctx->lock);12171217- dma_set_mask(dev, DMA_BIT_MASK(32));12161216+ rc = dma_set_mask(dev, DMA_BIT_MASK(32));12171217+ if (rc) {12181218+ dev_err(dev, "32-bit DMA enable failed\n");12191219+ return rc;12201220+ }1218122112191222 return 0;12201223}
+4-5
drivers/misc/habanalabs/goya/goya.c
···1688168816891689 /*16901690 * Workaround for H2 #HW-23 bug16911691- * Set DMA max outstanding read requests to 240 on DMA CH 1. Set it16921692- * to 16 on KMD DMA16931693- * We need to limit only these DMAs because the user can only read16911691+ * Set DMA max outstanding read requests to 240 on DMA CH 1.16921692+ * This limitation is still large enough to not affect Gen4 bandwidth.16931693+ * We need to only limit that DMA channel because the user can only read16941694 * from Host using DMA CH 116951695 */16961696- WREG32(mmDMA_CH_0_CFG0, 0x0fff0010);16971696 WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0);1698169716991698 goya->hw_cap_initialized |= HW_CAP_GOLDEN;···36923693 * WA for HW-23.36933694 * We can't allow user to read from Host using QMANs other than 1.36943695 */36953695- if (parser->hw_queue_id > GOYA_QUEUE_ID_DMA_1 &&36963696+ if (parser->hw_queue_id != GOYA_QUEUE_ID_DMA_1 &&36963697 hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr),36973698 le32_to_cpu(user_dma_pkt->tsize),36983699 hdev->asic_prop.va_space_host_start_address,
···681681 u64 scc; /* packets TX after a single collision */682682 u64 mcc; /* packets TX after multiple collisions */683683 u64 latecol; /* TX packets w/ late collisions */684684- u64 tx_underun; /* TX packets aborted due to TX FIFO underrun684684+ u64 tx_underrun; /* TX packets aborted due to TX FIFO underrun685685 * or TRD FIFO underrun */686686 u64 tx_trunc; /* TX packets truncated due to size > MTU */687687 u64 rx_pause; /* num Pause packets received. */
+1-1
drivers/net/ethernet/atheros/atlx/atl2.c
···553553 netdev->stats.tx_aborted_errors++;554554 if (txs->late_col)555555 netdev->stats.tx_window_errors++;556556- if (txs->underun)556556+ if (txs->underrun)557557 netdev->stats.tx_fifo_errors++;558558 } while (1);559559
+1-1
drivers/net/ethernet/atheros/atlx/atl2.h
···260260 unsigned multi_col:1;261261 unsigned late_col:1;262262 unsigned abort_col:1;263263- unsigned underun:1; /* current packet is aborted263263+ unsigned underrun:1; /* current packet is aborted264264 * due to txram underrun */265265 unsigned:3; /* reserved */266266 unsigned update:1; /* always 1'b1 in tx_status_buf */
+22-2
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
···3333#include <linux/bpf_trace.h>3434#include "en/xdp.h"35353636+int mlx5e_xdp_max_mtu(struct mlx5e_params *params)3737+{3838+ int hr = NET_IP_ALIGN + XDP_PACKET_HEADROOM;3939+4040+ /* Let S := SKB_DATA_ALIGN(sizeof(struct skb_shared_info)).4141+ * The condition checked in mlx5e_rx_is_linear_skb is:4242+ * SKB_DATA_ALIGN(sw_mtu + hard_mtu + hr) + S <= PAGE_SIZE (1)4343+ * (Note that hw_mtu == sw_mtu + hard_mtu.)4444+ * What is returned from this function is:4545+ * max_mtu = PAGE_SIZE - S - hr - hard_mtu (2)4646+ * After assigning sw_mtu := max_mtu, the left side of (1) turns to4747+ * SKB_DATA_ALIGN(PAGE_SIZE - S) + S, which is equal to PAGE_SIZE,4848+ * because both PAGE_SIZE and S are already aligned. Any number greater4949+ * than max_mtu would make the left side of (1) greater than PAGE_SIZE,5050+ * so max_mtu is the maximum MTU allowed.5151+ */5252+5353+ return MLX5E_HW2SW_MTU(params, SKB_MAX_HEAD(hr));5454+}5555+3656static inline bool3757mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di,3858 struct xdp_buff *xdp)···330310 mlx5e_xdpi_fifo_pop(xdpi_fifo);331311332312 if (is_redirect) {333333- xdp_return_frame(xdpi.xdpf);334313 dma_unmap_single(sq->pdev, xdpi.dma_addr,335314 xdpi.xdpf->len, DMA_TO_DEVICE);315315+ xdp_return_frame(xdpi.xdpf);336316 } else {337317 /* Recycle RX page */338318 mlx5e_page_release(rq, &xdpi.di, true);···371351 mlx5e_xdpi_fifo_pop(xdpi_fifo);372352373353 if (is_redirect) {374374- xdp_return_frame(xdpi.xdpf);375354 dma_unmap_single(sq->pdev, xdpi.dma_addr,376355 xdpi.xdpf->len, DMA_TO_DEVICE);356356+ xdp_return_frame(xdpi.xdpf);377357 } else {378358 /* Recycle RX page */379359 mlx5e_page_release(rq, &xdpi.di, false);
···26162616 u32 chan;26172617 int ret;2618261826192619- stmmac_check_ether_addr(priv);26202620-26212619 if (priv->hw->pcs != STMMAC_PCS_RGMII &&26222620 priv->hw->pcs != STMMAC_PCS_TBI &&26232621 priv->hw->pcs != STMMAC_PCS_RTBI) {···43004302 ret = stmmac_hw_init(priv);43014303 if (ret)43024304 goto error_hw_init;43054305+43064306+ stmmac_check_ether_addr(priv);4303430743044308 /* Configure real RX and TX queues */43054309 netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use);
+6-2
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
···159159 },160160 .driver_data = (void *)&galileo_stmmac_dmi_data,161161 },162162+ /*163163+ * There are 2 types of SIMATIC IOT2000: IOT20202 and IOT2040.164164+ * The asset tag "6ES7647-0AA00-0YA2" is only for IOT2020 which165165+ * has only one pci network device while other asset tags are166166+ * for IOT2040 which has two.167167+ */162168 {163169 .matches = {164170 DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),···176170 {177171 .matches = {178172 DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),179179- DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,180180- "6ES7647-0AA00-1YA2"),181173 },182174 .driver_data = (void *)&iot2040_stmmac_dmi_data,183175 },
···11541154 return -EINVAL;11551155 }1156115611571157+ if (netdev_has_upper_dev(dev, port_dev)) {11581158+ NL_SET_ERR_MSG(extack, "Device is already an upper device of the team interface");11591159+ netdev_err(dev, "Device %s is already an upper device of the team interface\n",11601160+ portname);11611161+ return -EBUSY;11621162+ }11631163+11571164 if (port_dev->features & NETIF_F_VLAN_CHALLENGED &&11581165 vlan_uses_dev(dev)) {11591166 NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up");
+2
drivers/net/vrf.c
···873873 .ndo_init = vrf_dev_init,874874 .ndo_uninit = vrf_dev_uninit,875875 .ndo_start_xmit = vrf_xmit,876876+ .ndo_set_mac_address = eth_mac_addr,876877 .ndo_get_stats64 = vrf_get_stats64,877878 .ndo_add_slave = vrf_add_slave,878879 .ndo_del_slave = vrf_del_slave,···12731272 /* default to no qdisc; user can add if desired */12741273 dev->priv_flags |= IFF_NO_QUEUE;12751274 dev->priv_flags |= IFF_NO_RX_HANDLER;12751275+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;1276127612771277 /* VRF devices do not care about MTU, but if the MTU is set12781278 * too low then the ipv4 and ipv6 protocols are disabled
···751751 __ap_flush_queue(aq);752752 /* set REMOVE state to prevent new messages are queued in */753753 aq->state = AP_STATE_REMOVE;754754- del_timer_sync(&aq->timeout);755754 spin_unlock_bh(&aq->lock);755755+ del_timer_sync(&aq->timeout);756756}757757758758void ap_queue_remove(struct ap_queue *aq)
···21622162 FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n",21632163 fc_rport_state(rdata));2164216421652165- rdata->flags &= ~FC_RP_STARTED;21662165 fc_rport_enter_delete(rdata, RPORT_EV_STOP);21672166 mutex_unlock(&rdata->rp_mutex);21682167 kref_put(&rdata->kref, fc_rport_destroy);
+5-1
drivers/scsi/scsi_lib.c
···17061706 ret = BLK_STS_DEV_RESOURCE;17071707 break;17081708 default:17091709+ if (unlikely(!scsi_device_online(sdev)))17101710+ scsi_req(req)->result = DID_NO_CONNECT << 16;17111711+ else17121712+ scsi_req(req)->result = DID_ERROR << 16;17091713 /*17101710- * Make sure to release all allocated ressources when17141714+ * Make sure to release all allocated resources when17111715 * we hit an error, as we will never see this command17121716 * again.17131717 */
+4-6
drivers/staging/comedi/drivers/ni_usb6501.c
···463463464464 size = usb_endpoint_maxp(devpriv->ep_tx);465465 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);466466- if (!devpriv->usb_tx_buf) {467467- kfree(devpriv->usb_rx_buf);466466+ if (!devpriv->usb_tx_buf)468467 return -ENOMEM;469469- }470468471469 return 0;472470}···516518 if (!devpriv)517519 return -ENOMEM;518520521521+ mutex_init(&devpriv->mut);522522+ usb_set_intfdata(intf, devpriv);523523+519524 ret = ni6501_find_endpoints(dev);520525 if (ret)521526 return ret;···526525 ret = ni6501_alloc_usb_buffers(dev);527526 if (ret)528527 return ret;529529-530530- mutex_init(&devpriv->mut);531531- usb_set_intfdata(intf, devpriv);532528533529 ret = comedi_alloc_subdevices(dev, 2);534530 if (ret)
+3-5
drivers/staging/comedi/drivers/vmk80xx.c
···682682683683 size = usb_endpoint_maxp(devpriv->ep_tx);684684 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);685685- if (!devpriv->usb_tx_buf) {686686- kfree(devpriv->usb_rx_buf);685685+ if (!devpriv->usb_tx_buf)687686 return -ENOMEM;688688- }689687690688 return 0;691689}···798800799801 devpriv->model = board->model;800802803803+ sema_init(&devpriv->limit_sem, 8);804804+801805 ret = vmk80xx_find_usb_endpoints(dev);802806 if (ret)803807 return ret;···807807 ret = vmk80xx_alloc_usb_buffers(dev);808808 if (ret)809809 return ret;810810-811811- sema_init(&devpriv->limit_sem, 8);812810813811 usb_set_intfdata(intf, devpriv);814812
+1-1
drivers/staging/erofs/data.c
···298298 *last_block = current_block;299299300300 /* shift in advance in case of it followed by too many gaps */301301- if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) {301301+ if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {302302 /* err should reassign to 0 after submitting */303303 err = 0;304304 goto submit_bio_out;
···25122512 * center of the last stop bit in sampling clocks.25132513 */25142514 int last_stop = bits * 2 - 1;25152515- int deviation = min_err * srr * last_stop / 2 / baud;25152515+ int deviation = DIV_ROUND_CLOSEST(min_err * last_stop *25162516+ (int)(srr + 1),25172517+ 2 * (int)baud);2516251825172519 if (abs(deviation) >= 2) {25182520 /* At least two sampling clocks off at the25192521 * last stop bit; we can increase the error25202522 * margin by shifting the sampling point.25212523 */25222522- int shift = min(-8, max(7, deviation / 2));25242524+ int shift = clamp(deviation / 2, -8, 7);2523252525242526 hssrr |= (shift << HSCIF_SRHP_SHIFT) &25252527 HSCIF_SRHP_MASK;
···474474 time64_t put_time; /* Time at which last put */475475 time64_t update_at; /* Time at which to next update the record */476476 unsigned long flags;477477-#define AFS_SERVER_FL_NEW 0 /* New server, don't inc cb_s_break */478477#define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */479478#define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */480479#define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */···826827827828static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode)828829{829829- return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break;830830+ return vnode->cb_break + vnode->cb_v_break;830831}831832832833static inline bool afs_cb_is_broken(unsigned int cb_break,···834835 const struct afs_cb_interest *cbi)835836{836837 return !cbi || cb_break != (vnode->cb_break +837837- cbi->server->cb_s_break +838838 vnode->volume->cb_v_break);839839}840840
+5-1
fs/afs/rxrpc.c
···572572 case -ENODATA:573573 case -EBADMSG:574574 case -EMSGSIZE:575575- default:576575 abort_code = RXGEN_CC_UNMARSHAL;577576 if (state != AFS_CALL_CL_AWAIT_REPLY)578577 abort_code = RXGEN_SS_UNMARSHAL;579578 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,580579 abort_code, ret, "KUM");580580+ goto local_abort;581581+ default:582582+ abort_code = RX_USER_ABORT;583583+ rxrpc_kernel_abort_call(call->net->socket, call->rxcall,584584+ abort_code, ret, "KER");581585 goto local_abort;582586 }583587 }
···360360 return cifs_file;361361}362362363363-/*364364- * Release a reference on the file private data. This may involve closing365365- * the filehandle out on the server. Must be called without holding366366- * tcon->open_file_lock and cifs_file->file_info_lock.363363+/**364364+ * cifsFileInfo_put - release a reference of file priv data365365+ *366366+ * Always potentially wait for oplock handler. See _cifsFileInfo_put().367367 */368368void cifsFileInfo_put(struct cifsFileInfo *cifs_file)369369+{370370+ _cifsFileInfo_put(cifs_file, true);371371+}372372+373373+/**374374+ * _cifsFileInfo_put - release a reference of file priv data375375+ *376376+ * This may involve closing the filehandle @cifs_file out on the377377+ * server. Must be called without holding tcon->open_file_lock and378378+ * cifs_file->file_info_lock.379379+ *380380+ * If @wait_for_oplock_handler is true and we are releasing the last381381+ * reference, wait for any running oplock break handler of the file382382+ * and cancel any pending one. If calling this function from the383383+ * oplock break handler, you need to pass false.384384+ *385385+ */386386+void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)369387{370388 struct inode *inode = d_inode(cifs_file->dentry);371389 struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);···432414433415 spin_unlock(&tcon->open_file_lock);434416435435- oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);417417+ oplock_break_cancelled = wait_oplock_handler ?418418+ cancel_work_sync(&cifs_file->oplock_break) : false;436419437420 if (!tcon->need_reconnect && !cifs_file->invalidHandle) {438421 struct TCP_Server_Info *server = tcon->ses->server;···46224603 cinode);46234604 cifs_dbg(FYI, "Oplock release rc = %d\n", rc);46244605 }46064606+ _cifsFileInfo_put(cfile, false /* do not wait for ourself */);46254607 cifs_done_oplock_break(cinode);46264608}46274609
+23-2
fs/cifs/misc.c
···501501 CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,502502 &pCifsInode->flags);503503504504- queue_work(cifsoplockd_wq,505505- &netfile->oplock_break);504504+ cifs_queue_oplock_break(netfile);506505 netfile->oplock_break_cancelled = false;507506508507 spin_unlock(&tcon->open_file_lock);···604605 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS);605606 }606607 spin_unlock(&cinode->writers_lock);608608+}609609+610610+/**611611+ * cifs_queue_oplock_break - queue the oplock break handler for cfile612612+ *613613+ * This function is called from the demultiplex thread when it614614+ * receives an oplock break for @cfile.615615+ *616616+ * Assumes the tcon->open_file_lock is held.617617+ * Assumes cfile->file_info_lock is NOT held.618618+ */619619+void cifs_queue_oplock_break(struct cifsFileInfo *cfile)620620+{621621+ /*622622+ * Bump the handle refcount now while we hold the623623+ * open_file_lock to enforce the validity of it for the oplock624624+ * break handler. The matching put is done at the end of the625625+ * handler.626626+ */627627+ cifsFileInfo_get(cfile);628628+629629+ queue_work(cifsoplockd_wq, &cfile->oplock_break);607630}608631609632void cifs_done_oplock_break(struct cifsInodeInfo *cinode)
···832832 } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {833833 /* ops set to 3.0 by default for default so update */834834 ses->server->ops = &smb21_operations;835835- } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))835835+ ses->server->vals = &smb21_values;836836+ } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {836837 ses->server->ops = &smb311_operations;838838+ ses->server->vals = &smb311_values;839839+ }837840 } else if (le16_to_cpu(rsp->DialectRevision) !=838841 ses->server->vals->protocol_id) {839842 /* if requested single dialect ensure returned dialect matched */···34513448 rqst.rq_nvec = 1;3452344934533450 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);34543454- cifs_small_buf_release(req);34553455-34563451 rsp = (struct smb2_read_rsp *)rsp_iov.iov_base;3457345234583453 if (rc) {···34713470 trace_smb3_read_done(xid, req->PersistentFileId,34723471 io_parms->tcon->tid, ses->Suid,34733472 io_parms->offset, io_parms->length);34733473+34743474+ cifs_small_buf_release(req);3474347534753476 *nbytes = le32_to_cpu(rsp->DataLength);34763477 if ((*nbytes > CIFS_MAX_MSGSIZE) ||···3772376937733770 rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,37743771 &resp_buftype, flags, &rsp_iov);37753775- cifs_small_buf_release(req);37763772 rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;3777377337783774 if (rc) {···37893787 io_parms->offset, *nbytes);37903788 }3791378937903790+ cifs_small_buf_release(req);37923791 free_rsp_buf(resp_buftype, rsp);37933792 return rc;37943793}
+30-11
fs/io_uring.c
···338338 tail = ctx->cached_cq_tail;339339 /* See comment at the top of the file */340340 smp_rmb();341341- if (tail + 1 == READ_ONCE(ring->r.head))341341+ if (tail - READ_ONCE(ring->r.head) == ring->ring_entries)342342 return NULL;343343344344 ctx->cached_cq_tail++;···682682 list_add_tail(&req->list, &ctx->poll_list);683683}684684685685-static void io_file_put(struct io_submit_state *state, struct file *file)685685+static void io_file_put(struct io_submit_state *state)686686{687687- if (!state) {688688- fput(file);689689- } else if (state->file) {687687+ if (state->file) {690688 int diff = state->has_refs - state->used_refs;691689692690 if (diff)···709711 state->ios_left--;710712 return state->file;711713 }712712- io_file_put(state, NULL);714714+ io_file_put(state);713715 }714716 state->file = fget_many(fd, state->ios_left);715717 if (!state->file)···16691671static void io_submit_state_end(struct io_submit_state *state)16701672{16711673 blk_finish_plug(&state->plug);16721672- io_file_put(state, NULL);16741674+ io_file_put(state);16731675 if (state->free_reqs)16741676 kmem_cache_free_bulk(req_cachep, state->free_reqs,16751677 &state->reqs[state->cur_req]);···19181920 unuse_mm(cur_mm);19191921 mmput(cur_mm);19201922 }19231923+19241924+ if (kthread_should_park())19251925+ kthread_parkme();19261926+19211927 return 0;19221928}19231929···20562054 if (ctx->sqo_thread) {20572055 ctx->sqo_stop = 1;20582056 mb();20572057+ kthread_park(ctx->sqo_thread);20592058 kthread_stop(ctx->sqo_thread);20602059 ctx->sqo_thread = NULL;20612060 }···22392236 mmgrab(current->mm);22402237 ctx->sqo_mm = current->mm;2241223822422242- ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);22432243- if (!ctx->sq_thread_idle)22442244- ctx->sq_thread_idle = HZ;22452245-22462239 ret = -EINVAL;22472240 if (!cpu_possible(p->sq_thread_cpu))22482241 goto err;···22482249 if (!capable(CAP_SYS_ADMIN))22492250 goto err;2250225122522252+ ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);22532253+ if (!ctx->sq_thread_idle)22542254+ ctx->sq_thread_idle = HZ;22552255+22512256 if (p->flags & IORING_SETUP_SQ_AFF) {22522257 int cpu;2253225822542259 cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS);22602260+ ret = -EINVAL;22612261+ if (!cpu_possible(p->sq_thread_cpu))22622262+ goto err;22632263+22552264 ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread,22562265 ctx, cpu,22572266 "io_uring-sq");···2929292229302923static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,29312924 void __user *arg, unsigned nr_args)29252925+ __releases(ctx->uring_lock)29262926+ __acquires(ctx->uring_lock)29322927{29332928 int ret;2934292929352930 percpu_ref_kill(&ctx->refs);29312931+29322932+ /*29332933+ * Drop uring mutex before waiting for references to exit. If another29342934+ * thread is currently inside io_uring_enter() it might need to grab29352935+ * the uring_lock to make progress. If we hold it here across the drain29362936+ * wait, then we can deadlock. It's safe to drop the mutex here, since29372937+ * no new references will come in after we've killed the percpu ref.29382938+ */29392939+ mutex_unlock(&ctx->uring_lock);29362940 wait_for_completion(&ctx->ctx_done);29412941+ mutex_lock(&ctx->uring_lock);2937294229382943 switch (opcode) {29392944 case IORING_REGISTER_BUFFERS:
···449449}450450451451/**452452+ * eth_addr_inc() - Increment the given MAC address.453453+ * @addr: Pointer to a six-byte array containing Ethernet address to increment.454454+ */455455+static inline void eth_addr_inc(u8 *addr)456456+{457457+ u64 u = ether_addr_to_u64(addr);458458+459459+ u++;460460+ u64_to_ether_addr(u, addr);461461+}462462+463463+/**452464 * is_etherdev_addr - Tell if given Ethernet address belongs to the device.453465 * @dev: Pointer to a device structure454466 * @addr: Pointer to a six-byte array containing the Ethernet address
···4949 __mmdrop(mm);5050}51515252+/*5353+ * This has to be called after a get_task_mm()/mmget_not_zero()5454+ * followed by taking the mmap_sem for writing before modifying the5555+ * vmas or anything the coredump pretends not to change from under it.5656+ *5757+ * NOTE: find_extend_vma() called from GUP context is the only place5858+ * that can modify the "mm" (notably the vm_start/end) under mmap_sem5959+ * for reading and outside the context of the process, so it is also6060+ * the only case that holds the mmap_sem for reading that must call6161+ * this function. Generally if the mmap_sem is hold for reading6262+ * there's no need of this check after get_task_mm()/mmget_not_zero().6363+ *6464+ * This function can be obsoleted and the check can be removed, after6565+ * the coredump code will hold the mmap_sem for writing before6666+ * invoking the ->core_dump methods.6767+ */6868+static inline bool mmget_still_valid(struct mm_struct *mm)6969+{7070+ return likely(!mm->core_state);7171+}7272+5273/**5374 * mmget() - Pin the address space associated with a &struct mm_struct.5475 * @mm: The address space to pin.
+1
include/linux/shmem_fs.h
···2121 struct list_head swaplist; /* chain of maybes on swap */2222 struct shared_policy policy; /* NUMA memory alloc policy */2323 struct simple_xattrs xattrs; /* list of xattrs */2424+ atomic_t stop_eviction; /* hold when working on inode */2425 struct inode vfs_inode;2526};2627
···582582 page_alloc_init();583583584584 pr_notice("Kernel command line: %s\n", boot_command_line);585585+ /* parameters may set static keys */586586+ jump_label_init();585587 parse_early_param();586588 after_dashes = parse_args("Booting kernel",587589 static_command_line, __start___param,···592590 if (!IS_ERR_OR_NULL(after_dashes))593591 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,594592 NULL, set_init_arg);595595-596596- jump_label_init();597593598594 /*599595 * These use large bootmem allocations and must precede
+21-16
kernel/events/core.c
···90779077 if (task == TASK_TOMBSTONE)90789078 return;9079907990809080- if (!ifh->nr_file_filters)90819081- return;90809080+ if (ifh->nr_file_filters) {90819081+ mm = get_task_mm(event->ctx->task);90829082+ if (!mm)90839083+ goto restart;9082908490839083- mm = get_task_mm(event->ctx->task);90849084- if (!mm)90859085- goto restart;90869086-90879087- down_read(&mm->mmap_sem);90859085+ down_read(&mm->mmap_sem);90869086+ }9088908790899088 raw_spin_lock_irqsave(&ifh->lock, flags);90909089 list_for_each_entry(filter, &ifh->list, entry) {90919091- event->addr_filter_ranges[count].start = 0;90929092- event->addr_filter_ranges[count].size = 0;90909090+ if (filter->path.dentry) {90919091+ /*90929092+ * Adjust base offset if the filter is associated to a90939093+ * binary that needs to be mapped:90949094+ */90959095+ event->addr_filter_ranges[count].start = 0;90969096+ event->addr_filter_ranges[count].size = 0;9093909790949094- /*90959095- * Adjust base offset if the filter is associated to a binary90969096- * that needs to be mapped:90979097- */90989098- if (filter->path.dentry)90999098 perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]);90999099+ } else {91009100+ event->addr_filter_ranges[count].start = filter->offset;91019101+ event->addr_filter_ranges[count].size = filter->size;91029102+ }9100910391019104 count++;91029105 }···91079104 event->addr_filters_gen++;91089105 raw_spin_unlock_irqrestore(&ifh->lock, flags);9109910691109110- up_read(&mm->mmap_sem);91079107+ if (ifh->nr_file_filters) {91089108+ up_read(&mm->mmap_sem);9111910991129112- mmput(mm);91109110+ mmput(mm);91119111+ }9113911291149113restart:91159114 perf_event_stop(event, 1);
+15-18
kernel/events/ring_buffer.c
···455455 rb->aux_head += size;456456 }457457458458- if (size || handle->aux_flags) {459459- /*460460- * Only send RECORD_AUX if we have something useful to communicate461461- *462462- * Note: the OVERWRITE records by themselves are not considered463463- * useful, as they don't communicate any *new* information,464464- * aside from the short-lived offset, that becomes history at465465- * the next event sched-in and therefore isn't useful.466466- * The userspace that needs to copy out AUX data in overwrite467467- * mode should know to use user_page::aux_head for the actual468468- * offset. So, from now on we don't output AUX records that469469- * have *only* OVERWRITE flag set.470470- */471471-472472- if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)473473- perf_event_aux_event(handle->event, aux_head, size,474474- handle->aux_flags);475475- }458458+ /*459459+ * Only send RECORD_AUX if we have something useful to communicate460460+ *461461+ * Note: the OVERWRITE records by themselves are not considered462462+ * useful, as they don't communicate any *new* information,463463+ * aside from the short-lived offset, that becomes history at464464+ * the next event sched-in and therefore isn't useful.465465+ * The userspace that needs to copy out AUX data in overwrite466466+ * mode should know to use user_page::aux_head for the actual467467+ * offset. So, from now on we don't output AUX records that468468+ * have *only* OVERWRITE flag set.469469+ */470470+ if (size || (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE))471471+ perf_event_aux_event(handle->event, aux_head, size,472472+ handle->aux_flags);476473477474 rb->user_page->aux_head = rb->aux_head;478475 if (rb_need_aux_wakeup(rb))
+2-4
kernel/kprobes.c
···709709static int reuse_unused_kprobe(struct kprobe *ap)710710{711711 struct optimized_kprobe *op;712712- int ret;713712714713 /*715714 * Unused kprobe MUST be on the way of delayed unoptimizing (means···719720 /* Enable the probe again */720721 ap->flags &= ~KPROBE_FLAG_DISABLED;721722 /* Optimize it again (remove from op->list) */722722- ret = kprobe_optready(ap);723723- if (ret)724724- return ret;723723+ if (!kprobe_optready(ap))724724+ return -EINVAL;725725726726 optimize_kprobe(ap);727727 return 0;
···252252 if (dl_entity_is_special(dl_se))253253 return;254254255255- WARN_ON(hrtimer_active(&dl_se->inactive_timer));256255 WARN_ON(dl_se->dl_non_contending);257256258257 zerolag_time = dl_se->deadline -···268269 * If the "0-lag time" already passed, decrease the active269270 * utilization now, instead of starting a timer270271 */271271- if (zerolag_time < 0) {272272+ if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) {272273 if (dl_task(p))273274 sub_running_bw(dl_se, dl_rq);274275 if (!dl_task(p) || p->state == TASK_DEAD) {
+25
kernel/sched/fair.c
···48854885 return HRTIMER_NORESTART;48864886}4887488748884888+extern const u64 max_cfs_quota_period;48894889+48884890static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)48894891{48904892 struct cfs_bandwidth *cfs_b =···48944892 unsigned long flags;48954893 int overrun;48964894 int idle = 0;48954895+ int count = 0;4897489648984897 raw_spin_lock_irqsave(&cfs_b->lock, flags);48994898 for (;;) {49004899 overrun = hrtimer_forward_now(timer, cfs_b->period);49014900 if (!overrun)49024901 break;49024902+49034903+ if (++count > 3) {49044904+ u64 new, old = ktime_to_ns(cfs_b->period);49054905+49064906+ new = (old * 147) / 128; /* ~115% */49074907+ new = min(new, max_cfs_quota_period);49084908+49094909+ cfs_b->period = ns_to_ktime(new);49104910+49114911+ /* since max is 1s, this is limited to 1e9^2, which fits in u64 */49124912+ cfs_b->quota *= new;49134913+ cfs_b->quota = div64_u64(cfs_b->quota, old);49144914+49154915+ pr_warn_ratelimited(49164916+ "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n",49174917+ smp_processor_id(),49184918+ div_u64(new, NSEC_PER_USEC),49194919+ div_u64(cfs_b->quota, NSEC_PER_USEC));49204920+49214921+ /* reset count so we don't come right back in here */49224922+ count = 0;49234923+ }4903492449044925 idle = do_sched_cfs_period_timer(cfs_b, overrun, flags);49054926 }
···1414extern void timekeeping_warp_clock(void);1515extern int timekeeping_suspend(void);1616extern void timekeeping_resume(void);1717+#ifdef CONFIG_GENERIC_SCHED_CLOCK1818+extern int sched_clock_suspend(void);1919+extern void sched_clock_resume(void);2020+#else2121+static inline int sched_clock_suspend(void) { return 0; }2222+static inline void sched_clock_resume(void) { }2323+#endif17241825extern void do_timer(unsigned long ticks);1926extern void update_wall_time(void);
+5-1
kernel/trace/ftrace.c
···3333#include <linux/list.h>3434#include <linux/hash.h>3535#include <linux/rcupdate.h>3636+#include <linux/kprobes.h>36373738#include <trace/events/sched.h>3839···62476246 tr->ops->func = ftrace_stub;62486247}6249624862506250-static inline void62496249+static nokprobe_inline void62516250__ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,62526251 struct ftrace_ops *ignored, struct pt_regs *regs)62536252{···63076306{63086307 __ftrace_ops_list_func(ip, parent_ip, NULL, regs);63096308}63096309+NOKPROBE_SYMBOL(ftrace_ops_list_func);63106310#else63116311static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip)63126312{63136313 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL);63146314}63156315+NOKPROBE_SYMBOL(ftrace_ops_no_ops);63156316#endif6316631763176318/*···63406337 preempt_enable_notrace();63416338 trace_clear_recursion(bit);63426339}63406340+NOKPROBE_SYMBOL(ftrace_ops_assist_func);6343634163446342/**63456343 * ftrace_ops_get_func - get the function a trampoline should call
+2-1
kernel/watchdog_hld.c
···135135 if (__this_cpu_read(hard_watchdog_warn) == true)136136 return;137137138138- pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu);138138+ pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n",139139+ this_cpu);139140 print_modules();140141 print_irqtrace_events(current);141142 if (regs)
+3-3
lib/Kconfig.debug
···761761config ARCH_HAS_KCOV762762 bool763763 help764764- KCOV does not have any arch-specific code, but currently it is enabled765765- only for x86_64. KCOV requires testing on other archs, and most likely766766- disabling of instrumentation for some early boot code.764764+ An architecture should select this when it can successfully765765+ build and run with CONFIG_KCOV. This typically requires766766+ disabling instrumentation for some early boot code.767767768768config CC_HAS_SANCOV_TRACE_PC769769 def_bool $(cc-option,-fsanitize-coverage=trace-pc)
···4545#include <linux/moduleparam.h>4646#include <linux/pkeys.h>4747#include <linux/oom.h>4848+#include <linux/sched/mm.h>48494950#include <linux/uaccess.h>5051#include <asm/cacheflush.h>···25262525 vma = find_vma_prev(mm, addr, &prev);25272526 if (vma && (vma->vm_start <= addr))25282527 return vma;25292529- if (!prev || expand_stack(prev, addr))25282528+ /* don't alter vm_end if the coredump is running */25292529+ if (!prev || !mmget_still_valid(mm) || expand_stack(prev, addr))25302530 return NULL;25312531 if (prev->vm_flags & VM_LOCKED)25322532 populate_vma_page_range(prev, addr, prev->vm_end, NULL);···25522550 if (vma->vm_start <= addr)25532551 return vma;25542552 if (!(vma->vm_flags & VM_GROWSDOWN))25532553+ return NULL;25542554+ /* don't alter vm_start if the coredump is running */25552555+ if (!mmget_still_valid(mm))25552556 return NULL;25562557 start = vma->vm_start;25572558 if (expand_stack(vma, addr))
+18-12
mm/page_alloc.c
···80058005bool has_unmovable_pages(struct zone *zone, struct page *page, int count,80068006 int migratetype, int flags)80078007{80088008- unsigned long pfn, iter, found;80088008+ unsigned long found;80098009+ unsigned long iter = 0;80108010+ unsigned long pfn = page_to_pfn(page);80118011+ const char *reason = "unmovable page";8009801280108013 /*80118014 * TODO we could make this much more efficient by not checking every···80188015 * can still lead to having bootmem allocations in zone_movable.80198016 */8020801780218021- /*80228022- * CMA allocations (alloc_contig_range) really need to mark isolate80238023- * CMA pageblocks even when they are not movable in fact so consider80248024- * them movable here.80258025- */80268026- if (is_migrate_cma(migratetype) &&80278027- is_migrate_cma(get_pageblock_migratetype(page)))80288028- return false;80188018+ if (is_migrate_cma_page(page)) {80198019+ /*80208020+ * CMA allocations (alloc_contig_range) really need to mark80218021+ * isolate CMA pageblocks even when they are not movable in fact80228022+ * so consider them movable here.80238023+ */80248024+ if (is_migrate_cma(migratetype))80258025+ return false;8029802680308030- pfn = page_to_pfn(page);80318031- for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) {80278027+ reason = "CMA page";80288028+ goto unmovable;80298029+ }80308030+80318031+ for (found = 0; iter < pageblock_nr_pages; iter++) {80328032 unsigned long check = pfn + iter;8033803380348034 if (!pfn_valid_within(check))···81118105unmovable:81128106 WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);81138107 if (flags & REPORT_FAILURE)81148114- dump_page(pfn_to_page(pfn+iter), "unmovable page");81088108+ dump_page(pfn_to_page(pfn + iter), reason);81158109 return true;81168110}81178111
···10811081 }10821082 spin_unlock(&sbinfo->shrinklist_lock);10831083 }10841084- if (!list_empty(&info->swaplist)) {10841084+ while (!list_empty(&info->swaplist)) {10851085+ /* Wait while shmem_unuse() is scanning this inode... */10861086+ wait_var_event(&info->stop_eviction,10871087+ !atomic_read(&info->stop_eviction));10851088 mutex_lock(&shmem_swaplist_mutex);10861086- list_del_init(&info->swaplist);10891089+ /* ...but beware of the race if we peeked too early */10901090+ if (!atomic_read(&info->stop_eviction))10911091+ list_del_init(&info->swaplist);10871092 mutex_unlock(&shmem_swaplist_mutex);10881093 }10891094 }···11041099static int shmem_find_swap_entries(struct address_space *mapping,11051100 pgoff_t start, unsigned int nr_entries,11061101 struct page **entries, pgoff_t *indices,11071107- bool frontswap)11021102+ unsigned int type, bool frontswap)11081103{11091104 XA_STATE(xas, &mapping->i_pages, start);11101105 struct page *page;11061106+ swp_entry_t entry;11111107 unsigned int ret = 0;1112110811131109 if (!nr_entries)···11221116 if (!xa_is_value(page))11231117 continue;1124111811251125- if (frontswap) {11261126- swp_entry_t entry = radix_to_swp_entry(page);11271127-11281128- if (!frontswap_test(swap_info[swp_type(entry)],11291129- swp_offset(entry)))11301130- continue;11311131- }11191119+ entry = radix_to_swp_entry(page);11201120+ if (swp_type(entry) != type)11211121+ continue;11221122+ if (frontswap &&11231123+ !frontswap_test(swap_info[type], swp_offset(entry)))11241124+ continue;1132112511331126 indices[ret] = xas.xa_index;11341127 entries[ret] = page;···1199119412001195 pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries,12011196 pvec.pages, indices,12021202- frontswap);11971197+ type, frontswap);12031198 if (pvec.nr == 0) {12041199 ret = 0;12051200 break;···12321227 unsigned long *fs_pages_to_unuse)12331228{12341229 struct shmem_inode_info *info, *next;12351235- struct inode *inode;12361236- struct inode *prev_inode = NULL;12371230 int error = 0;1238123112391232 if (list_empty(&shmem_swaplist))12401233 return 0;1241123412421235 mutex_lock(&shmem_swaplist_mutex);12431243-12441244- /*12451245- * The extra refcount on the inode is necessary to safely dereference12461246- * p->next after re-acquiring the lock. New shmem inodes with swap12471247- * get added to the end of the list and we will scan them all.12481248- */12491236 list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) {12501237 if (!info->swapped) {12511238 list_del_init(&info->swaplist);12521239 continue;12531240 }12541254-12551255- inode = igrab(&info->vfs_inode);12561256- if (!inode)12571257- continue;12581258-12411241+ /*12421242+ * Drop the swaplist mutex while searching the inode for swap;12431243+ * but before doing so, make sure shmem_evict_inode() will not12441244+ * remove placeholder inode from swaplist, nor let it be freed12451245+ * (igrab() would protect from unlink, but not from unmount).12461246+ */12471247+ atomic_inc(&info->stop_eviction);12591248 mutex_unlock(&shmem_swaplist_mutex);12601260- if (prev_inode)12611261- iput(prev_inode);12621262- prev_inode = inode;1263124912641264- error = shmem_unuse_inode(inode, type, frontswap,12501250+ error = shmem_unuse_inode(&info->vfs_inode, type, frontswap,12651251 fs_pages_to_unuse);12661252 cond_resched();12671253···12601264 next = list_next_entry(info, swaplist);12611265 if (!info->swapped)12621266 list_del_init(&info->swaplist);12671267+ if (atomic_dec_and_test(&info->stop_eviction))12681268+ wake_up_var(&info->stop_eviction);12631269 if (error)12641270 break;12651271 }12661272 mutex_unlock(&shmem_swaplist_mutex);12671267-12681268- if (prev_inode)12691269- iput(prev_inode);1270127312711274 return error;12721275}···22332238 info = SHMEM_I(inode);22342239 memset(info, 0, (char *)inode - (char *)info);22352240 spin_lock_init(&info->lock);22412241+ atomic_set(&info->stop_eviction, 0);22362242 info->seals = F_SEAL_SEAL;22372243 info->flags = flags & VM_NORESERVE;22382244 INIT_LIST_HEAD(&info->shrinklist);
···20232023 * If the boolean frontswap is true, only unuse pages_to_unuse pages;20242024 * pages_to_unuse==0 means all pages; ignored if frontswap is false20252025 */20262026-#define SWAP_UNUSE_MAX_TRIES 320272026int try_to_unuse(unsigned int type, bool frontswap,20282027 unsigned long pages_to_unuse)20292028{···20342035 struct page *page;20352036 swp_entry_t entry;20362037 unsigned int i;20372037- int retries = 0;2038203820392039 if (!si->inuse_pages)20402040 return 0;···2051205320522054 spin_lock(&mmlist_lock);20532055 p = &init_mm.mmlist;20542054- while ((p = p->next) != &init_mm.mmlist) {20552055- if (signal_pending(current)) {20562056- retval = -EINTR;20572057- break;20582058- }20562056+ while (si->inuse_pages &&20572057+ !signal_pending(current) &&20582058+ (p = p->next) != &init_mm.mmlist) {2059205920602060 mm = list_entry(p, struct mm_struct, mmlist);20612061 if (!mmget_not_zero(mm))···20802084 mmput(prev_mm);2081208520822086 i = 0;20832083- while ((i = find_next_to_unuse(si, i, frontswap)) != 0) {20872087+ while (si->inuse_pages &&20882088+ !signal_pending(current) &&20892089+ (i = find_next_to_unuse(si, i, frontswap)) != 0) {2084209020852091 entry = swp_entry(type, i);20862092 page = find_get_page(swap_address_space(entry), i);···21152117 * If yes, we would need to do retry the unuse logic again.21162118 * Under global memory pressure, swap entries can be reinserted back21172119 * into process space after the mmlist loop above passes over them.21182118- * Its not worth continuosuly retrying to unuse the swap in this case.21192119- * So we try SWAP_UNUSE_MAX_TRIES times.21202120+ *21212121+ * Limit the number of retries? No: when mmget_not_zero() above fails,21222122+ * that mm is likely to be freeing swap from exit_mmap(), which proceeds21232123+ * at its own independent pace; and even shmem_writepage() could have21242124+ * been preempted after get_swap_page(), temporarily hiding that swap.21252125+ * It's easy and robust (though cpu-intensive) just to keep retrying.21202126 */21212121- if (++retries >= SWAP_UNUSE_MAX_TRIES)21222122- retval = -EBUSY;21232123- else if (si->inuse_pages)21242124- goto retry;21252125-21272127+ if (si->inuse_pages) {21282128+ if (!signal_pending(current))21292129+ goto retry;21302130+ retval = -EINTR;21312131+ }21262132out:21272133 return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval;21282134}
+9-20
mm/vmscan.c
···21762176 * 10TB 320 32GB21772177 */21782178static bool inactive_list_is_low(struct lruvec *lruvec, bool file,21792179- struct mem_cgroup *memcg,21802179 struct scan_control *sc, bool actual_reclaim)21812180{21822181 enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;···21962197 inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx);21972198 active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx);2198219921992199- if (memcg)22002200- refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE);22012201- else22022202- refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE);22032203-22042200 /*22052201 * When refaults are being observed, it means a new workingset22062202 * is being established. Disable active list protection to get22072203 * rid of the stale workingset quickly.22082204 */22052205+ refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);22092206 if (file && actual_reclaim && lruvec->refaults != refaults) {22102207 inactive_ratio = 0;22112208 } else {···22222227}2223222822242229static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,22252225- struct lruvec *lruvec, struct mem_cgroup *memcg,22262226- struct scan_control *sc)22302230+ struct lruvec *lruvec, struct scan_control *sc)22272231{22282232 if (is_active_lru(lru)) {22292229- if (inactive_list_is_low(lruvec, is_file_lru(lru),22302230- memcg, sc, true))22332233+ if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true))22312234 shrink_active_list(nr_to_scan, lruvec, sc, lru);22322235 return 0;22332236 }···23252332 * anonymous pages on the LRU in eligible zones.23262333 * Otherwise, the small LRU gets thrashed.23272334 */23282328- if (!inactive_list_is_low(lruvec, false, memcg, sc, false) &&23352335+ if (!inactive_list_is_low(lruvec, false, sc, false) &&23292336 lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx)23302337 >> sc->priority) {23312338 scan_balance = SCAN_ANON;···23432350 * lruvec even if it has plenty of old anonymous pages unless the23442351 * system is under heavy pressure.23452352 */23462346- if (!inactive_list_is_low(lruvec, true, memcg, sc, false) &&23532353+ if (!inactive_list_is_low(lruvec, true, sc, false) &&23472354 lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) {23482355 scan_balance = SCAN_FILE;23492356 goto out;···24962503 nr[lru] -= nr_to_scan;2497250424982505 nr_reclaimed += shrink_list(lru, nr_to_scan,24992499- lruvec, memcg, sc);25062506+ lruvec, sc);25002507 }25012508 }25022509···25632570 * Even if we did not try to evict anon pages at all, we want to25642571 * rebalance the anon lru active/inactive ratio.25652572 */25662566- if (inactive_list_is_low(lruvec, false, memcg, sc, true))25732573+ if (inactive_list_is_low(lruvec, false, sc, true))25672574 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,25682575 sc, LRU_ACTIVE_ANON);25692576}···29622969 unsigned long refaults;29632970 struct lruvec *lruvec;2964297129652965- if (memcg)29662966- refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE);29672967- else29682968- refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE);29692969-29702972 lruvec = mem_cgroup_lruvec(pgdat, memcg);29732973+ refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);29712974 lruvec->refaults = refaults;29722975 } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL)));29732976}···33283339 do {33293340 struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg);3330334133313331- if (inactive_list_is_low(lruvec, false, memcg, sc, true))33423342+ if (inactive_list_is_low(lruvec, false, sc, true))33323343 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,33333344 sc, LRU_ACTIVE_ANON);33343345
···20272027 if (match_kern)20282028 match_kern->match_size = ret;2029202920302030- if (WARN_ON(type == EBT_COMPAT_TARGET && size_left))20302030+ /* rule should have no remaining data after target */20312031+ if (type == EBT_COMPAT_TARGET && size_left)20312032 return -EINVAL;2032203320332034 match32 = (struct compat_ebt_entry_mwt *) buf;
+24-10
net/ipv4/route.c
···11981198 return dst;11991199}1200120012011201-static void ipv4_link_failure(struct sk_buff *skb)12011201+static void ipv4_send_dest_unreach(struct sk_buff *skb)12021202{12031203 struct ip_options opt;12041204- struct rtable *rt;12051204 int res;1206120512071206 /* Recompile ip options since IPCB may not be valid anymore.12071207+ * Also check we have a reasonable ipv4 header.12081208 */12091209- memset(&opt, 0, sizeof(opt));12101210- opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);12111211-12121212- rcu_read_lock();12131213- res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL);12141214- rcu_read_unlock();12151215-12161216- if (res)12091209+ if (!pskb_network_may_pull(skb, sizeof(struct iphdr)) ||12101210+ ip_hdr(skb)->version != 4 || ip_hdr(skb)->ihl < 5)12171211 return;1218121212131213+ memset(&opt, 0, sizeof(opt));12141214+ if (ip_hdr(skb)->ihl > 5) {12151215+ if (!pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4))12161216+ return;12171217+ opt.optlen = ip_hdr(skb)->ihl * 4 - sizeof(struct iphdr);12181218+12191219+ rcu_read_lock();12201220+ res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL);12211221+ rcu_read_unlock();12221222+12231223+ if (res)12241224+ return;12251225+ }12191226 __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt);12271227+}12281228+12291229+static void ipv4_link_failure(struct sk_buff *skb)12301230+{12311231+ struct rtable *rt;12321232+12331233+ ipv4_send_dest_unreach(skb);1220123412211235 rt = skb_rtable(skb);12221236 if (rt)
···476476 }477477478478 if (nlmsg_attrlen(nlh, sizeof(*ifal))) {479479- NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump requewst");479479+ NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump request");480480 return -EINVAL;481481 }482482
+5-1
net/ncsi/ncsi-rsp.c
···1111#include <linux/kernel.h>1212#include <linux/init.h>1313#include <linux/netdevice.h>1414+#include <linux/etherdevice.h>1415#include <linux/skbuff.h>15161617#include <net/ncsi.h>···668667 ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;669668 memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN);670669 /* Increase mac address by 1 for BMC's address */671671- saddr.sa_data[ETH_ALEN - 1]++;670670+ eth_addr_inc((u8 *)saddr.sa_data);671671+ if (!is_valid_ether_addr((const u8 *)saddr.sa_data))672672+ return -ENXIO;673673+672674 ret = ops->ndo_set_mac_address(ndev, &saddr);673675 if (ret < 0)674676 netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
+1-1
net/netfilter/ipvs/ip_vs_core.c
···16781678 if (!cp) {16791679 int v;1680168016811681- if (!sysctl_schedule_icmp(ipvs))16811681+ if (ipip || !sysctl_schedule_icmp(ipvs))16821682 return NF_ACCEPT;1683168316841684 if (!ip_vs_try_to_schedule(ipvs, AF_INET, skb, pd, &v, &cp, &ciph))
+38-5
net/netfilter/nf_conntrack_core.c
···2525#include <linux/slab.h>2626#include <linux/random.h>2727#include <linux/jhash.h>2828+#include <linux/siphash.h>2829#include <linux/err.h>2930#include <linux/percpu.h>3031#include <linux/moduleparam.h>···449448 return true;450449}451450EXPORT_SYMBOL_GPL(nf_ct_invert_tuple);451451+452452+/* Generate a almost-unique pseudo-id for a given conntrack.453453+ *454454+ * intentionally doesn't re-use any of the seeds used for hash455455+ * table location, we assume id gets exposed to userspace.456456+ *457457+ * Following nf_conn items do not change throughout lifetime458458+ * of the nf_conn after it has been committed to main hash table:459459+ *460460+ * 1. nf_conn address461461+ * 2. nf_conn->ext address462462+ * 3. nf_conn->master address (normally NULL)463463+ * 4. tuple464464+ * 5. the associated net namespace465465+ */466466+u32 nf_ct_get_id(const struct nf_conn *ct)467467+{468468+ static __read_mostly siphash_key_t ct_id_seed;469469+ unsigned long a, b, c, d;470470+471471+ net_get_random_once(&ct_id_seed, sizeof(ct_id_seed));472472+473473+ a = (unsigned long)ct;474474+ b = (unsigned long)ct->master ^ net_hash_mix(nf_ct_net(ct));475475+ c = (unsigned long)ct->ext;476476+ d = (unsigned long)siphash(&ct->tuplehash, sizeof(ct->tuplehash),477477+ &ct_id_seed);478478+#ifdef CONFIG_64BIT479479+ return siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &ct_id_seed);480480+#else481481+ return siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &ct_id_seed);482482+#endif483483+}484484+EXPORT_SYMBOL_GPL(nf_ct_get_id);452485453486static void454487clean_from_lists(struct nf_conn *ct)···10179821018983 /* set conntrack timestamp, if enabled. */1019984 tstamp = nf_conn_tstamp_find(ct);10201020- if (tstamp) {10211021- if (skb->tstamp == 0)10221022- __net_timestamp(skb);985985+ if (tstamp)986986+ tstamp->start = ktime_get_real_ns();102398710241024- tstamp->start = ktime_to_ns(skb->tstamp);10251025- }1026988 /* Since the lookup is lockless, hash insertion must be done after1027989 * starting the timer and setting the CONFIRMED bit. The RCU barriers1028990 * guarantee that no other CPU can find the conntrack before the above···13821350 /* save hash for reusing when confirming */13831351 *(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash;13841352 ct->status = 0;13531353+ ct->timeout = 0;13851354 write_pnet(&ct->ct_net, net);13861355 memset(&ct->__nfct_init_offset[0], 0,13871356 offsetof(struct nf_conn, proto) -
+29-5
net/netfilter/nf_conntrack_netlink.c
···2929#include <linux/spinlock.h>3030#include <linux/interrupt.h>3131#include <linux/slab.h>3232+#include <linux/siphash.h>32333334#include <linux/netfilter.h>3435#include <net/netlink.h>···486485487486static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct)488487{489489- if (nla_put_be32(skb, CTA_ID, htonl((unsigned long)ct)))488488+ __be32 id = (__force __be32)nf_ct_get_id(ct);489489+490490+ if (nla_put_be32(skb, CTA_ID, id))490491 goto nla_put_failure;491492 return 0;492493···12891286 }1290128712911288 if (cda[CTA_ID]) {12921292- u_int32_t id = ntohl(nla_get_be32(cda[CTA_ID]));12931293- if (id != (u32)(unsigned long)ct) {12891289+ __be32 id = nla_get_be32(cda[CTA_ID]);12901290+12911291+ if (id != (__force __be32)nf_ct_get_id(ct)) {12941292 nf_ct_put(ct);12951293 return -ENOENT;12961294 }···2696269226972693static const union nf_inet_addr any_addr;2698269426952695+static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp)26962696+{26972697+ static __read_mostly siphash_key_t exp_id_seed;26982698+ unsigned long a, b, c, d;26992699+27002700+ net_get_random_once(&exp_id_seed, sizeof(exp_id_seed));27012701+27022702+ a = (unsigned long)exp;27032703+ b = (unsigned long)exp->helper;27042704+ c = (unsigned long)exp->master;27052705+ d = (unsigned long)siphash(&exp->tuple, sizeof(exp->tuple), &exp_id_seed);27062706+27072707+#ifdef CONFIG_64BIT27082708+ return (__force __be32)siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &exp_id_seed);27092709+#else27102710+ return (__force __be32)siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &exp_id_seed);27112711+#endif27122712+}27132713+26992714static int27002715ctnetlink_exp_dump_expect(struct sk_buff *skb,27012716 const struct nf_conntrack_expect *exp)···27622739 }27632740#endif27642741 if (nla_put_be32(skb, CTA_EXPECT_TIMEOUT, htonl(timeout)) ||27652765- nla_put_be32(skb, CTA_EXPECT_ID, htonl((unsigned long)exp)) ||27422742+ nla_put_be32(skb, CTA_EXPECT_ID, nf_expect_get_id(exp)) ||27662743 nla_put_be32(skb, CTA_EXPECT_FLAGS, htonl(exp->flags)) ||27672744 nla_put_be32(skb, CTA_EXPECT_CLASS, htonl(exp->class)))27682745 goto nla_put_failure;···3067304430683045 if (cda[CTA_EXPECT_ID]) {30693046 __be32 id = nla_get_be32(cda[CTA_EXPECT_ID]);30703070- if (ntohl(id) != (u32)(unsigned long)exp) {30473047+30483048+ if (id != nf_expect_get_id(exp)) {30713049 nf_ct_expect_put(exp);30723050 return -ENOENT;30733051 }
+1-1
net/netfilter/nf_conntrack_proto.c
···5555 struct va_format vaf;5656 va_list args;57575858- if (net->ct.sysctl_log_invalid != protonum ||5858+ if (net->ct.sysctl_log_invalid != protonum &&5959 net->ct.sysctl_log_invalid != IPPROTO_RAW)6060 return;6161
+74-23
net/netfilter/nf_conntrack_proto_icmp.c
···103103 return NF_ACCEPT;104104}105105106106-/* Returns conntrack if it dealt with ICMP, and filled in skb fields */107107-static int108108-icmp_error_message(struct nf_conn *tmpl, struct sk_buff *skb,109109- const struct nf_hook_state *state)106106+/* Check inner header is related to any of the existing connections */107107+int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb,108108+ unsigned int dataoff,109109+ const struct nf_hook_state *state,110110+ u8 l4proto, union nf_inet_addr *outer_daddr)110111{111112 struct nf_conntrack_tuple innertuple, origtuple;112113 const struct nf_conntrack_tuple_hash *h;113114 const struct nf_conntrack_zone *zone;114115 enum ip_conntrack_info ctinfo;115116 struct nf_conntrack_zone tmp;117117+ union nf_inet_addr *ct_daddr;118118+ enum ip_conntrack_dir dir;119119+ struct nf_conn *ct;116120117121 WARN_ON(skb_nfct(skb));118122 zone = nf_ct_zone_tmpl(tmpl, skb, &tmp);119123120124 /* Are they talking about one of our connections? */121121- if (!nf_ct_get_tuplepr(skb,122122- skb_network_offset(skb) + ip_hdrlen(skb)123123- + sizeof(struct icmphdr),124124- PF_INET, state->net, &origtuple)) {125125- pr_debug("icmp_error_message: failed to get tuple\n");125125+ if (!nf_ct_get_tuplepr(skb, dataoff,126126+ state->pf, state->net, &origtuple))126127 return -NF_ACCEPT;127127- }128128129129 /* Ordinarily, we'd expect the inverted tupleproto, but it's130130 been preserved inside the ICMP. */131131- if (!nf_ct_invert_tuple(&innertuple, &origtuple)) {132132- pr_debug("icmp_error_message: no match\n");131131+ if (!nf_ct_invert_tuple(&innertuple, &origtuple))132132+ return -NF_ACCEPT;133133+134134+ h = nf_conntrack_find_get(state->net, zone, &innertuple);135135+ if (!h)136136+ return -NF_ACCEPT;137137+138138+ /* Consider: A -> T (=This machine) -> B139139+ * Conntrack entry will look like this:140140+ * Original: A->B141141+ * Reply: B->T (SNAT case) OR A142142+ *143143+ * When this function runs, we got packet that looks like this:144144+ * iphdr|icmphdr|inner_iphdr|l4header (tcp, udp, ..).145145+ *146146+ * Above nf_conntrack_find_get() makes lookup based on inner_hdr,147147+ * so we should expect that destination of the found connection148148+ * matches outer header destination address.149149+ *150150+ * In above example, we can consider these two cases:151151+ * 1. Error coming in reply direction from B or M (middle box) to152152+ * T (SNAT case) or A.153153+ * Inner saddr will be B, dst will be T or A.154154+ * The found conntrack will be reply tuple (B->T/A).155155+ * 2. Error coming in original direction from A or M to B.156156+ * Inner saddr will be A, inner daddr will be B.157157+ * The found conntrack will be original tuple (A->B).158158+ *159159+ * In both cases, conntrack[dir].dst == inner.dst.160160+ *161161+ * A bogus packet could look like this:162162+ * Inner: B->T163163+ * Outer: B->X (other machine reachable by T).164164+ *165165+ * In this case, lookup yields connection A->B and will166166+ * set packet from B->X as *RELATED*, even though no connection167167+ * from X was ever seen.168168+ */169169+ ct = nf_ct_tuplehash_to_ctrack(h);170170+ dir = NF_CT_DIRECTION(h);171171+ ct_daddr = &ct->tuplehash[dir].tuple.dst.u3;172172+ if (!nf_inet_addr_cmp(outer_daddr, ct_daddr)) {173173+ if (state->pf == AF_INET) {174174+ nf_l4proto_log_invalid(skb, state->net, state->pf,175175+ l4proto,176176+ "outer daddr %pI4 != inner %pI4",177177+ &outer_daddr->ip, &ct_daddr->ip);178178+ } else if (state->pf == AF_INET6) {179179+ nf_l4proto_log_invalid(skb, state->net, state->pf,180180+ l4proto,181181+ "outer daddr %pI6 != inner %pI6",182182+ &outer_daddr->ip6, &ct_daddr->ip6);183183+ }184184+ nf_ct_put(ct);133185 return -NF_ACCEPT;134186 }135187136188 ctinfo = IP_CT_RELATED;137137-138138- h = nf_conntrack_find_get(state->net, zone, &innertuple);139139- if (!h) {140140- pr_debug("icmp_error_message: no match\n");141141- return -NF_ACCEPT;142142- }143143-144144- if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)189189+ if (dir == IP_CT_DIR_REPLY)145190 ctinfo += IP_CT_IS_REPLY;146191147192 /* Update skb to refer to this connection */148148- nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo);193193+ nf_ct_set(skb, ct, ctinfo);149194 return NF_ACCEPT;150195}151196···207162 struct sk_buff *skb, unsigned int dataoff,208163 const struct nf_hook_state *state)209164{165165+ union nf_inet_addr outer_daddr;210166 const struct icmphdr *icmph;211167 struct icmphdr _ih;212168213169 /* Not enough header? */214214- icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih);170170+ icmph = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih);215171 if (icmph == NULL) {216172 icmp_error_log(skb, state, "short packet");217173 return -NF_ACCEPT;···245199 icmph->type != ICMP_REDIRECT)246200 return NF_ACCEPT;247201248248- return icmp_error_message(tmpl, skb, state);202202+ memset(&outer_daddr, 0, sizeof(outer_daddr));203203+ outer_daddr.ip = ip_hdr(skb)->daddr;204204+205205+ dataoff += sizeof(*icmph);206206+ return nf_conntrack_inet_error(tmpl, skb, dataoff, state,207207+ IPPROTO_ICMP, &outer_daddr);249208}250209251210#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
+6-46
net/netfilter/nf_conntrack_proto_icmpv6.c
···123123 return NF_ACCEPT;124124}125125126126-static int127127-icmpv6_error_message(struct net *net, struct nf_conn *tmpl,128128- struct sk_buff *skb,129129- unsigned int icmp6off)130130-{131131- struct nf_conntrack_tuple intuple, origtuple;132132- const struct nf_conntrack_tuple_hash *h;133133- enum ip_conntrack_info ctinfo;134134- struct nf_conntrack_zone tmp;135135-136136- WARN_ON(skb_nfct(skb));137137-138138- /* Are they talking about one of our connections? */139139- if (!nf_ct_get_tuplepr(skb,140140- skb_network_offset(skb)141141- + sizeof(struct ipv6hdr)142142- + sizeof(struct icmp6hdr),143143- PF_INET6, net, &origtuple)) {144144- pr_debug("icmpv6_error: Can't get tuple\n");145145- return -NF_ACCEPT;146146- }147147-148148- /* Ordinarily, we'd expect the inverted tupleproto, but it's149149- been preserved inside the ICMP. */150150- if (!nf_ct_invert_tuple(&intuple, &origtuple)) {151151- pr_debug("icmpv6_error: Can't invert tuple\n");152152- return -NF_ACCEPT;153153- }154154-155155- ctinfo = IP_CT_RELATED;156156-157157- h = nf_conntrack_find_get(net, nf_ct_zone_tmpl(tmpl, skb, &tmp),158158- &intuple);159159- if (!h) {160160- pr_debug("icmpv6_error: no match\n");161161- return -NF_ACCEPT;162162- } else {163163- if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)164164- ctinfo += IP_CT_IS_REPLY;165165- }166166-167167- /* Update skb to refer to this connection */168168- nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo);169169- return NF_ACCEPT;170170-}171126172127static void icmpv6_error_log(const struct sk_buff *skb,173128 const struct nf_hook_state *state,···137182 unsigned int dataoff,138183 const struct nf_hook_state *state)139184{185185+ union nf_inet_addr outer_daddr;140186 const struct icmp6hdr *icmp6h;141187 struct icmp6hdr _ih;142188 int type;···166210 if (icmp6h->icmp6_type >= 128)167211 return NF_ACCEPT;168212169169- return icmpv6_error_message(state->net, tmpl, skb, dataoff);213213+ memcpy(&outer_daddr.ip6, &ipv6_hdr(skb)->daddr,214214+ sizeof(outer_daddr.ip6));215215+ dataoff += sizeof(*icmp6h);216216+ return nf_conntrack_inet_error(tmpl, skb, dataoff, state,217217+ IPPROTO_ICMPV6, &outer_daddr);170218}171219172220#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
+8-3
net/netfilter/nf_nat_core.c
···415415 case IPPROTO_ICMPV6:416416 /* id is same for either direction... */417417 keyptr = &tuple->src.u.icmp.id;418418- min = range->min_proto.icmp.id;419419- range_size = ntohs(range->max_proto.icmp.id) -420420- ntohs(range->min_proto.icmp.id) + 1;418418+ if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) {419419+ min = 0;420420+ range_size = 65536;421421+ } else {422422+ min = ntohs(range->min_proto.icmp.id);423423+ range_size = ntohs(range->max_proto.icmp.id) -424424+ ntohs(range->min_proto.icmp.id) + 1;425425+ }421426 goto find_free_id;422427#if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE)423428 case IPPROTO_GRE:
+1-1
net/netfilter/nf_tables_api.c
···15441544 if (IS_ERR(type))15451545 return PTR_ERR(type);15461546 }15471547- if (!(type->hook_mask & (1 << hook->num)))15471547+ if (hook->num > NF_MAX_HOOKS || !(type->hook_mask & (1 << hook->num)))15481548 return -EOPNOTSUPP;1549154915501550 if (type->type == NFT_CHAIN_T_NAT &&
···582582 if (nfqnl_put_bridge(entry, skb) < 0)583583 goto nla_put_failure;584584585585- if (entskb->tstamp) {585585+ if (entry->state.hook <= NF_INET_FORWARD && entskb->tstamp) {586586 struct nfqnl_msg_packet_timestamp ts;587587 struct timespec64 kts = ktime_to_timespec64(entskb->tstamp);588588
+14-9
net/netfilter/xt_time.c
···163163 s64 stamp;164164165165 /*166166- * We cannot use get_seconds() instead of __net_timestamp() here.166166+ * We need real time here, but we can neither use skb->tstamp167167+ * nor __net_timestamp().168168+ *169169+ * skb->tstamp and skb->skb_mstamp_ns overlap, however, they170170+ * use different clock types (real vs monotonic).171171+ *167172 * Suppose you have two rules:168168- * 1. match before 13:00169169- * 2. match after 13:00173173+ * 1. match before 13:00174174+ * 2. match after 13:00175175+ *170176 * If you match against processing time (get_seconds) it171177 * may happen that the same packet matches both rules if172172- * it arrived at the right moment before 13:00.178178+ * it arrived at the right moment before 13:00, so it would be179179+ * better to check skb->tstamp and set it via __net_timestamp()180180+ * if needed. This however breaks outgoing packets tx timestamp,181181+ * and causes them to get delayed forever by fq packet scheduler.173182 */174174- if (skb->tstamp == 0)175175- __net_timestamp((struct sk_buff *)skb);176176-177177- stamp = ktime_to_ns(skb->tstamp);178178- stamp = div_s64(stamp, NSEC_PER_SEC);183183+ stamp = get_seconds();179184180185 if (info->flags & XT_TIME_LOCAL_TZ)181186 /* Adjust for local timezone */
+11
net/rds/ib_fmr.c
···4444 else4545 pool = rds_ibdev->mr_1m_pool;46464747+ if (atomic_read(&pool->dirty_count) >= pool->max_items / 10)4848+ queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10);4949+5050+ /* Switch pools if one of the pool is reaching upper limit */5151+ if (atomic_read(&pool->dirty_count) >= pool->max_items * 9 / 10) {5252+ if (pool->pool_type == RDS_IB_MR_8K_POOL)5353+ pool = rds_ibdev->mr_1m_pool;5454+ else5555+ pool = rds_ibdev->mr_8k_pool;5656+ }5757+4758 ibmr = rds_ib_try_reuse_ibmr(pool);4859 if (ibmr)4960 return ibmr;
-3
net/rds/ib_rdma.c
···454454 struct rds_ib_mr *ibmr = NULL;455455 int iter = 0;456456457457- if (atomic_read(&pool->dirty_count) >= pool->max_items_soft / 10)458458- queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10);459459-460457 while (1) {461458 ibmr = rds_ib_reuse_mr(pool);462459 if (ibmr)
···11611161 * handle data received on the local endpoint11621162 * - may be called in interrupt context11631163 *11641164- * The socket is locked by the caller and this prevents the socket from being11651165- * shut down and the local endpoint from going away, thus sk_user_data will not11661166- * be cleared until this function returns.11641164+ * [!] Note that as this is called from the encap_rcv hook, the socket is not11651165+ * held locked by the caller and nothing prevents sk_user_data on the UDP from11661166+ * being cleared in the middle of processing this function.11671167 *11681168 * Called with the RCU read lock held from the IP layer via UDP.11691169 */11701170int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)11711171{11721172+ struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk);11721173 struct rxrpc_connection *conn;11731174 struct rxrpc_channel *chan;11741175 struct rxrpc_call *call = NULL;11751176 struct rxrpc_skb_priv *sp;11761176- struct rxrpc_local *local = udp_sk->sk_user_data;11771177 struct rxrpc_peer *peer = NULL;11781178 struct rxrpc_sock *rx = NULL;11791179 unsigned int channel;···1181118111821182 _enter("%p", udp_sk);1183118311841184+ if (unlikely(!local)) {11851185+ kfree_skb(skb);11861186+ return 0;11871187+ }11841188 if (skb->tstamp == 0)11851189 skb->tstamp = ktime_get_real();11861190
+2-1
net/rxrpc/local_object.c
···304304 ret = -ENOMEM;305305sock_error:306306 mutex_unlock(&rxnet->local_mutex);307307- kfree(local);307307+ if (local)308308+ call_rcu(&local->rcu, rxrpc_local_rcu);308309 _leave(" = %d", ret);309310 return ERR_PTR(ret);310311
···560560 devcg->behavior == DEVCG_DEFAULT_ALLOW) {561561 rc = dev_exception_add(devcg, ex);562562 if (rc)563563- break;563563+ return rc;564564 } else {565565 /*566566 * in the other possible cases:
+10-2
sound/core/info.c
···713713 INIT_LIST_HEAD(&entry->list);714714 entry->parent = parent;715715 entry->module = module;716716- if (parent)716716+ if (parent) {717717+ mutex_lock(&parent->access);717718 list_add_tail(&entry->list, &parent->children);719719+ mutex_unlock(&parent->access);720720+ }718721 return entry;719722}720723···795792 list_for_each_entry_safe(p, n, &entry->children, list)796793 snd_info_free_entry(p);797794798798- list_del(&entry->list);795795+ p = entry->parent;796796+ if (p) {797797+ mutex_lock(&p->access);798798+ list_del(&entry->list);799799+ mutex_unlock(&p->access);800800+ }799801 kfree(entry->name);800802 if (entry->private_free)801803 entry->private_free(entry);
+9-9
sound/core/init.c
···382382 card->shutdown = 1;383383 spin_unlock(&card->files_lock);384384385385- /* phase 1: disable fops (user space) operations for ALSA API */386386- mutex_lock(&snd_card_mutex);387387- snd_cards[card->number] = NULL;388388- clear_bit(card->number, snd_cards_lock);389389- mutex_unlock(&snd_card_mutex);390390-391391- /* phase 2: replace file->f_op with special dummy operations */392392-385385+ /* replace file->f_op with special dummy operations */393386 spin_lock(&card->files_lock);394387 list_for_each_entry(mfile, &card->files_list, list) {395388 /* it's critical part, use endless loop */···398405 }399406 spin_unlock(&card->files_lock); 400407401401- /* phase 3: notify all connected devices about disconnection */408408+ /* notify all connected devices about disconnection */402409 /* at this point, they cannot respond to any calls except release() */403410404411#if IS_ENABLED(CONFIG_SND_MIXER_OSS)···414421 device_del(&card->card_dev);415422 card->registered = false;416423 }424424+425425+ /* disable fops (user space) operations for ALSA API */426426+ mutex_lock(&snd_card_mutex);427427+ snd_cards[card->number] = NULL;428428+ clear_bit(card->number, snd_cards_lock);429429+ mutex_unlock(&snd_card_mutex);430430+417431#ifdef CONFIG_PM418432 wake_up(&card->power_sleep);419433#endif
+1
sound/pci/hda/hda_codec.c
···969969970970 /* power-up all before initialization */971971 hda_set_power_state(codec, AC_PWRST_D0);972972+ codec->core.dev.power.power_state = PMSG_ON;972973973974 snd_hda_codec_proc_new(codec);974975
···331331 'return_id,'332332 'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,'333333 'parent_call_path_id,'334334- 'parent_id'334334+ 'calls.parent_id'335335 ' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')336336337337do_query(query, 'CREATE VIEW samples_view AS '
···18681868{18691869 struct perf_evlist *evlist = arg;18701870 bool draining = false;18711871- int i;18711871+ int i, done = 0;1872187218731873- while (draining || !(evlist->thread.done)) {18741874- if (draining)18751875- draining = false;18761876- else if (evlist->thread.done)18731873+ while (!done) {18741874+ bool got_data = false;18751875+18761876+ if (evlist->thread.done)18771877 draining = true;1878187818791879 if (!draining)···18941894 pr_warning("cannot locate proper evsel for the side band event\n");1895189518961896 perf_mmap__consume(map);18971897+ got_data = true;18971898 }18981899 perf_mmap__read_done(map);18991900 }19011901+19021902+ if (draining && !got_data)19031903+ break;19001904 }19011905 return NULL;19021906}
···26062606 perf_env__insert_bpf_prog_info(env, info_node);26072607 }2608260826092609+ up_write(&env->bpf_progs.lock);26092610 return 0;26102611out:26112612 free(info_linear);···26242623static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)26252624{26262625 struct perf_env *env = &ff->ph->env;26262626+ struct btf_node *node = NULL;26272627 u32 count, i;26282628+ int err = -1;2628262926292630 if (ff->ph->needs_swap) {26302631 pr_warning("interpreting btf from systems with endianity is not yet supported\n");···26392636 down_write(&env->bpf_progs.lock);2640263726412638 for (i = 0; i < count; ++i) {26422642- struct btf_node *node;26432639 u32 id, data_size;2644264026452641 if (do_read_u32(ff, &id))26462646- return -1;26422642+ goto out;26472643 if (do_read_u32(ff, &data_size))26482648- return -1;26442644+ goto out;2649264526502646 node = malloc(sizeof(struct btf_node) + data_size);26512647 if (!node)26522652- return -1;26482648+ goto out;2653264926542650 node->id = id;26552651 node->data_size = data_size;2656265226572657- if (__do_read(ff, node->data, data_size)) {26582658- free(node);26592659- return -1;26602660- }26532653+ if (__do_read(ff, node->data, data_size))26542654+ goto out;2661265526622656 perf_env__insert_btf(env, node);26572657+ node = NULL;26632658 }2664265926602660+ err = 0;26612661+out:26652662 up_write(&env->bpf_progs.lock);26662666- return 0;26632663+ free(node);26642664+ return err;26672665}2668266626692667struct feature_ops {
+17-3
tools/perf/util/map.c
···261261 return kmap && kmap->name[0];262262}263263264264+bool __map__is_bpf_prog(const struct map *map)265265+{266266+ const char *name;267267+268268+ if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO)269269+ return true;270270+271271+ /*272272+ * If PERF_RECORD_BPF_EVENT is not included, the dso will not have273273+ * type of DSO_BINARY_TYPE__BPF_PROG_INFO. In such cases, we can274274+ * guess the type based on name.275275+ */276276+ name = map->dso->short_name;277277+ return name && (strstr(name, "bpf_prog_") == name);278278+}279279+264280bool map__has_symbols(const struct map *map)265281{266282 return dso__has_symbols(map->dso);···926910 rc = strcmp(m->dso->short_name, map->dso->short_name);927911 if (rc < 0)928912 p = &(*p)->rb_left;929929- else if (rc > 0)930930- p = &(*p)->rb_right;931913 else932932- return;914914+ p = &(*p)->rb_right;933915 }934916 rb_link_node(&map->rb_node_name, parent, p);935917 rb_insert_color(&map->rb_node_name, &maps->names);
···11+#!/bin/bash22+#33+# check that ICMP df-needed/pkttoobig icmp are set are set as related44+# state55+#66+# Setup is:77+#88+# nsclient1 -> nsrouter1 -> nsrouter2 -> nsclient299+# MTU 1500, except for nsrouter2 <-> nsclient2 link (1280).1010+# ping nsclient2 from nsclient1, checking that conntrack did set RELATED1111+# 'fragmentation needed' icmp packet.1212+#1313+# In addition, nsrouter1 will perform IP masquerading, i.e. also1414+# check the icmp errors are propagated to the correct host as per1515+# nat of "established" icmp-echo "connection".1616+1717+# Kselftest framework requirement - SKIP code is 4.1818+ksft_skip=41919+ret=02020+2121+nft --version > /dev/null 2>&12222+if [ $? -ne 0 ];then2323+ echo "SKIP: Could not run test without nft tool"2424+ exit $ksft_skip2525+fi2626+2727+ip -Version > /dev/null 2>&12828+if [ $? -ne 0 ];then2929+ echo "SKIP: Could not run test without ip tool"3030+ exit $ksft_skip3131+fi3232+3333+cleanup() {3434+ for i in 1 2;do ip netns del nsclient$i;done3535+ for i in 1 2;do ip netns del nsrouter$i;done3636+}3737+3838+ipv4() {3939+ echo -n 192.168.$1.24040+}4141+4242+ipv6 () {4343+ echo -n dead:$1::24444+}4545+4646+check_counter()4747+{4848+ ns=$14949+ name=$25050+ expect=$35151+ local lret=05252+5353+ cnt=$(ip netns exec $ns nft list counter inet filter "$name" | grep -q "$expect")5454+ if [ $? -ne 0 ]; then5555+ echo "ERROR: counter $name in $ns has unexpected value (expected $expect)" 1>&25656+ ip netns exec $ns nft list counter inet filter "$name" 1>&25757+ lret=15858+ fi5959+6060+ return $lret6161+}6262+6363+check_unknown()6464+{6565+ expect="packets 0 bytes 0"6666+ for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do6767+ check_counter $n "unknown" "$expect"6868+ if [ $? -ne 0 ] ;then6969+ return 17070+ fi7171+ done7272+7373+ return 07474+}7575+7676+for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do7777+ ip netns add $n7878+ ip -net $n link set lo up7979+done8080+8181+DEV=veth08282+ip link add $DEV netns nsclient1 type veth peer name eth1 netns nsrouter18383+DEV=veth08484+ip link add $DEV netns nsclient2 type veth peer name eth1 netns nsrouter28585+8686+DEV=veth08787+ip link add $DEV netns nsrouter1 type veth peer name eth2 netns nsrouter28888+8989+DEV=veth09090+for i in 1 2; do9191+ ip -net nsclient$i link set $DEV up9292+ ip -net nsclient$i addr add $(ipv4 $i)/24 dev $DEV9393+ ip -net nsclient$i addr add $(ipv6 $i)/64 dev $DEV9494+done9595+9696+ip -net nsrouter1 link set eth1 up9797+ip -net nsrouter1 link set veth0 up9898+9999+ip -net nsrouter2 link set eth1 up100100+ip -net nsrouter2 link set eth2 up101101+102102+ip -net nsclient1 route add default via 192.168.1.1103103+ip -net nsclient1 -6 route add default via dead:1::1104104+105105+ip -net nsclient2 route add default via 192.168.2.1106106+ip -net nsclient2 route add default via dead:2::1107107+108108+i=3109109+ip -net nsrouter1 addr add 192.168.1.1/24 dev eth1110110+ip -net nsrouter1 addr add 192.168.3.1/24 dev veth0111111+ip -net nsrouter1 addr add dead:1::1/64 dev eth1112112+ip -net nsrouter1 addr add dead:3::1/64 dev veth0113113+ip -net nsrouter1 route add default via 192.168.3.10114114+ip -net nsrouter1 -6 route add default via dead:3::10115115+116116+ip -net nsrouter2 addr add 192.168.2.1/24 dev eth1117117+ip -net nsrouter2 addr add 192.168.3.10/24 dev eth2118118+ip -net nsrouter2 addr add dead:2::1/64 dev eth1119119+ip -net nsrouter2 addr add dead:3::10/64 dev eth2120120+ip -net nsrouter2 route add default via 192.168.3.1121121+ip -net nsrouter2 route add default via dead:3::1122122+123123+sleep 2124124+for i in 4 6; do125125+ ip netns exec nsrouter1 sysctl -q net.ipv$i.conf.all.forwarding=1126126+ ip netns exec nsrouter2 sysctl -q net.ipv$i.conf.all.forwarding=1127127+done128128+129129+for netns in nsrouter1 nsrouter2; do130130+ip netns exec $netns nft -f - <<EOF131131+table inet filter {132132+ counter unknown { }133133+ counter related { }134134+ chain forward {135135+ type filter hook forward priority 0; policy accept;136136+ meta l4proto icmpv6 icmpv6 type "packet-too-big" ct state "related" counter name "related" accept137137+ meta l4proto icmp icmp type "destination-unreachable" ct state "related" counter name "related" accept138138+ meta l4proto { icmp, icmpv6 } ct state new,established accept139139+ counter name "unknown" drop140140+ }141141+}142142+EOF143143+done144144+145145+ip netns exec nsclient1 nft -f - <<EOF146146+table inet filter {147147+ counter unknown { }148148+ counter related { }149149+ chain input {150150+ type filter hook input priority 0; policy accept;151151+ meta l4proto { icmp, icmpv6 } ct state established,untracked accept152152+153153+ meta l4proto { icmp, icmpv6 } ct state "related" counter name "related" accept154154+ counter name "unknown" drop155155+ }156156+}157157+EOF158158+159159+ip netns exec nsclient2 nft -f - <<EOF160160+table inet filter {161161+ counter unknown { }162162+ counter new { }163163+ counter established { }164164+165165+ chain input {166166+ type filter hook input priority 0; policy accept;167167+ meta l4proto { icmp, icmpv6 } ct state established,untracked accept168168+169169+ meta l4proto { icmp, icmpv6 } ct state "new" counter name "new" accept170170+ meta l4proto { icmp, icmpv6 } ct state "established" counter name "established" accept171171+ counter name "unknown" drop172172+ }173173+ chain output {174174+ type filter hook output priority 0; policy accept;175175+ meta l4proto { icmp, icmpv6 } ct state established,untracked accept176176+177177+ meta l4proto { icmp, icmpv6 } ct state "new" counter name "new"178178+ meta l4proto { icmp, icmpv6 } ct state "established" counter name "established"179179+ counter name "unknown" drop180180+ }181181+}182182+EOF183183+184184+185185+# make sure NAT core rewrites adress of icmp error if nat is used according to186186+# conntrack nat information (icmp error will be directed at nsrouter1 address,187187+# but it needs to be routed to nsclient1 address).188188+ip netns exec nsrouter1 nft -f - <<EOF189189+table ip nat {190190+ chain postrouting {191191+ type nat hook postrouting priority 0; policy accept;192192+ ip protocol icmp oifname "veth0" counter masquerade193193+ }194194+}195195+table ip6 nat {196196+ chain postrouting {197197+ type nat hook postrouting priority 0; policy accept;198198+ ip6 nexthdr icmpv6 oifname "veth0" counter masquerade199199+ }200200+}201201+EOF202202+203203+ip netns exec nsrouter2 ip link set eth1 mtu 1280204204+ip netns exec nsclient2 ip link set veth0 mtu 1280205205+sleep 1206206+207207+ip netns exec nsclient1 ping -c 1 -s 1000 -q -M do 192.168.2.2 >/dev/null208208+if [ $? -ne 0 ]; then209209+ echo "ERROR: netns ip routing/connectivity broken" 1>&2210210+ cleanup211211+ exit 1212212+fi213213+ip netns exec nsclient1 ping6 -q -c 1 -s 1000 dead:2::2 >/dev/null214214+if [ $? -ne 0 ]; then215215+ echo "ERROR: netns ipv6 routing/connectivity broken" 1>&2216216+ cleanup217217+ exit 1218218+fi219219+220220+check_unknown221221+if [ $? -ne 0 ]; then222222+ ret=1223223+fi224224+225225+expect="packets 0 bytes 0"226226+for netns in nsrouter1 nsrouter2 nsclient1;do227227+ check_counter "$netns" "related" "$expect"228228+ if [ $? -ne 0 ]; then229229+ ret=1230230+ fi231231+done232232+233233+expect="packets 2 bytes 2076"234234+check_counter nsclient2 "new" "$expect"235235+if [ $? -ne 0 ]; then236236+ ret=1237237+fi238238+239239+ip netns exec nsclient1 ping -q -c 1 -s 1300 -M do 192.168.2.2 > /dev/null240240+if [ $? -eq 0 ]; then241241+ echo "ERROR: ping should have failed with PMTU too big error" 1>&2242242+ ret=1243243+fi244244+245245+# nsrouter2 should have generated the icmp error, so246246+# related counter should be 0 (its in forward).247247+expect="packets 0 bytes 0"248248+check_counter "nsrouter2" "related" "$expect"249249+if [ $? -ne 0 ]; then250250+ ret=1251251+fi252252+253253+# but nsrouter1 should have seen it, same for nsclient1.254254+expect="packets 1 bytes 576"255255+for netns in nsrouter1 nsclient1;do256256+ check_counter "$netns" "related" "$expect"257257+ if [ $? -ne 0 ]; then258258+ ret=1259259+ fi260260+done261261+262262+ip netns exec nsclient1 ping6 -c 1 -s 1300 dead:2::2 > /dev/null263263+if [ $? -eq 0 ]; then264264+ echo "ERROR: ping6 should have failed with PMTU too big error" 1>&2265265+ ret=1266266+fi267267+268268+expect="packets 2 bytes 1856"269269+for netns in nsrouter1 nsclient1;do270270+ check_counter "$netns" "related" "$expect"271271+ if [ $? -ne 0 ]; then272272+ ret=1273273+ fi274274+done275275+276276+if [ $ret -eq 0 ];then277277+ echo "PASS: icmp mtu error had RELATED state"278278+else279279+ echo "ERROR: icmp error RELATED state test has failed"280280+fi281281+282282+cleanup283283+exit $ret
+53-3
tools/testing/selftests/netfilter/nft_nat.sh
···347347test_masquerade6()348348{349349 local family=$1350350+ local natflags=$1350351 local lret=0351352352353 ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null···381380table $family nat {382381 chain postrouting {383382 type nat hook postrouting priority 0; policy accept;384384- meta oif veth0 masquerade383383+ meta oif veth0 masquerade $natflags385384 }386385}387386EOF···392391393392 ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1394393 if [ $? -ne 0 ] ; then394394+<<<<<<< HEAD395395 echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading"396396+=======397397+ echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags"398398+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1396399 lret=1397400 fi398401···433428 fi434429 done435430431431+<<<<<<< HEAD436432 ip netns exec ns0 nft flush chain $family nat postrouting433433+=======434434+ ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1435435+ if [ $? -ne 0 ] ; then436436+ echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)"437437+ lret=1438438+ fi439439+440440+ ip netns exec ns0 nft flush chain ip6 nat postrouting441441+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1437442 if [ $? -ne 0 ]; then438443 echo "ERROR: Could not flush $family nat postrouting" 1>&2439444 lret=1440445 fi441446447447+<<<<<<< HEAD442448 test $lret -eq 0 && echo "PASS: $family IPv6 masquerade for ns2"449449+=======450450+ test $lret -eq 0 && echo "PASS: IPv6 masquerade $natflags for ns2"451451+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1443452444453 return $lret445454}446455447456test_masquerade()448457{458458+<<<<<<< HEAD449459 local family=$1460460+=======461461+ local natflags=$1462462+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1450463 local lret=0451464452465 ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null···472449473450 ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1474451 if [ $? -ne 0 ] ; then475475- echo "ERROR: canot ping ns1 from ns2"452452+ echo "ERROR: cannot ping ns1 from ns2 $natflags"476453 lret=1477454 fi478455···498475table $family nat {499476 chain postrouting {500477 type nat hook postrouting priority 0; policy accept;501501- meta oif veth0 masquerade478478+ meta oif veth0 masquerade $natflags502479 }503480}504481EOF···509486510487 ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1511488 if [ $? -ne 0 ] ; then489489+<<<<<<< HEAD512490 echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading"491491+=======492492+ echo "ERROR: cannot ping ns1 from ns2 with active ip masquere $natflags"493493+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1513494 lret=1514495 fi515496···549522 fi550523 done551524525525+<<<<<<< HEAD552526 ip netns exec ns0 nft flush chain $family nat postrouting527527+=======528528+ ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1529529+ if [ $? -ne 0 ] ; then530530+ echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)"531531+ lret=1532532+ fi533533+534534+ ip netns exec ns0 nft flush chain ip nat postrouting535535+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1553536 if [ $? -ne 0 ]; then554537 echo "ERROR: Could not flush $family nat postrouting" 1>&2555538 lret=1556539 fi557540541541+<<<<<<< HEAD558542 test $lret -eq 0 && echo "PASS: $family IP masquerade for ns2"543543+=======544544+ test $lret -eq 0 && echo "PASS: IP masquerade $natflags for ns2"545545+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1559546560547 return $lret561548}···843802$test_inet_nat && test_local_dnat6 inet844803845804reset_counters805805+<<<<<<< HEAD846806test_masquerade ip847807test_masquerade6 ip6848808reset_counters849809$test_inet_nat && test_masquerade inet850810$test_inet_nat && test_masquerade6 inet811811+=======812812+test_masquerade ""813813+test_masquerade6 ""814814+815815+reset_counters816816+test_masquerade "fully-random"817817+test_masquerade6 "fully-random"818818+>>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1851819852820reset_counters853821test_redirect ip