Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Two easy cases of overlapping changes.

Signed-off-by: David S. Miller <davem@davemloft.net>

+1884 -718
+2
Documentation/devicetree/bindings/net/davinci_emac.txt
··· 20 20 Optional properties: 21 21 - phy-handle: See ethernet.txt file in the same directory. 22 22 If absent, davinci_emac driver defaults to 100/FULL. 23 + - nvmem-cells: phandle, reference to an nvmem node for the MAC address 24 + - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used 23 25 - ti,davinci-rmii-en: 1 byte, 1 means use RMII 24 26 - ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM? 25 27
+2 -3
Documentation/devicetree/bindings/net/ethernet.txt
··· 10 10 the boot program; should be used in cases where the MAC address assigned to 11 11 the device by the boot program is different from the "local-mac-address" 12 12 property; 13 - - nvmem-cells: phandle, reference to an nvmem node for the MAC address; 14 - - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used; 15 13 - max-speed: number, specifies maximum speed in Mbit/s supported by the device; 16 14 - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than 17 15 the maximum frame size (there's contradiction in the Devicetree 18 16 Specification). 19 17 - phy-mode: string, operation mode of the PHY interface. This is now a de-facto 20 18 standard property; supported values are: 21 - * "internal" 19 + * "internal" (Internal means there is not a standard bus between the MAC and 20 + the PHY, something proprietary is being used to embed the PHY in the MAC.) 22 21 * "mii" 23 22 * "gmii" 24 23 * "sgmii"
+4
Documentation/devicetree/bindings/net/macb.txt
··· 26 26 Optional elements: 'tsu_clk' 27 27 - clocks: Phandles to input clocks. 28 28 29 + Optional properties: 30 + - nvmem-cells: phandle, reference to an nvmem node for the MAC address 31 + - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used 32 + 29 33 Optional properties for PHY child node: 30 34 - reset-gpios : Should specify the gpio for phy reset 31 35 - magic-packet : If present, indicates that the hardware supports waking
+2 -2
Documentation/media/uapi/rc/rc-tables.rst
··· 623 623 624 624 - .. row 78 625 625 626 - - ``KEY_SCREEN`` 626 + - ``KEY_ASPECT_RATIO`` 627 627 628 628 - Select screen aspect ratio 629 629 ··· 631 631 632 632 - .. row 79 633 633 634 - - ``KEY_ZOOM`` 634 + - ``KEY_FULL_SCREEN`` 635 635 636 636 - Put device into zoom/full screen mode 637 637
-2
Documentation/networking/decnet.txt
··· 22 22 CONFIG_DECNET_ROUTER (to be able to add/delete routes) 23 23 CONFIG_NETFILTER (will be required for the DECnet routing daemon) 24 24 25 - CONFIG_DECNET_ROUTE_FWMARK is optional 26 - 27 25 Don't turn on SIOCGIFCONF support for DECnet unless you are really sure 28 26 that you need it, in general you won't and it can cause ifconfig to 29 27 malfunction.
+1
Documentation/networking/ip-sysctl.txt
··· 427 427 minimum RTT when it is moved to a longer path (e.g., due to traffic 428 428 engineering). A longer window makes the filter more resistant to RTT 429 429 inflations such as transient congestion. The unit is seconds. 430 + Possible values: 0 - 86400 (1 day) 430 431 Default: 300 431 432 432 433 tcp_moderate_rcvbuf - BOOLEAN
+2 -1
MAINTAINERS
··· 3124 3124 BROADCOM BMIPS MIPS ARCHITECTURE 3125 3125 M: Kevin Cernekee <cernekee@gmail.com> 3126 3126 M: Florian Fainelli <f.fainelli@gmail.com> 3127 + L: bcm-kernel-feedback-list@broadcom.com 3127 3128 L: linux-mips@vger.kernel.org 3128 3129 T: git git://github.com/broadcom/stblinux.git 3129 3130 S: Maintained ··· 7337 7336 F: Documentation/driver-api/i3c 7338 7337 F: drivers/i3c/ 7339 7338 F: include/linux/i3c/ 7340 - F: include/dt-bindings/i3c/ 7341 7339 7342 7340 I3C DRIVER FOR SYNOPSYS DESIGNWARE 7343 7341 M: Vitor Soares <vitor.soares@synopsys.com> ··· 8711 8711 LED SUBSYSTEM 8712 8712 M: Jacek Anaszewski <jacek.anaszewski@gmail.com> 8713 8713 M: Pavel Machek <pavel@ucw.cz> 8714 + R: Dan Murphy <dmurphy@ti.com> 8714 8715 L: linux-leds@vger.kernel.org 8715 8716 T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git 8716 8717 S: Maintained
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 1 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc6 6 6 NAME = Shy Crocodile 7 7 8 8 # *DOCUMENTATION*
+4
arch/alpha/kernel/syscalls/syscall.tbl
··· 463 463 532 common getppid sys_getppid 464 464 # all other architectures have common numbers for new syscall, alpha 465 465 # is the exception. 466 + 534 common pidfd_send_signal sys_pidfd_send_signal 467 + 535 common io_uring_setup sys_io_uring_setup 468 + 536 common io_uring_enter sys_io_uring_enter 469 + 537 common io_uring_register sys_io_uring_register
+4
arch/arm/tools/syscall.tbl
··· 437 437 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait 438 438 422 common futex_time64 sys_futex 439 439 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval 440 + 424 common pidfd_send_signal sys_pidfd_send_signal 441 + 425 common io_uring_setup sys_io_uring_setup 442 + 426 common io_uring_enter sys_io_uring_enter 443 + 427 common io_uring_register sys_io_uring_register
+1 -1
arch/arm64/include/asm/futex.h
··· 50 50 static inline int 51 51 arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) 52 52 { 53 - int oldval, ret, tmp; 53 + int oldval = 0, ret, tmp; 54 54 u32 __user *uaddr = __uaccess_mask_ptr(_uaddr); 55 55 56 56 pagefault_disable();
+1 -1
arch/arm64/include/asm/unistd.h
··· 44 44 #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) 45 45 #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) 46 46 47 - #define __NR_compat_syscalls 424 47 + #define __NR_compat_syscalls 428 48 48 #endif 49 49 50 50 #define __ARCH_WANT_SYS_CLONE
+8
arch/arm64/include/asm/unistd32.h
··· 866 866 __SYSCALL(__NR_futex_time64, sys_futex) 867 867 #define __NR_sched_rr_get_interval_time64 423 868 868 __SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) 869 + #define __NR_pidfd_send_signal 424 870 + __SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal) 871 + #define __NR_io_uring_setup 425 872 + __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) 873 + #define __NR_io_uring_enter 426 874 + __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter) 875 + #define __NR_io_uring_register 427 876 + __SYSCALL(__NR_io_uring_register, sys_io_uring_register) 869 877 870 878 /* 871 879 * Please add new compat syscalls above this comment and update
+4
arch/ia64/kernel/syscalls/syscall.tbl
··· 344 344 332 common pkey_free sys_pkey_free 345 345 333 common rseq sys_rseq 346 346 # 334 through 423 are reserved to sync up with other architectures 347 + 424 common pidfd_send_signal sys_pidfd_send_signal 348 + 425 common io_uring_setup sys_io_uring_setup 349 + 426 common io_uring_enter sys_io_uring_enter 350 + 427 common io_uring_register sys_io_uring_register
+4
arch/m68k/kernel/syscalls/syscall.tbl
··· 423 423 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait 424 424 422 common futex_time64 sys_futex 425 425 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval 426 + 424 common pidfd_send_signal sys_pidfd_send_signal 427 + 425 common io_uring_setup sys_io_uring_setup 428 + 426 common io_uring_enter sys_io_uring_enter 429 + 427 common io_uring_register sys_io_uring_register
+4
arch/microblaze/kernel/syscalls/syscall.tbl
··· 429 429 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait 430 430 422 common futex_time64 sys_futex 431 431 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval 432 + 424 common pidfd_send_signal sys_pidfd_send_signal 433 + 425 common io_uring_setup sys_io_uring_setup 434 + 426 common io_uring_enter sys_io_uring_enter 435 + 427 common io_uring_register sys_io_uring_register
-6
arch/mips/ath79/setup.c
··· 210 210 return ath79_sys_type; 211 211 } 212 212 213 - int get_c0_perfcount_int(void) 214 - { 215 - return ATH79_MISC_IRQ(5); 216 - } 217 - EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 218 - 219 213 unsigned int get_c0_compare_int(void) 220 214 { 221 215 return CP0_LEGACY_COMPARE_IRQ;
+1 -1
arch/mips/kernel/scall64-o32.S
··· 125 125 subu t1, v0, __NR_O32_Linux 126 126 move a1, v0 127 127 bnez t1, 1f /* __NR_syscall at offset 0 */ 128 - lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ 128 + ld a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ 129 129 .set pop 130 130 131 131 1: jal syscall_trace_enter
+4
arch/mips/kernel/syscalls/syscall_n32.tbl
··· 362 362 421 n32 rt_sigtimedwait_time64 compat_sys_rt_sigtimedwait_time64 363 363 422 n32 futex_time64 sys_futex 364 364 423 n32 sched_rr_get_interval_time64 sys_sched_rr_get_interval 365 + 424 n32 pidfd_send_signal sys_pidfd_send_signal 366 + 425 n32 io_uring_setup sys_io_uring_setup 367 + 426 n32 io_uring_enter sys_io_uring_enter 368 + 427 n32 io_uring_register sys_io_uring_register
+4
arch/mips/kernel/syscalls/syscall_n64.tbl
··· 338 338 327 n64 rseq sys_rseq 339 339 328 n64 io_pgetevents sys_io_pgetevents 340 340 # 329 through 423 are reserved to sync up with other architectures 341 + 424 n64 pidfd_send_signal sys_pidfd_send_signal 342 + 425 n64 io_uring_setup sys_io_uring_setup 343 + 426 n64 io_uring_enter sys_io_uring_enter 344 + 427 n64 io_uring_register sys_io_uring_register
+4
arch/mips/kernel/syscalls/syscall_o32.tbl
··· 411 411 421 o32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 412 412 422 o32 futex_time64 sys_futex sys_futex 413 413 423 o32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval 414 + 424 o32 pidfd_send_signal sys_pidfd_send_signal 415 + 425 o32 io_uring_setup sys_io_uring_setup 416 + 426 o32 io_uring_enter sys_io_uring_enter 417 + 427 o32 io_uring_register sys_io_uring_register
+4
arch/parisc/kernel/syscalls/syscall.tbl
··· 420 420 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 421 421 422 32 futex_time64 sys_futex sys_futex 422 422 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval 423 + 424 common pidfd_send_signal sys_pidfd_send_signal 424 + 425 common io_uring_setup sys_io_uring_setup 425 + 426 common io_uring_enter sys_io_uring_enter 426 + 427 common io_uring_register sys_io_uring_register
+4
arch/powerpc/kernel/syscalls/syscall.tbl
··· 505 505 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 506 506 422 32 futex_time64 sys_futex sys_futex 507 507 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval 508 + 424 common pidfd_send_signal sys_pidfd_send_signal 509 + 425 common io_uring_setup sys_io_uring_setup 510 + 426 common io_uring_enter sys_io_uring_enter 511 + 427 common io_uring_register sys_io_uring_register
+1 -1
arch/s390/boot/mem_detect.c
··· 25 25 { 26 26 unsigned long offset = ALIGN(mem_safe_offset(), sizeof(u64)); 27 27 28 - if (IS_ENABLED(BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE && 28 + if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE && 29 29 INITRD_START < offset + ENTRIES_EXTENDED_MAX) 30 30 offset = ALIGN(INITRD_START + INITRD_SIZE, sizeof(u64)); 31 31
+1 -1
arch/s390/kernel/fpu.c
··· 23 23 24 24 if (flags & KERNEL_FPC) 25 25 /* Save floating point control */ 26 - asm volatile("stfpc %0" : "=m" (state->fpc)); 26 + asm volatile("stfpc %0" : "=Q" (state->fpc)); 27 27 28 28 if (!MACHINE_HAS_VX) { 29 29 if (flags & KERNEL_VXR_V0V7) {
+4
arch/s390/kernel/syscalls/syscall.tbl
··· 426 426 421 32 rt_sigtimedwait_time64 - compat_sys_rt_sigtimedwait_time64 427 427 422 32 futex_time64 - sys_futex 428 428 423 32 sched_rr_get_interval_time64 - sys_sched_rr_get_interval 429 + 424 common pidfd_send_signal sys_pidfd_send_signal sys_pidfd_send_signal 430 + 425 common io_uring_setup sys_io_uring_setup sys_io_uring_setup 431 + 426 common io_uring_enter sys_io_uring_enter sys_io_uring_enter 432 + 427 common io_uring_register sys_io_uring_register sys_io_uring_register
+4 -4
arch/s390/kernel/vtime.c
··· 37 37 { 38 38 u64 timer; 39 39 40 - asm volatile("stpt %0" : "=m" (timer)); 40 + asm volatile("stpt %0" : "=Q" (timer)); 41 41 return timer; 42 42 } 43 43 ··· 48 48 asm volatile( 49 49 " stpt %0\n" /* Store current cpu timer value */ 50 50 " spt %1" /* Set new value imm. afterwards */ 51 - : "=m" (timer) : "m" (expires)); 51 + : "=Q" (timer) : "Q" (expires)); 52 52 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer; 53 53 S390_lowcore.last_update_timer = expires; 54 54 } ··· 135 135 #else 136 136 " stck %1" /* Store current tod clock value */ 137 137 #endif 138 - : "=m" (S390_lowcore.last_update_timer), 139 - "=m" (S390_lowcore.last_update_clock)); 138 + : "=Q" (S390_lowcore.last_update_timer), 139 + "=Q" (S390_lowcore.last_update_clock)); 140 140 clock = S390_lowcore.last_update_clock - clock; 141 141 timer -= S390_lowcore.last_update_timer; 142 142
+4
arch/sh/kernel/syscalls/syscall.tbl
··· 426 426 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait 427 427 422 common futex_time64 sys_futex 428 428 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval 429 + 424 common pidfd_send_signal sys_pidfd_send_signal 430 + 425 common io_uring_setup sys_io_uring_setup 431 + 426 common io_uring_enter sys_io_uring_enter 432 + 427 common io_uring_register sys_io_uring_register
+4
arch/sparc/kernel/syscalls/syscall.tbl
··· 469 469 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 470 470 422 32 futex_time64 sys_futex sys_futex 471 471 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval 472 + 424 common pidfd_send_signal sys_pidfd_send_signal 473 + 425 common io_uring_setup sys_io_uring_setup 474 + 426 common io_uring_enter sys_io_uring_enter 475 + 427 common io_uring_register sys_io_uring_register
+1 -1
arch/x86/Kconfig
··· 1499 1499 depends on DEBUG_FS 1500 1500 ---help--- 1501 1501 Expose statistics about the Change Page Attribute mechanims, which 1502 - helps to determine the effectivness of preserving large and huge 1502 + helps to determine the effectiveness of preserving large and huge 1503 1503 page mappings when mapping protections are changed. 1504 1504 1505 1505 config ARCH_HAS_MEM_ENCRYPT
+10 -4
arch/x86/crypto/poly1305-avx2-x86_64.S
··· 323 323 vpaddq t2,t1,t1 324 324 vmovq t1x,d4 325 325 326 + # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> 327 + # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small 328 + # amount. Careful: we must not assume the carry bits 'd0 >> 26', 329 + # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit 330 + # integers. It's true in a single-block implementation, but not here. 331 + 326 332 # d1 += d0 >> 26 327 333 mov d0,%rax 328 334 shr $26,%rax ··· 367 361 # h0 += (d4 >> 26) * 5 368 362 mov d4,%rax 369 363 shr $26,%rax 370 - lea (%eax,%eax,4),%eax 371 - add %eax,%ebx 364 + lea (%rax,%rax,4),%rax 365 + add %rax,%rbx 372 366 # h4 = d4 & 0x3ffffff 373 367 mov d4,%rax 374 368 and $0x3ffffff,%eax 375 369 mov %eax,h4 376 370 377 371 # h1 += h0 >> 26 378 - mov %ebx,%eax 379 - shr $26,%eax 372 + mov %rbx,%rax 373 + shr $26,%rax 380 374 add %eax,h1 381 375 # h0 = h0 & 0x3ffffff 382 376 andl $0x3ffffff,%ebx
+14 -8
arch/x86/crypto/poly1305-sse2-x86_64.S
··· 253 253 # h0 += (d4 >> 26) * 5 254 254 mov d4,%rax 255 255 shr $26,%rax 256 - lea (%eax,%eax,4),%eax 257 - add %eax,%ebx 256 + lea (%rax,%rax,4),%rax 257 + add %rax,%rbx 258 258 # h4 = d4 & 0x3ffffff 259 259 mov d4,%rax 260 260 and $0x3ffffff,%eax 261 261 mov %eax,h4 262 262 263 263 # h1 += h0 >> 26 264 - mov %ebx,%eax 265 - shr $26,%eax 264 + mov %rbx,%rax 265 + shr $26,%rax 266 266 add %eax,h1 267 267 # h0 = h0 & 0x3ffffff 268 268 andl $0x3ffffff,%ebx ··· 524 524 paddq t2,t1 525 525 movq t1,d4 526 526 527 + # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> 528 + # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small 529 + # amount. Careful: we must not assume the carry bits 'd0 >> 26', 530 + # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit 531 + # integers. It's true in a single-block implementation, but not here. 532 + 527 533 # d1 += d0 >> 26 528 534 mov d0,%rax 529 535 shr $26,%rax ··· 568 562 # h0 += (d4 >> 26) * 5 569 563 mov d4,%rax 570 564 shr $26,%rax 571 - lea (%eax,%eax,4),%eax 572 - add %eax,%ebx 565 + lea (%rax,%rax,4),%rax 566 + add %rax,%rbx 573 567 # h4 = d4 & 0x3ffffff 574 568 mov d4,%rax 575 569 and $0x3ffffff,%eax 576 570 mov %eax,h4 577 571 578 572 # h1 += h0 >> 26 579 - mov %ebx,%eax 580 - shr $26,%eax 573 + mov %rbx,%rax 574 + shr $26,%rax 581 575 add %eax,h1 582 576 # h0 = h0 & 0x3ffffff 583 577 andl $0x3ffffff,%ebx
+26 -9
arch/x86/events/amd/core.c
··· 117 117 }; 118 118 119 119 /* 120 - * AMD Performance Monitor K7 and later. 120 + * AMD Performance Monitor K7 and later, up to and including Family 16h: 121 121 */ 122 122 static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = 123 123 { 124 - [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, 125 - [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 126 - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, 127 - [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, 128 - [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, 129 - [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, 130 - [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ 131 - [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ 124 + [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, 125 + [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 126 + [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, 127 + [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, 128 + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, 129 + [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, 130 + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ 131 + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ 132 + }; 133 + 134 + /* 135 + * AMD Performance Monitor Family 17h and later: 136 + */ 137 + static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = 138 + { 139 + [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, 140 + [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 141 + [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, 142 + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, 143 + [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, 144 + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287, 145 + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187, 132 146 }; 133 147 134 148 static u64 amd_pmu_event_map(int hw_event) 135 149 { 150 + if (boot_cpu_data.x86 >= 0x17) 151 + return amd_f17h_perfmon_event_map[hw_event]; 152 + 136 153 return amd_perfmon_event_map[hw_event]; 137 154 } 138 155
+1 -1
arch/x86/events/intel/core.c
··· 3131 3131 flags &= ~PERF_SAMPLE_TIME; 3132 3132 if (!event->attr.exclude_kernel) 3133 3133 flags &= ~PERF_SAMPLE_REGS_USER; 3134 - if (event->attr.sample_regs_user & ~PEBS_REGS) 3134 + if (event->attr.sample_regs_user & ~PEBS_GP_REGS) 3135 3135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); 3136 3136 return flags; 3137 3137 }
+19 -19
arch/x86/events/perf_event.h
··· 96 96 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ 97 97 PERF_SAMPLE_PERIOD) 98 98 99 - #define PEBS_REGS \ 100 - (PERF_REG_X86_AX | \ 101 - PERF_REG_X86_BX | \ 102 - PERF_REG_X86_CX | \ 103 - PERF_REG_X86_DX | \ 104 - PERF_REG_X86_DI | \ 105 - PERF_REG_X86_SI | \ 106 - PERF_REG_X86_SP | \ 107 - PERF_REG_X86_BP | \ 108 - PERF_REG_X86_IP | \ 109 - PERF_REG_X86_FLAGS | \ 110 - PERF_REG_X86_R8 | \ 111 - PERF_REG_X86_R9 | \ 112 - PERF_REG_X86_R10 | \ 113 - PERF_REG_X86_R11 | \ 114 - PERF_REG_X86_R12 | \ 115 - PERF_REG_X86_R13 | \ 116 - PERF_REG_X86_R14 | \ 117 - PERF_REG_X86_R15) 99 + #define PEBS_GP_REGS \ 100 + ((1ULL << PERF_REG_X86_AX) | \ 101 + (1ULL << PERF_REG_X86_BX) | \ 102 + (1ULL << PERF_REG_X86_CX) | \ 103 + (1ULL << PERF_REG_X86_DX) | \ 104 + (1ULL << PERF_REG_X86_DI) | \ 105 + (1ULL << PERF_REG_X86_SI) | \ 106 + (1ULL << PERF_REG_X86_SP) | \ 107 + (1ULL << PERF_REG_X86_BP) | \ 108 + (1ULL << PERF_REG_X86_IP) | \ 109 + (1ULL << PERF_REG_X86_FLAGS) | \ 110 + (1ULL << PERF_REG_X86_R8) | \ 111 + (1ULL << PERF_REG_X86_R9) | \ 112 + (1ULL << PERF_REG_X86_R10) | \ 113 + (1ULL << PERF_REG_X86_R11) | \ 114 + (1ULL << PERF_REG_X86_R12) | \ 115 + (1ULL << PERF_REG_X86_R13) | \ 116 + (1ULL << PERF_REG_X86_R14) | \ 117 + (1ULL << PERF_REG_X86_R15)) 118 118 119 119 /* 120 120 * Per register state.
+3 -3
arch/x86/kernel/cpu/bugs.c
··· 275 275 const char *option; 276 276 enum spectre_v2_user_cmd cmd; 277 277 bool secure; 278 - } v2_user_options[] __initdata = { 278 + } v2_user_options[] __initconst = { 279 279 { "auto", SPECTRE_V2_USER_CMD_AUTO, false }, 280 280 { "off", SPECTRE_V2_USER_CMD_NONE, false }, 281 281 { "on", SPECTRE_V2_USER_CMD_FORCE, true }, ··· 419 419 const char *option; 420 420 enum spectre_v2_mitigation_cmd cmd; 421 421 bool secure; 422 - } mitigation_options[] __initdata = { 422 + } mitigation_options[] __initconst = { 423 423 { "off", SPECTRE_V2_CMD_NONE, false }, 424 424 { "on", SPECTRE_V2_CMD_FORCE, true }, 425 425 { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false }, ··· 658 658 static const struct { 659 659 const char *option; 660 660 enum ssb_mitigation_cmd cmd; 661 - } ssb_mitigation_options[] __initdata = { 661 + } ssb_mitigation_options[] __initconst = { 662 662 { "auto", SPEC_STORE_BYPASS_CMD_AUTO }, /* Platform decides */ 663 663 { "on", SPEC_STORE_BYPASS_CMD_ON }, /* Disable Speculative Store Bypass */ 664 664 { "off", SPEC_STORE_BYPASS_CMD_NONE }, /* Don't touch Speculative Store Bypass */
+2 -2
arch/x86/kernel/cpu/intel.c
··· 611 611 if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE) 612 612 return; 613 613 614 - pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); 615 - pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n"); 614 + pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); 615 + pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n"); 616 616 epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL; 617 617 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); 618 618 }
+2 -1
arch/x86/kernel/cpu/resctrl/rdtgroup.c
··· 2610 2610 rdt_last_cmd_puts("Failed to initialize allocations\n"); 2611 2611 return ret; 2612 2612 } 2613 - rdtgrp->mode = RDT_MODE_SHAREABLE; 2614 2613 } 2614 + 2615 + rdtgrp->mode = RDT_MODE_SHAREABLE; 2615 2616 2616 2617 return 0; 2617 2618 }
+46 -2
arch/x86/kernel/kprobes/core.c
··· 569 569 unsigned long *sara = stack_addr(regs); 570 570 571 571 ri->ret_addr = (kprobe_opcode_t *) *sara; 572 + ri->fp = sara; 572 573 573 574 /* Replace the return addr with trampoline addr */ 574 575 *sara = (unsigned long) &kretprobe_trampoline; ··· 749 748 NOKPROBE_SYMBOL(kretprobe_trampoline); 750 749 STACK_FRAME_NON_STANDARD(kretprobe_trampoline); 751 750 751 + static struct kprobe kretprobe_kprobe = { 752 + .addr = (void *)kretprobe_trampoline, 753 + }; 754 + 752 755 /* 753 756 * Called from kretprobe_trampoline 754 757 */ 755 758 static __used void *trampoline_handler(struct pt_regs *regs) 756 759 { 760 + struct kprobe_ctlblk *kcb; 757 761 struct kretprobe_instance *ri = NULL; 758 762 struct hlist_head *head, empty_rp; 759 763 struct hlist_node *tmp; 760 764 unsigned long flags, orig_ret_address = 0; 761 765 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; 762 766 kprobe_opcode_t *correct_ret_addr = NULL; 767 + void *frame_pointer; 768 + bool skipped = false; 769 + 770 + preempt_disable(); 771 + 772 + /* 773 + * Set a dummy kprobe for avoiding kretprobe recursion. 774 + * Since kretprobe never run in kprobe handler, kprobe must not 775 + * be running at this point. 776 + */ 777 + kcb = get_kprobe_ctlblk(); 778 + __this_cpu_write(current_kprobe, &kretprobe_kprobe); 779 + kcb->kprobe_status = KPROBE_HIT_ACTIVE; 763 780 764 781 INIT_HLIST_HEAD(&empty_rp); 765 782 kretprobe_hash_lock(current, &head, &flags); 766 783 /* fixup registers */ 767 784 #ifdef CONFIG_X86_64 768 785 regs->cs = __KERNEL_CS; 786 + /* On x86-64, we use pt_regs->sp for return address holder. */ 787 + frame_pointer = &regs->sp; 769 788 #else 770 789 regs->cs = __KERNEL_CS | get_kernel_rpl(); 771 790 regs->gs = 0; 791 + /* On x86-32, we use pt_regs->flags for return address holder. */ 792 + frame_pointer = &regs->flags; 772 793 #endif 773 794 regs->ip = trampoline_address; 774 795 regs->orig_ax = ~0UL; ··· 812 789 if (ri->task != current) 813 790 /* another task is sharing our hash bucket */ 814 791 continue; 792 + /* 793 + * Return probes must be pushed on this hash list correct 794 + * order (same as return order) so that it can be poped 795 + * correctly. However, if we find it is pushed it incorrect 796 + * order, this means we find a function which should not be 797 + * probed, because the wrong order entry is pushed on the 798 + * path of processing other kretprobe itself. 799 + */ 800 + if (ri->fp != frame_pointer) { 801 + if (!skipped) 802 + pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n"); 803 + skipped = true; 804 + continue; 805 + } 815 806 816 807 orig_ret_address = (unsigned long)ri->ret_addr; 808 + if (skipped) 809 + pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n", 810 + ri->rp->kp.addr); 817 811 818 812 if (orig_ret_address != trampoline_address) 819 813 /* ··· 848 808 if (ri->task != current) 849 809 /* another task is sharing our hash bucket */ 850 810 continue; 811 + if (ri->fp != frame_pointer) 812 + continue; 851 813 852 814 orig_ret_address = (unsigned long)ri->ret_addr; 853 815 if (ri->rp && ri->rp->handler) { 854 816 __this_cpu_write(current_kprobe, &ri->rp->kp); 855 - get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE; 856 817 ri->ret_addr = correct_ret_addr; 857 818 ri->rp->handler(ri, regs); 858 - __this_cpu_write(current_kprobe, NULL); 819 + __this_cpu_write(current_kprobe, &kretprobe_kprobe); 859 820 } 860 821 861 822 recycle_rp_inst(ri, &empty_rp); ··· 871 830 } 872 831 873 832 kretprobe_hash_unlock(current, &flags); 833 + 834 + __this_cpu_write(current_kprobe, NULL); 835 + preempt_enable(); 874 836 875 837 hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { 876 838 hlist_del(&ri->hlist);
+6 -2
arch/x86/kernel/process.c
··· 426 426 u64 msr = x86_spec_ctrl_base; 427 427 bool updmsr = false; 428 428 429 + lockdep_assert_irqs_disabled(); 430 + 429 431 /* 430 432 * If TIF_SSBD is different, select the proper mitigation 431 433 * method. Note that if SSBD mitigation is disabled or permanentely ··· 479 477 480 478 void speculation_ctrl_update(unsigned long tif) 481 479 { 480 + unsigned long flags; 481 + 482 482 /* Forced update. Make sure all relevant TIF flags are different */ 483 - preempt_disable(); 483 + local_irq_save(flags); 484 484 __speculation_ctrl_update(~tif, tif); 485 - preempt_enable(); 485 + local_irq_restore(flags); 486 486 } 487 487 488 488 /* Called from seccomp/prctl update */
+21
arch/x86/kernel/reboot.c
··· 81 81 return 0; 82 82 } 83 83 84 + /* 85 + * Some machines don't handle the default ACPI reboot method and 86 + * require the EFI reboot method: 87 + */ 88 + static int __init set_efi_reboot(const struct dmi_system_id *d) 89 + { 90 + if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) { 91 + reboot_type = BOOT_EFI; 92 + pr_info("%s series board detected. Selecting EFI-method for reboot.\n", d->ident); 93 + } 94 + return 0; 95 + } 96 + 84 97 void __noreturn machine_real_restart(unsigned int type) 85 98 { 86 99 local_irq_disable(); ··· 177 164 .matches = { 178 165 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 179 166 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"), 167 + }, 168 + }, 169 + { /* Handle reboot issue on Acer TravelMate X514-51T */ 170 + .callback = set_efi_reboot, 171 + .ident = "Acer TravelMate X514-51T", 172 + .matches = { 173 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 174 + DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"), 180 175 }, 181 176 }, 182 177
+1 -1
arch/x86/kernel/vmlinux.lds.S
··· 362 362 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 363 363 __bss_start = .; 364 364 *(.bss..page_aligned) 365 - *(.bss) 365 + *(BSS_MAIN) 366 366 BSS_DECRYPTED 367 367 . = ALIGN(PAGE_SIZE); 368 368 __bss_stop = .;
+2 -1
arch/x86/mm/dump_pagetables.c
··· 259 259 #endif 260 260 /* Account the WX pages */ 261 261 st->wx_pages += npages; 262 - WARN_ONCE(1, "x86/mm: Found insecure W+X mapping at address %pS\n", 262 + WARN_ONCE(__supported_pte_mask & _PAGE_NX, 263 + "x86/mm: Found insecure W+X mapping at address %pS\n", 263 264 (void *)st->start_address); 264 265 } 265 266
+1 -1
arch/x86/mm/ioremap.c
··· 825 825 pte = early_ioremap_pte(addr); 826 826 827 827 /* Sanitize 'prot' against any unsupported bits: */ 828 - pgprot_val(flags) &= __default_kernel_pte_mask; 828 + pgprot_val(flags) &= __supported_pte_mask; 829 829 830 830 if (pgprot_val(flags)) 831 831 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
+1 -1
arch/x86/mm/kaslr.c
··· 94 94 if (!kaslr_memory_enabled()) 95 95 return; 96 96 97 - kaslr_regions[0].size_tb = 1 << (__PHYSICAL_MASK_SHIFT - TB_SHIFT); 97 + kaslr_regions[0].size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT); 98 98 kaslr_regions[1].size_tb = VMALLOC_SIZE_TB; 99 99 100 100 /*
+1 -1
arch/x86/mm/tlb.c
··· 728 728 { 729 729 int cpu; 730 730 731 - struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = { 731 + struct flush_tlb_info info = { 732 732 .mm = mm, 733 733 .stride_shift = stride_shift, 734 734 .freed_tables = freed_tables,
+4
arch/xtensa/kernel/syscalls/syscall.tbl
··· 394 394 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait 395 395 422 common futex_time64 sys_futex 396 396 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval 397 + 424 common pidfd_send_signal sys_pidfd_send_signal 398 + 425 common io_uring_setup sys_io_uring_setup 399 + 426 common io_uring_enter sys_io_uring_enter 400 + 427 common io_uring_register sys_io_uring_register
+7 -1
block/bfq-iosched.c
··· 5396 5396 return min_shallow; 5397 5397 } 5398 5398 5399 - static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) 5399 + static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx) 5400 5400 { 5401 5401 struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; 5402 5402 struct blk_mq_tags *tags = hctx->sched_tags; ··· 5404 5404 5405 5405 min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags); 5406 5406 sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow); 5407 + } 5408 + 5409 + static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) 5410 + { 5411 + bfq_depth_updated(hctx); 5407 5412 return 0; 5408 5413 } 5409 5414 ··· 5831 5826 .requests_merged = bfq_requests_merged, 5832 5827 .request_merged = bfq_request_merged, 5833 5828 .has_work = bfq_has_work, 5829 + .depth_updated = bfq_depth_updated, 5834 5830 .init_hctx = bfq_init_hctx, 5835 5831 .init_sched = bfq_init_queue, 5836 5832 .exit_sched = bfq_exit_queue,
+2
block/blk-mq.c
··· 3135 3135 } 3136 3136 if (ret) 3137 3137 break; 3138 + if (q->elevator && q->elevator->type->ops.depth_updated) 3139 + q->elevator->type->ops.depth_updated(hctx); 3138 3140 } 3139 3141 3140 3142 if (!ret)
+43 -1
crypto/testmgr.h
··· 5634 5634 .psize = 80, 5635 5635 .digest = "\x13\x00\x00\x00\x00\x00\x00\x00" 5636 5636 "\x00\x00\x00\x00\x00\x00\x00\x00", 5637 - }, 5637 + }, { /* Regression test for overflow in AVX2 implementation */ 5638 + .plaintext = "\xff\xff\xff\xff\xff\xff\xff\xff" 5639 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5640 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5641 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5642 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5643 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5644 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5645 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5646 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5647 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5648 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5649 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5650 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5651 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5652 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5653 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5654 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5655 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5656 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5657 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5658 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5659 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5660 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5661 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5662 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5663 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5664 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5665 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5666 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5667 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5668 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5669 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5670 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5671 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5672 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5673 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5674 + "\xff\xff\xff\xff\xff\xff\xff\xff" 5675 + "\xff\xff\xff\xff", 5676 + .psize = 300, 5677 + .digest = "\xfb\x5e\x96\xd8\x61\xd5\xc7\xc8" 5678 + "\x78\xe5\x87\xcc\x2d\x5a\x22\xe1", 5679 + } 5638 5680 }; 5639 5681 5640 5682 /* NHPoly1305 test vectors from https://github.com/google/adiantum */
+1 -1
drivers/atm/firestream.c
··· 1646 1646 } 1647 1647 1648 1648 if (status & ISR_TBRQ_W) { 1649 - fs_dprintk (FS_DEBUG_IRQ, "Data tramsitted!\n"); 1649 + fs_dprintk (FS_DEBUG_IRQ, "Data transmitted!\n"); 1650 1650 process_txdone_queue (dev, &dev->tx_relq); 1651 1651 } 1652 1652
+1 -1
drivers/base/memory.c
··· 506 506 507 507 ret = lock_device_hotplug_sysfs(); 508 508 if (ret) 509 - goto out; 509 + return ret; 510 510 511 511 nid = memory_add_physaddr_to_nid(phys_addr); 512 512 ret = __add_memory(nid, phys_addr,
+1
drivers/clocksource/Kconfig
··· 145 145 config NPCM7XX_TIMER 146 146 bool "NPCM7xx timer driver" if COMPILE_TEST 147 147 depends on HAS_IOMEM 148 + select TIMER_OF 148 149 select CLKSRC_MMIO 149 150 help 150 151 Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture,
+1 -4
drivers/clocksource/arm_arch_timer.c
··· 9 9 * published by the Free Software Foundation. 10 10 */ 11 11 12 - #define pr_fmt(fmt) "arm_arch_timer: " fmt 12 + #define pr_fmt(fmt) "arch_timer: " fmt 13 13 14 14 #include <linux/init.h> 15 15 #include <linux/kernel.h> ··· 32 32 #include <asm/virt.h> 33 33 34 34 #include <clocksource/arm_arch_timer.h> 35 - 36 - #undef pr_fmt 37 - #define pr_fmt(fmt) "arch_timer: " fmt 38 35 39 36 #define CNTTIDR 0x08 40 37 #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4))
+1 -1
drivers/clocksource/timer-oxnas-rps.c
··· 296 296 TIMER_OF_DECLARE(ox810se_rps, 297 297 "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init); 298 298 TIMER_OF_DECLARE(ox820_rps, 299 - "oxsemi,ox820se-rps-timer", oxnas_rps_timer_init); 299 + "oxsemi,ox820-rps-timer", oxnas_rps_timer_init);
-28
drivers/clocksource/timer-ti-dm.c
··· 585 585 return 0; 586 586 } 587 587 588 - /* Optimized set_load which removes costly spin wait in timer_start */ 589 - static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, 590 - int autoreload, unsigned int load) 591 - { 592 - u32 l; 593 - 594 - if (unlikely(!timer)) 595 - return -EINVAL; 596 - 597 - omap_dm_timer_enable(timer); 598 - 599 - l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 600 - if (autoreload) { 601 - l |= OMAP_TIMER_CTRL_AR; 602 - omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); 603 - } else { 604 - l &= ~OMAP_TIMER_CTRL_AR; 605 - } 606 - l |= OMAP_TIMER_CTRL_ST; 607 - 608 - __omap_dm_timer_load_start(timer, l, load, timer->posted); 609 - 610 - /* Save the context */ 611 - timer->context.tclr = l; 612 - timer->context.tldr = load; 613 - timer->context.tcrr = load; 614 - return 0; 615 - } 616 588 static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, 617 589 unsigned int match) 618 590 {
+1 -1
drivers/extcon/Kconfig
··· 116 116 117 117 config EXTCON_PTN5150 118 118 tristate "NXP PTN5150 CC LOGIC USB EXTCON support" 119 - depends on I2C && GPIOLIB || COMPILE_TEST 119 + depends on I2C && (GPIOLIB || COMPILE_TEST) 120 120 select REGMAP_I2C 121 121 help 122 122 Say Y here to enable support for USB peripheral and USB host
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 3165 3165 3166 3166 /* No need to recover an evicted BO */ 3167 3167 if (shadow->tbo.mem.mem_type != TTM_PL_TT || 3168 + shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET || 3168 3169 shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) 3169 3170 continue; 3170 3171
+1
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
··· 182 182 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, 183 183 L2_CACHE_BIGK_FRAGMENT_SIZE, 6); 184 184 } 185 + WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp); 185 186 186 187 tmp = mmVM_L2_CNTL4_DEFAULT; 187 188 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
+19
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1377 1377 return UPDATE_TYPE_FULL; 1378 1378 } 1379 1379 1380 + if (u->surface->force_full_update) { 1381 + update_flags->bits.full_update = 1; 1382 + return UPDATE_TYPE_FULL; 1383 + } 1384 + 1380 1385 type = get_plane_info_update_type(u); 1381 1386 elevate_update_type(&overall_type, type); 1382 1387 ··· 1807 1802 } 1808 1803 1809 1804 dc_resource_state_copy_construct(state, context); 1805 + 1806 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 1807 + struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i]; 1808 + struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i]; 1809 + 1810 + if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state) 1811 + new_pipe->plane_state->force_full_update = true; 1812 + } 1810 1813 } 1811 1814 1812 1815 ··· 1851 1838 dc->current_state = context; 1852 1839 dc_release_state(old); 1853 1840 1841 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 1842 + struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; 1843 + 1844 + if (pipe_ctx->plane_state && pipe_ctx->stream == stream) 1845 + pipe_ctx->plane_state->force_full_update = false; 1846 + } 1854 1847 } 1855 1848 /*let's use current_state to update watermark etc*/ 1856 1849 if (update_type >= UPDATE_TYPE_FULL)
+3
drivers/gpu/drm/amd/display/dc/dc.h
··· 503 503 struct dc_plane_status status; 504 504 struct dc_context *ctx; 505 505 506 + /* HACK: Workaround for forcing full reprogramming under some conditions */ 507 + bool force_full_update; 508 + 506 509 /* private to dc_surface.c */ 507 510 enum dc_irq_source irq_source; 508 511 struct kref refcount;
+6 -3
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
··· 190 190 1, 191 191 0); 192 192 } 193 + 194 + REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); 195 + 196 + REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, 197 + 10, aux110->timeout_period/10); 198 + 193 199 /* set the delay and the number of bytes to write */ 194 200 195 201 /* The length include ··· 248 242 } 249 243 } 250 244 251 - REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); 252 - REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, 253 - 10, aux110->timeout_period/10); 254 245 REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); 255 246 } 256 247
+3 -3
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
··· 71 71 * at most within ~240usec. That means, 72 72 * increasing this timeout will not affect normal operation, 73 73 * and we'll timeout after 74 - * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec. 74 + * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec. 75 75 * This timeout is especially important for 76 - * resume from S3 and CTS. 76 + * converters, resume from S3, and CTS. 77 77 */ 78 - SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4 78 + SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6 79 79 }; 80 80 81 81 struct dce_aux {
+5 -7
drivers/gpu/drm/i915/intel_fbdev.c
··· 338 338 bool *enabled, int width, int height) 339 339 { 340 340 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); 341 + unsigned long conn_configured, conn_seq, mask; 341 342 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); 342 - unsigned long conn_configured, conn_seq; 343 343 int i, j; 344 344 bool *save_enabled; 345 345 bool fallback = true, ret = true; ··· 357 357 drm_modeset_backoff(&ctx); 358 358 359 359 memcpy(save_enabled, enabled, count); 360 - conn_seq = GENMASK(count - 1, 0); 360 + mask = GENMASK(count - 1, 0); 361 361 conn_configured = 0; 362 362 retry: 363 + conn_seq = conn_configured; 363 364 for (i = 0; i < count; i++) { 364 365 struct drm_fb_helper_connector *fb_conn; 365 366 struct drm_connector *connector; ··· 373 372 if (conn_configured & BIT(i)) 374 373 continue; 375 374 376 - /* First pass, only consider tiled connectors */ 377 - if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile) 375 + if (conn_seq == 0 && !connector->has_tile) 378 376 continue; 379 377 380 378 if (connector->status == connector_status_connected) ··· 477 477 conn_configured |= BIT(i); 478 478 } 479 479 480 - if (conn_configured != conn_seq) { /* repeat until no more are found */ 481 - conn_seq = conn_configured; 480 + if ((conn_configured & mask) != mask && conn_configured != conn_seq) 482 481 goto retry; 483 - } 484 482 485 483 /* 486 484 * If the BIOS didn't enable everything it could, fall back to have the
+9 -3
drivers/gpu/drm/tegra/hdmi.c
··· 1260 1260 1261 1261 hdmi->dvi = !tegra_output_is_hdmi(output); 1262 1262 if (!hdmi->dvi) { 1263 - err = tegra_hdmi_setup_audio(hdmi); 1264 - if (err < 0) 1265 - hdmi->dvi = true; 1263 + /* 1264 + * Make sure that the audio format has been configured before 1265 + * enabling audio, otherwise we may try to divide by zero. 1266 + */ 1267 + if (hdmi->format.sample_rate > 0) { 1268 + err = tegra_hdmi_setup_audio(hdmi); 1269 + if (err < 0) 1270 + hdmi->dvi = true; 1271 + } 1266 1272 } 1267 1273 1268 1274 if (hdmi->config->has_hda)
+3 -1
drivers/gpu/drm/ttm/ttm_bo.c
··· 876 876 reservation_object_add_shared_fence(bo->resv, fence); 877 877 878 878 ret = reservation_object_reserve_shared(bo->resv, 1); 879 - if (unlikely(ret)) 879 + if (unlikely(ret)) { 880 + dma_fence_put(fence); 880 881 return ret; 882 + } 881 883 882 884 dma_fence_put(bo->moving); 883 885 bo->moving = fence;
+7 -6
drivers/gpu/drm/ttm/ttm_page_alloc.c
··· 730 730 } 731 731 732 732 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 733 - if (!(flags & TTM_PAGE_FLAG_DMA32)) { 734 - for (j = 0; j < HPAGE_PMD_NR; ++j) 735 - if (p++ != pages[i + j]) 733 + if (!(flags & TTM_PAGE_FLAG_DMA32) && 734 + (npages - i) >= HPAGE_PMD_NR) { 735 + for (j = 1; j < HPAGE_PMD_NR; ++j) 736 + if (++p != pages[i + j]) 736 737 break; 737 738 738 739 if (j == HPAGE_PMD_NR) ··· 760 759 unsigned max_size, n2free; 761 760 762 761 spin_lock_irqsave(&huge->lock, irq_flags); 763 - while (i < npages) { 762 + while ((npages - i) >= HPAGE_PMD_NR) { 764 763 struct page *p = pages[i]; 765 764 unsigned j; 766 765 767 766 if (!p) 768 767 break; 769 768 770 - for (j = 0; j < HPAGE_PMD_NR; ++j) 771 - if (p++ != pages[i + j]) 769 + for (j = 1; j < HPAGE_PMD_NR; ++j) 770 + if (++p != pages[i + j]) 772 771 break; 773 772 774 773 if (j != HPAGE_PMD_NR)
+4
drivers/gpu/drm/virtio/virtgpu_drv.c
··· 205 205 #if defined(CONFIG_DEBUG_FS) 206 206 .debugfs_init = virtio_gpu_debugfs_init, 207 207 #endif 208 + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 209 + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 208 210 .gem_prime_export = drm_gem_prime_export, 209 211 .gem_prime_import = drm_gem_prime_import, 210 212 .gem_prime_pin = virtgpu_gem_prime_pin, 211 213 .gem_prime_unpin = virtgpu_gem_prime_unpin, 214 + .gem_prime_get_sg_table = virtgpu_gem_prime_get_sg_table, 215 + .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, 212 216 .gem_prime_vmap = virtgpu_gem_prime_vmap, 213 217 .gem_prime_vunmap = virtgpu_gem_prime_vunmap, 214 218 .gem_prime_mmap = virtgpu_gem_prime_mmap,
+4
drivers/gpu/drm/virtio/virtgpu_drv.h
··· 354 354 /* virtgpu_prime.c */ 355 355 int virtgpu_gem_prime_pin(struct drm_gem_object *obj); 356 356 void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); 357 + struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); 358 + struct drm_gem_object *virtgpu_gem_prime_import_sg_table( 359 + struct drm_device *dev, struct dma_buf_attachment *attach, 360 + struct sg_table *sgt); 357 361 void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); 358 362 void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); 359 363 int virtgpu_gem_prime_mmap(struct drm_gem_object *obj,
+12
drivers/gpu/drm/virtio/virtgpu_prime.c
··· 39 39 WARN_ONCE(1, "not implemented"); 40 40 } 41 41 42 + struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) 43 + { 44 + return ERR_PTR(-ENODEV); 45 + } 46 + 47 + struct drm_gem_object *virtgpu_gem_prime_import_sg_table( 48 + struct drm_device *dev, struct dma_buf_attachment *attach, 49 + struct sg_table *table) 50 + { 51 + return ERR_PTR(-ENODEV); 52 + } 53 + 42 54 void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) 43 55 { 44 56 struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
+6 -2
drivers/gpu/host1x/hw/channel_hw.c
··· 114 114 115 115 static void host1x_channel_set_streamid(struct host1x_channel *channel) 116 116 { 117 - #if IS_ENABLED(CONFIG_IOMMU_API) && HOST1X_HW >= 6 117 + #if HOST1X_HW >= 6 118 + u32 sid = 0x7f; 119 + #ifdef CONFIG_IOMMU_API 118 120 struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); 119 - u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f; 121 + if (spec) 122 + sid = spec->ids[0] & 0xffff; 123 + #endif 120 124 121 125 host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); 122 126 #endif
+16 -1
drivers/hid/hid-input.c
··· 680 680 break; 681 681 } 682 682 683 + if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ 684 + switch (usage->hid & 0xf) { 685 + case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; 686 + default: goto ignore; 687 + } 688 + break; 689 + } 690 + 683 691 /* 684 692 * Some lazy vendors declare 255 usages for System Control, 685 693 * leading to the creation of ABS_X|Y axis and too many others. ··· 910 902 case 0x06a: map_key_clear(KEY_GREEN); break; 911 903 case 0x06b: map_key_clear(KEY_BLUE); break; 912 904 case 0x06c: map_key_clear(KEY_YELLOW); break; 913 - case 0x06d: map_key_clear(KEY_ZOOM); break; 905 + case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break; 914 906 915 907 case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; 916 908 case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; ··· 918 910 case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break; 919 911 case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; 920 912 case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; 913 + 914 + case 0x079: map_key_clear(KEY_KBDILLUMUP); break; 915 + case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; 916 + case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; 921 917 922 918 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; 923 919 case 0x083: map_key_clear(KEY_LAST); break; ··· 1034 1022 case 0x22d: map_key_clear(KEY_ZOOMIN); break; 1035 1023 case 0x22e: map_key_clear(KEY_ZOOMOUT); break; 1036 1024 case 0x22f: map_key_clear(KEY_ZOOMRESET); break; 1025 + case 0x232: map_key_clear(KEY_FULL_SCREEN); break; 1037 1026 case 0x233: map_key_clear(KEY_SCROLLUP); break; 1038 1027 case 0x234: map_key_clear(KEY_SCROLLDOWN); break; 1039 1028 case 0x238: /* AC Pan */ ··· 1057 1044 case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; 1058 1045 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; 1059 1046 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; 1047 + 1048 + case 0x29f: map_key_clear(KEY_SCALE); break; 1060 1049 1061 1050 default: map_key_clear(KEY_UNKNOWN); 1062 1051 }
+2 -3
drivers/i3c/master.c
··· 1980 1980 { 1981 1981 struct i3c_dev_boardinfo *boardinfo; 1982 1982 struct device *dev = &master->dev; 1983 - struct i3c_device_info info = { }; 1984 1983 enum i3c_addr_slot_status addrstatus; 1985 1984 u32 init_dyn_addr = 0; 1986 1985 ··· 2011 2012 2012 2013 boardinfo->pid = ((u64)reg[1] << 32) | reg[2]; 2013 2014 2014 - if ((info.pid & GENMASK_ULL(63, 48)) || 2015 - I3C_PID_RND_LOWER_32BITS(info.pid)) 2015 + if ((boardinfo->pid & GENMASK_ULL(63, 48)) || 2016 + I3C_PID_RND_LOWER_32BITS(boardinfo->pid)) 2016 2017 return -EINVAL; 2017 2018 2018 2019 boardinfo->init_dyn_addr = init_dyn_addr;
+1 -1
drivers/i3c/master/dw-i3c-master.c
··· 300 300 301 301 static void dw_i3c_master_disable(struct dw_i3c_master *master) 302 302 { 303 - writel(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_ENABLE, 303 + writel(readl(master->regs + DEVICE_CTRL) & ~DEV_CTRL_ENABLE, 304 304 master->regs + DEVICE_CTRL); 305 305 } 306 306
+2
drivers/iio/accel/kxcjk-1013.c
··· 1437 1437 1438 1438 mutex_lock(&data->mutex); 1439 1439 ret = kxcjk1013_set_mode(data, OPERATION); 1440 + if (ret == 0) 1441 + ret = kxcjk1013_set_range(data, data->range); 1440 1442 mutex_unlock(&data->mutex); 1441 1443 1442 1444 return ret;
+1
drivers/iio/adc/ad_sigma_delta.c
··· 121 121 if (sigma_delta->info->has_registers) { 122 122 data[0] = reg << sigma_delta->info->addr_shift; 123 123 data[0] |= sigma_delta->info->read_mask; 124 + data[0] |= sigma_delta->comm; 124 125 spi_message_add_tail(&t[0], &m); 125 126 } 126 127 spi_message_add_tail(&t[1], &m);
+17 -11
drivers/iio/adc/at91_adc.c
··· 704 704 ret = wait_event_interruptible_timeout(st->wq_data_avail, 705 705 st->done, 706 706 msecs_to_jiffies(1000)); 707 - if (ret == 0) 708 - ret = -ETIMEDOUT; 709 - if (ret < 0) { 710 - mutex_unlock(&st->lock); 711 - return ret; 712 - } 713 707 714 - *val = st->last_value; 715 - 708 + /* Disable interrupts, regardless if adc conversion was 709 + * successful or not 710 + */ 716 711 at91_adc_writel(st, AT91_ADC_CHDR, 717 712 AT91_ADC_CH(chan->channel)); 718 713 at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); 719 714 720 - st->last_value = 0; 721 - st->done = false; 715 + if (ret > 0) { 716 + /* a valid conversion took place */ 717 + *val = st->last_value; 718 + st->last_value = 0; 719 + st->done = false; 720 + ret = IIO_VAL_INT; 721 + } else if (ret == 0) { 722 + /* conversion timeout */ 723 + dev_err(&idev->dev, "ADC Channel %d timeout.\n", 724 + chan->channel); 725 + ret = -ETIMEDOUT; 726 + } 727 + 722 728 mutex_unlock(&st->lock); 723 - return IIO_VAL_INT; 729 + return ret; 724 730 725 731 case IIO_CHAN_INFO_SCALE: 726 732 *val = st->vref_mv;
+2 -1
drivers/iio/adc/xilinx-xadc-core.c
··· 1292 1292 1293 1293 err_free_irq: 1294 1294 free_irq(xadc->irq, indio_dev); 1295 + cancel_delayed_work_sync(&xadc->zynq_unmask_work); 1295 1296 err_clk_disable_unprepare: 1296 1297 clk_disable_unprepare(xadc->clk); 1297 1298 err_free_samplerate_trigger: ··· 1322 1321 iio_triggered_buffer_cleanup(indio_dev); 1323 1322 } 1324 1323 free_irq(xadc->irq, indio_dev); 1324 + cancel_delayed_work_sync(&xadc->zynq_unmask_work); 1325 1325 clk_disable_unprepare(xadc->clk); 1326 - cancel_delayed_work(&xadc->zynq_unmask_work); 1327 1326 kfree(xadc->data); 1328 1327 kfree(indio_dev->channels); 1329 1328
+14
drivers/iio/chemical/Kconfig
··· 64 64 config PMS7003 65 65 tristate "Plantower PMS7003 particulate matter sensor" 66 66 depends on SERIAL_DEV_BUS 67 + select IIO_TRIGGERED_BUFFER 67 68 help 68 69 Say Y here to build support for the Plantower PMS7003 particulate 69 70 matter sensor. 70 71 71 72 To compile this driver as a module, choose M here: the module will 72 73 be called pms7003. 74 + 75 + config SENSIRION_SGP30 76 + tristate "Sensirion SGPxx gas sensors" 77 + depends on I2C 78 + select CRC8 79 + help 80 + Say Y here to build I2C interface support for the following 81 + Sensirion SGP gas sensors: 82 + * SGP30 gas sensor 83 + * SGPC3 low power gas sensor 84 + 85 + To compile this driver as module, choose M here: the 86 + module will be called sgp30. 73 87 74 88 config SPS30 75 89 tristate "SPS30 particulate matter sensor"
+2 -4
drivers/iio/chemical/bme680.h
··· 2 2 #ifndef BME680_H_ 3 3 #define BME680_H_ 4 4 5 - #define BME680_REG_CHIP_I2C_ID 0xD0 6 - #define BME680_REG_CHIP_SPI_ID 0x50 5 + #define BME680_REG_CHIP_ID 0xD0 7 6 #define BME680_CHIP_ID_VAL 0x61 8 - #define BME680_REG_SOFT_RESET_I2C 0xE0 9 - #define BME680_REG_SOFT_RESET_SPI 0x60 7 + #define BME680_REG_SOFT_RESET 0xE0 10 8 #define BME680_CMD_SOFTRESET 0xB6 11 9 #define BME680_REG_STATUS 0x73 12 10 #define BME680_SPI_MEM_PAGE_BIT BIT(4)
+45 -9
drivers/iio/chemical/bme680_core.c
··· 63 63 s32 t_fine; 64 64 }; 65 65 66 + static const struct regmap_range bme680_volatile_ranges[] = { 67 + regmap_reg_range(BME680_REG_MEAS_STAT_0, BME680_REG_GAS_R_LSB), 68 + regmap_reg_range(BME680_REG_STATUS, BME680_REG_STATUS), 69 + regmap_reg_range(BME680_T2_LSB_REG, BME680_GH3_REG), 70 + }; 71 + 72 + static const struct regmap_access_table bme680_volatile_table = { 73 + .yes_ranges = bme680_volatile_ranges, 74 + .n_yes_ranges = ARRAY_SIZE(bme680_volatile_ranges), 75 + }; 76 + 66 77 const struct regmap_config bme680_regmap_config = { 67 78 .reg_bits = 8, 68 79 .val_bits = 8, 80 + .max_register = 0xef, 81 + .volatile_table = &bme680_volatile_table, 82 + .cache_type = REGCACHE_RBTREE, 69 83 }; 70 84 EXPORT_SYMBOL(bme680_regmap_config); 71 85 ··· 329 315 struct bme680_calib *calib = &data->bme680; 330 316 s64 var1, var2, var3; 331 317 s16 calc_temp; 318 + 319 + /* If the calibration is invalid, attempt to reload it */ 320 + if (!calib->par_t2) 321 + bme680_read_calib(data, calib); 332 322 333 323 var1 = (adc_temp >> 3) - (calib->par_t1 << 1); 334 324 var2 = (var1 * calib->par_t2) >> 11; ··· 601 583 return ret; 602 584 } 603 585 604 - static int bme680_read_temp(struct bme680_data *data, 605 - int *val, int *val2) 586 + static int bme680_read_temp(struct bme680_data *data, int *val) 606 587 { 607 588 struct device *dev = regmap_get_device(data->regmap); 608 589 int ret; ··· 634 617 * compensate_press/compensate_humid to get compensated 635 618 * pressure/humidity readings. 636 619 */ 637 - if (val && val2) { 638 - *val = comp_temp; 639 - *val2 = 100; 640 - return IIO_VAL_FRACTIONAL; 620 + if (val) { 621 + *val = comp_temp * 10; /* Centidegrees to millidegrees */ 622 + return IIO_VAL_INT; 641 623 } 642 624 643 625 return ret; ··· 651 635 s32 adc_press; 652 636 653 637 /* Read and compensate temperature to get a reading of t_fine */ 654 - ret = bme680_read_temp(data, NULL, NULL); 638 + ret = bme680_read_temp(data, NULL); 655 639 if (ret < 0) 656 640 return ret; 657 641 ··· 684 668 u32 comp_humidity; 685 669 686 670 /* Read and compensate temperature to get a reading of t_fine */ 687 - ret = bme680_read_temp(data, NULL, NULL); 671 + ret = bme680_read_temp(data, NULL); 688 672 if (ret < 0) 689 673 return ret; 690 674 ··· 777 761 case IIO_CHAN_INFO_PROCESSED: 778 762 switch (chan->type) { 779 763 case IIO_TEMP: 780 - return bme680_read_temp(data, val, val2); 764 + return bme680_read_temp(data, val); 781 765 case IIO_PRESSURE: 782 766 return bme680_read_press(data, val, val2); 783 767 case IIO_HUMIDITYRELATIVE: ··· 883 867 { 884 868 struct iio_dev *indio_dev; 885 869 struct bme680_data *data; 870 + unsigned int val; 886 871 int ret; 872 + 873 + ret = regmap_write(regmap, BME680_REG_SOFT_RESET, 874 + BME680_CMD_SOFTRESET); 875 + if (ret < 0) { 876 + dev_err(dev, "Failed to reset chip\n"); 877 + return ret; 878 + } 879 + 880 + ret = regmap_read(regmap, BME680_REG_CHIP_ID, &val); 881 + if (ret < 0) { 882 + dev_err(dev, "Error reading chip ID\n"); 883 + return ret; 884 + } 885 + 886 + if (val != BME680_CHIP_ID_VAL) { 887 + dev_err(dev, "Wrong chip ID, got %x expected %x\n", 888 + val, BME680_CHIP_ID_VAL); 889 + return -ENODEV; 890 + } 887 891 888 892 indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); 889 893 if (!indio_dev)
-21
drivers/iio/chemical/bme680_i2c.c
··· 23 23 { 24 24 struct regmap *regmap; 25 25 const char *name = NULL; 26 - unsigned int val; 27 - int ret; 28 26 29 27 regmap = devm_regmap_init_i2c(client, &bme680_regmap_config); 30 28 if (IS_ERR(regmap)) { 31 29 dev_err(&client->dev, "Failed to register i2c regmap %d\n", 32 30 (int)PTR_ERR(regmap)); 33 31 return PTR_ERR(regmap); 34 - } 35 - 36 - ret = regmap_write(regmap, BME680_REG_SOFT_RESET_I2C, 37 - BME680_CMD_SOFTRESET); 38 - if (ret < 0) { 39 - dev_err(&client->dev, "Failed to reset chip\n"); 40 - return ret; 41 - } 42 - 43 - ret = regmap_read(regmap, BME680_REG_CHIP_I2C_ID, &val); 44 - if (ret < 0) { 45 - dev_err(&client->dev, "Error reading I2C chip ID\n"); 46 - return ret; 47 - } 48 - 49 - if (val != BME680_CHIP_ID_VAL) { 50 - dev_err(&client->dev, "Wrong chip ID, got %x expected %x\n", 51 - val, BME680_CHIP_ID_VAL); 52 - return -ENODEV; 53 32 } 54 33 55 34 if (id)
+78 -37
drivers/iio/chemical/bme680_spi.c
··· 12 12 13 13 #include "bme680.h" 14 14 15 + struct bme680_spi_bus_context { 16 + struct spi_device *spi; 17 + u8 current_page; 18 + }; 19 + 20 + /* 21 + * In SPI mode there are only 7 address bits, a "page" register determines 22 + * which part of the 8-bit range is active. This function looks at the address 23 + * and writes the page selection bit if needed 24 + */ 25 + static int bme680_regmap_spi_select_page( 26 + struct bme680_spi_bus_context *ctx, u8 reg) 27 + { 28 + struct spi_device *spi = ctx->spi; 29 + int ret; 30 + u8 buf[2]; 31 + u8 page = (reg & 0x80) ? 0 : 1; /* Page "1" is low range */ 32 + 33 + if (page == ctx->current_page) 34 + return 0; 35 + 36 + /* 37 + * Data sheet claims we're only allowed to change bit 4, so we must do 38 + * a read-modify-write on each and every page select 39 + */ 40 + buf[0] = BME680_REG_STATUS; 41 + ret = spi_write_then_read(spi, buf, 1, buf + 1, 1); 42 + if (ret < 0) { 43 + dev_err(&spi->dev, "failed to set page %u\n", page); 44 + return ret; 45 + } 46 + 47 + buf[0] = BME680_REG_STATUS; 48 + if (page) 49 + buf[1] |= BME680_SPI_MEM_PAGE_BIT; 50 + else 51 + buf[1] &= ~BME680_SPI_MEM_PAGE_BIT; 52 + 53 + ret = spi_write(spi, buf, 2); 54 + if (ret < 0) { 55 + dev_err(&spi->dev, "failed to set page %u\n", page); 56 + return ret; 57 + } 58 + 59 + ctx->current_page = page; 60 + 61 + return 0; 62 + } 63 + 15 64 static int bme680_regmap_spi_write(void *context, const void *data, 16 65 size_t count) 17 66 { 18 - struct spi_device *spi = context; 67 + struct bme680_spi_bus_context *ctx = context; 68 + struct spi_device *spi = ctx->spi; 69 + int ret; 19 70 u8 buf[2]; 20 71 21 72 memcpy(buf, data, 2); 73 + 74 + ret = bme680_regmap_spi_select_page(ctx, buf[0]); 75 + if (ret) 76 + return ret; 77 + 22 78 /* 23 79 * The SPI register address (= full register address without bit 7) 24 80 * and the write command (bit7 = RW = '0') 25 81 */ 26 82 buf[0] &= ~0x80; 27 83 28 - return spi_write_then_read(spi, buf, 2, NULL, 0); 84 + return spi_write(spi, buf, 2); 29 85 } 30 86 31 87 static int bme680_regmap_spi_read(void *context, const void *reg, 32 88 size_t reg_size, void *val, size_t val_size) 33 89 { 34 - struct spi_device *spi = context; 90 + struct bme680_spi_bus_context *ctx = context; 91 + struct spi_device *spi = ctx->spi; 92 + int ret; 93 + u8 addr = *(const u8 *)reg; 35 94 36 - return spi_write_then_read(spi, reg, reg_size, val, val_size); 95 + ret = bme680_regmap_spi_select_page(ctx, addr); 96 + if (ret) 97 + return ret; 98 + 99 + addr |= 0x80; /* bit7 = RW = '1' */ 100 + 101 + return spi_write_then_read(spi, &addr, 1, val, val_size); 37 102 } 38 103 39 104 static struct regmap_bus bme680_regmap_bus = { ··· 111 46 static int bme680_spi_probe(struct spi_device *spi) 112 47 { 113 48 const struct spi_device_id *id = spi_get_device_id(spi); 49 + struct bme680_spi_bus_context *bus_context; 114 50 struct regmap *regmap; 115 - unsigned int val; 116 51 int ret; 117 52 118 53 spi->bits_per_word = 8; ··· 122 57 return ret; 123 58 } 124 59 60 + bus_context = devm_kzalloc(&spi->dev, sizeof(*bus_context), GFP_KERNEL); 61 + if (!bus_context) 62 + return -ENOMEM; 63 + 64 + bus_context->spi = spi; 65 + bus_context->current_page = 0xff; /* Undefined on warm boot */ 66 + 125 67 regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus, 126 - &spi->dev, &bme680_regmap_config); 68 + bus_context, &bme680_regmap_config); 127 69 if (IS_ERR(regmap)) { 128 70 dev_err(&spi->dev, "Failed to register spi regmap %d\n", 129 71 (int)PTR_ERR(regmap)); 130 72 return PTR_ERR(regmap); 131 - } 132 - 133 - ret = regmap_write(regmap, BME680_REG_SOFT_RESET_SPI, 134 - BME680_CMD_SOFTRESET); 135 - if (ret < 0) { 136 - dev_err(&spi->dev, "Failed to reset chip\n"); 137 - return ret; 138 - } 139 - 140 - /* after power-on reset, Page 0(0x80-0xFF) of spi_mem_page is active */ 141 - ret = regmap_read(regmap, BME680_REG_CHIP_SPI_ID, &val); 142 - if (ret < 0) { 143 - dev_err(&spi->dev, "Error reading SPI chip ID\n"); 144 - return ret; 145 - } 146 - 147 - if (val != BME680_CHIP_ID_VAL) { 148 - dev_err(&spi->dev, "Wrong chip ID, got %x expected %x\n", 149 - val, BME680_CHIP_ID_VAL); 150 - return -ENODEV; 151 - } 152 - /* 153 - * select Page 1 of spi_mem_page to enable access to 154 - * to registers from address 0x00 to 0x7F. 155 - */ 156 - ret = regmap_write_bits(regmap, BME680_REG_STATUS, 157 - BME680_SPI_MEM_PAGE_BIT, 158 - BME680_SPI_MEM_PAGE_1_VAL); 159 - if (ret < 0) { 160 - dev_err(&spi->dev, "failed to set page 1 of spi_mem_page\n"); 161 - return ret; 162 73 } 163 74 164 75 return bme680_core_probe(&spi->dev, regmap, id->name);
+4 -3
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
··· 103 103 * Do not use IIO_DEGREE_TO_RAD to avoid precision 104 104 * loss. Round to the nearest integer. 105 105 */ 106 - *val = div_s64(val64 * 314159 + 9000000ULL, 1000); 107 - *val2 = 18000 << (CROS_EC_SENSOR_BITS - 1); 108 - ret = IIO_VAL_FRACTIONAL; 106 + *val = 0; 107 + *val2 = div_s64(val64 * 3141592653ULL, 108 + 180 << (CROS_EC_SENSOR_BITS - 1)); 109 + ret = IIO_VAL_INT_PLUS_NANO; 109 110 break; 110 111 case MOTIONSENSE_TYPE_MAG: 111 112 /*
+1
drivers/iio/dac/mcp4725.c
··· 92 92 93 93 inoutbuf[0] = 0x60; /* write EEPROM */ 94 94 inoutbuf[0] |= data->ref_mode << 3; 95 + inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0; 95 96 inoutbuf[1] = data->dac_value >> 4; 96 97 inoutbuf[2] = (data->dac_value & 0xf) << 4; 97 98
+3 -3
drivers/iio/gyro/bmg160_core.c
··· 582 582 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: 583 583 return bmg160_get_filter(data, val); 584 584 case IIO_CHAN_INFO_SCALE: 585 - *val = 0; 586 585 switch (chan->type) { 587 586 case IIO_TEMP: 588 - *val2 = 500000; 589 - return IIO_VAL_INT_PLUS_MICRO; 587 + *val = 500; 588 + return IIO_VAL_INT; 590 589 case IIO_ANGL_VEL: 591 590 { 592 591 int i; ··· 593 594 for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { 594 595 if (bmg160_scale_table[i].dps_range == 595 596 data->dps_range) { 597 + *val = 0; 596 598 *val2 = bmg160_scale_table[i].scale; 597 599 return IIO_VAL_INT_PLUS_MICRO; 598 600 }
+5 -3
drivers/iio/gyro/mpu3050-core.c
··· 29 29 30 30 #include "mpu3050.h" 31 31 32 - #define MPU3050_CHIP_ID 0x69 32 + #define MPU3050_CHIP_ID 0x68 33 + #define MPU3050_CHIP_ID_MASK 0x7E 33 34 34 35 /* 35 36 * Register map: anything suffixed *_H is a big-endian high byte and always ··· 1177 1176 goto err_power_down; 1178 1177 } 1179 1178 1180 - if (val != MPU3050_CHIP_ID) { 1181 - dev_err(dev, "unsupported chip id %02x\n", (u8)val); 1179 + if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) { 1180 + dev_err(dev, "unsupported chip id %02x\n", 1181 + (u8)(val & MPU3050_CHIP_ID_MASK)); 1182 1182 ret = -ENODEV; 1183 1183 goto err_power_down; 1184 1184 }
+2 -3
drivers/iio/industrialio-buffer.c
··· 320 320 const unsigned long *mask; 321 321 unsigned long *trialmask; 322 322 323 - trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength), 324 - sizeof(*trialmask), 325 - GFP_KERNEL); 323 + trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength), 324 + sizeof(*trialmask), GFP_KERNEL); 326 325 if (trialmask == NULL) 327 326 return -ENOMEM; 328 327 if (!indio_dev->masklength) {
+2 -2
drivers/iio/industrialio-core.c
··· 1743 1743 **/ 1744 1744 void iio_device_unregister(struct iio_dev *indio_dev) 1745 1745 { 1746 - mutex_lock(&indio_dev->info_exist_lock); 1747 - 1748 1746 cdev_device_del(&indio_dev->chrdev, &indio_dev->dev); 1747 + 1748 + mutex_lock(&indio_dev->info_exist_lock); 1749 1749 1750 1750 iio_device_unregister_debugfs(indio_dev); 1751 1751
+3
drivers/infiniband/core/uverbs_main.c
··· 993 993 * will only be one mm, so no big deal. 994 994 */ 995 995 down_write(&mm->mmap_sem); 996 + if (!mmget_still_valid(mm)) 997 + goto skip_mm; 996 998 mutex_lock(&ufile->umap_lock); 997 999 list_for_each_entry_safe (priv, next_priv, &ufile->umaps, 998 1000 list) { ··· 1009 1007 vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); 1010 1008 } 1011 1009 mutex_unlock(&ufile->umap_lock); 1010 + skip_mm: 1012 1011 up_write(&mm->mmap_sem); 1013 1012 mmput(mm); 1014 1013 }
+3 -3
drivers/input/keyboard/snvs_pwrkey.c
··· 148 148 return error; 149 149 } 150 150 151 + pdata->input = input; 152 + platform_set_drvdata(pdev, pdata); 153 + 151 154 error = devm_request_irq(&pdev->dev, pdata->irq, 152 155 imx_snvs_pwrkey_interrupt, 153 156 0, pdev->name, pdev); ··· 165 162 dev_err(&pdev->dev, "failed to register input device\n"); 166 163 return error; 167 164 } 168 - 169 - pdata->input = input; 170 - platform_set_drvdata(pdev, pdata); 171 165 172 166 device_init_wakeup(&pdev->dev, pdata->wakeup); 173 167
+25
drivers/input/mouse/elan_i2c_core.c
··· 1339 1339 { "ELAN0600", 0 }, 1340 1340 { "ELAN0601", 0 }, 1341 1341 { "ELAN0602", 0 }, 1342 + { "ELAN0603", 0 }, 1343 + { "ELAN0604", 0 }, 1342 1344 { "ELAN0605", 0 }, 1345 + { "ELAN0606", 0 }, 1346 + { "ELAN0607", 0 }, 1343 1347 { "ELAN0608", 0 }, 1344 1348 { "ELAN0609", 0 }, 1345 1349 { "ELAN060B", 0 }, 1346 1350 { "ELAN060C", 0 }, 1351 + { "ELAN060F", 0 }, 1352 + { "ELAN0610", 0 }, 1347 1353 { "ELAN0611", 0 }, 1348 1354 { "ELAN0612", 0 }, 1355 + { "ELAN0615", 0 }, 1356 + { "ELAN0616", 0 }, 1349 1357 { "ELAN0617", 0 }, 1350 1358 { "ELAN0618", 0 }, 1359 + { "ELAN0619", 0 }, 1360 + { "ELAN061A", 0 }, 1361 + { "ELAN061B", 0 }, 1351 1362 { "ELAN061C", 0 }, 1352 1363 { "ELAN061D", 0 }, 1353 1364 { "ELAN061E", 0 }, 1365 + { "ELAN061F", 0 }, 1354 1366 { "ELAN0620", 0 }, 1355 1367 { "ELAN0621", 0 }, 1356 1368 { "ELAN0622", 0 }, 1369 + { "ELAN0623", 0 }, 1370 + { "ELAN0624", 0 }, 1371 + { "ELAN0625", 0 }, 1372 + { "ELAN0626", 0 }, 1373 + { "ELAN0627", 0 }, 1374 + { "ELAN0628", 0 }, 1375 + { "ELAN0629", 0 }, 1376 + { "ELAN062A", 0 }, 1377 + { "ELAN062B", 0 }, 1378 + { "ELAN062C", 0 }, 1379 + { "ELAN062D", 0 }, 1380 + { "ELAN0631", 0 }, 1381 + { "ELAN0632", 0 }, 1357 1382 { "ELAN1000", 0 }, 1358 1383 { } 1359 1384 };
+11
drivers/irqchip/irq-ath79-misc.c
··· 22 22 #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 23 23 24 24 #define ATH79_MISC_IRQ_COUNT 32 25 + #define ATH79_MISC_PERF_IRQ 5 26 + 27 + static int ath79_perfcount_irq; 28 + 29 + int get_c0_perfcount_int(void) 30 + { 31 + return ath79_perfcount_irq; 32 + } 33 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 25 34 26 35 static void ath79_misc_irq_handler(struct irq_desc *desc) 27 36 { ··· 121 112 struct irq_domain *domain, int irq) 122 113 { 123 114 void __iomem *base = domain->host_data; 115 + 116 + ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); 124 117 125 118 /* Disable and clear all interrupts */ 126 119 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
+6 -1
drivers/misc/fastrpc.c
··· 1184 1184 struct fastrpc_session_ctx *sess; 1185 1185 struct device *dev = &pdev->dev; 1186 1186 int i, sessions = 0; 1187 + int rc; 1187 1188 1188 1189 cctx = dev_get_drvdata(dev->parent); 1189 1190 if (!cctx) ··· 1214 1213 } 1215 1214 cctx->sesscount++; 1216 1215 spin_unlock(&cctx->lock); 1217 - dma_set_mask(dev, DMA_BIT_MASK(32)); 1216 + rc = dma_set_mask(dev, DMA_BIT_MASK(32)); 1217 + if (rc) { 1218 + dev_err(dev, "32-bit DMA enable failed\n"); 1219 + return rc; 1220 + } 1218 1221 1219 1222 return 0; 1220 1223 }
+4 -5
drivers/misc/habanalabs/goya/goya.c
··· 1688 1688 1689 1689 /* 1690 1690 * Workaround for H2 #HW-23 bug 1691 - * Set DMA max outstanding read requests to 240 on DMA CH 1. Set it 1692 - * to 16 on KMD DMA 1693 - * We need to limit only these DMAs because the user can only read 1691 + * Set DMA max outstanding read requests to 240 on DMA CH 1. 1692 + * This limitation is still large enough to not affect Gen4 bandwidth. 1693 + * We need to only limit that DMA channel because the user can only read 1694 1694 * from Host using DMA CH 1 1695 1695 */ 1696 - WREG32(mmDMA_CH_0_CFG0, 0x0fff0010); 1697 1696 WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0); 1698 1697 1699 1698 goya->hw_cap_initialized |= HW_CAP_GOLDEN; ··· 3692 3693 * WA for HW-23. 3693 3694 * We can't allow user to read from Host using QMANs other than 1. 3694 3695 */ 3695 - if (parser->hw_queue_id > GOYA_QUEUE_ID_DMA_1 && 3696 + if (parser->hw_queue_id != GOYA_QUEUE_ID_DMA_1 && 3696 3697 hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr), 3697 3698 le32_to_cpu(user_dma_pkt->tsize), 3698 3699 hdev->asic_prop.va_space_host_start_address,
+2 -2
drivers/net/ethernet/atheros/atlx/atl1.c
··· 1721 1721 adapter->soft_stats.scc += smb->tx_1_col; 1722 1722 adapter->soft_stats.mcc += smb->tx_2_col; 1723 1723 adapter->soft_stats.latecol += smb->tx_late_col; 1724 - adapter->soft_stats.tx_underun += smb->tx_underrun; 1724 + adapter->soft_stats.tx_underrun += smb->tx_underrun; 1725 1725 adapter->soft_stats.tx_trunc += smb->tx_trunc; 1726 1726 adapter->soft_stats.tx_pause += smb->tx_pause; 1727 1727 ··· 3179 3179 {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, 3180 3180 {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, 3181 3181 {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, 3182 - {"tx_underun", ATL1_STAT(soft_stats.tx_underun)}, 3182 + {"tx_underrun", ATL1_STAT(soft_stats.tx_underrun)}, 3183 3183 {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, 3184 3184 {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, 3185 3185 {"rx_pause", ATL1_STAT(soft_stats.rx_pause)},
+1 -1
drivers/net/ethernet/atheros/atlx/atl1.h
··· 681 681 u64 scc; /* packets TX after a single collision */ 682 682 u64 mcc; /* packets TX after multiple collisions */ 683 683 u64 latecol; /* TX packets w/ late collisions */ 684 - u64 tx_underun; /* TX packets aborted due to TX FIFO underrun 684 + u64 tx_underrun; /* TX packets aborted due to TX FIFO underrun 685 685 * or TRD FIFO underrun */ 686 686 u64 tx_trunc; /* TX packets truncated due to size > MTU */ 687 687 u64 rx_pause; /* num Pause packets received. */
+1 -1
drivers/net/ethernet/atheros/atlx/atl2.c
··· 553 553 netdev->stats.tx_aborted_errors++; 554 554 if (txs->late_col) 555 555 netdev->stats.tx_window_errors++; 556 - if (txs->underun) 556 + if (txs->underrun) 557 557 netdev->stats.tx_fifo_errors++; 558 558 } while (1); 559 559
+1 -1
drivers/net/ethernet/atheros/atlx/atl2.h
··· 260 260 unsigned multi_col:1; 261 261 unsigned late_col:1; 262 262 unsigned abort_col:1; 263 - unsigned underun:1; /* current packet is aborted 263 + unsigned underrun:1; /* current packet is aborted 264 264 * due to txram underrun */ 265 265 unsigned:3; /* reserved */ 266 266 unsigned update:1; /* always 1'b1 in tx_status_buf */
+22 -2
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
··· 33 33 #include <linux/bpf_trace.h> 34 34 #include "en/xdp.h" 35 35 36 + int mlx5e_xdp_max_mtu(struct mlx5e_params *params) 37 + { 38 + int hr = NET_IP_ALIGN + XDP_PACKET_HEADROOM; 39 + 40 + /* Let S := SKB_DATA_ALIGN(sizeof(struct skb_shared_info)). 41 + * The condition checked in mlx5e_rx_is_linear_skb is: 42 + * SKB_DATA_ALIGN(sw_mtu + hard_mtu + hr) + S <= PAGE_SIZE (1) 43 + * (Note that hw_mtu == sw_mtu + hard_mtu.) 44 + * What is returned from this function is: 45 + * max_mtu = PAGE_SIZE - S - hr - hard_mtu (2) 46 + * After assigning sw_mtu := max_mtu, the left side of (1) turns to 47 + * SKB_DATA_ALIGN(PAGE_SIZE - S) + S, which is equal to PAGE_SIZE, 48 + * because both PAGE_SIZE and S are already aligned. Any number greater 49 + * than max_mtu would make the left side of (1) greater than PAGE_SIZE, 50 + * so max_mtu is the maximum MTU allowed. 51 + */ 52 + 53 + return MLX5E_HW2SW_MTU(params, SKB_MAX_HEAD(hr)); 54 + } 55 + 36 56 static inline bool 37 57 mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di, 38 58 struct xdp_buff *xdp) ··· 330 310 mlx5e_xdpi_fifo_pop(xdpi_fifo); 331 311 332 312 if (is_redirect) { 333 - xdp_return_frame(xdpi.xdpf); 334 313 dma_unmap_single(sq->pdev, xdpi.dma_addr, 335 314 xdpi.xdpf->len, DMA_TO_DEVICE); 315 + xdp_return_frame(xdpi.xdpf); 336 316 } else { 337 317 /* Recycle RX page */ 338 318 mlx5e_page_release(rq, &xdpi.di, true); ··· 371 351 mlx5e_xdpi_fifo_pop(xdpi_fifo); 372 352 373 353 if (is_redirect) { 374 - xdp_return_frame(xdpi.xdpf); 375 354 dma_unmap_single(sq->pdev, xdpi.dma_addr, 376 355 xdpi.xdpf->len, DMA_TO_DEVICE); 356 + xdp_return_frame(xdpi.xdpf); 377 357 } else { 378 358 /* Recycle RX page */ 379 359 mlx5e_page_release(rq, &xdpi.di, false);
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h
··· 34 34 35 35 #include "en.h" 36 36 37 - #define MLX5E_XDP_MAX_MTU ((int)(PAGE_SIZE - \ 38 - MLX5_SKB_FRAG_SZ(XDP_PACKET_HEADROOM))) 39 37 #define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN) 40 38 #define MLX5E_XDP_TX_EMPTY_DS_COUNT \ 41 39 (sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) 42 40 #define MLX5E_XDP_TX_DS_COUNT (MLX5E_XDP_TX_EMPTY_DS_COUNT + 1 /* SG DS */) 43 41 42 + int mlx5e_xdp_max_mtu(struct mlx5e_params *params); 44 43 bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, 45 44 void *va, u16 *rx_headroom, u32 *len); 46 45 bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 1586 1586 break; 1587 1587 case MLX5_MODULE_ID_SFP: 1588 1588 modinfo->type = ETH_MODULE_SFF_8472; 1589 - modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; 1589 + modinfo->eeprom_len = MLX5_EEPROM_PAGE_LENGTH; 1590 1590 break; 1591 1591 default: 1592 1592 netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n",
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3720 3720 if (params->xdp_prog && 3721 3721 !mlx5e_rx_is_linear_skb(&new_channels.params)) { 3722 3722 netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n", 3723 - new_mtu, MLX5E_XDP_MAX_MTU); 3723 + new_mtu, mlx5e_xdp_max_mtu(params)); 3724 3724 err = -EINVAL; 3725 3725 goto out; 3726 3726 } ··· 4161 4161 4162 4162 if (!mlx5e_rx_is_linear_skb(&new_channels.params)) { 4163 4163 netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n", 4164 - new_channels.params.sw_mtu, MLX5E_XDP_MAX_MTU); 4164 + new_channels.params.sw_mtu, 4165 + mlx5e_xdp_max_mtu(&new_channels.params)); 4165 4166 return -EINVAL; 4166 4167 } 4167 4168
-4
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 317 317 size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; 318 318 319 319 i2c_addr = MLX5_I2C_ADDR_LOW; 320 - if (offset >= MLX5_EEPROM_PAGE_LENGTH) { 321 - i2c_addr = MLX5_I2C_ADDR_HIGH; 322 - offset -= MLX5_EEPROM_PAGE_LENGTH; 323 - } 324 320 325 321 MLX5_SET(mcia_reg, in, l, 0); 326 322 MLX5_SET(mcia_reg, in, module, module_num);
+1 -1
drivers/net/ethernet/mellanox/mlxsw/pci_hw.h
··· 27 27 28 28 #define MLXSW_PCI_SW_RESET 0xF0010 29 29 #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) 30 - #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 13000 30 + #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 20000 31 31 #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 32 32 #define MLXSW_PCI_FW_READY 0xA1844 33 33 #define MLXSW_PCI_FW_READY_MASK 0xFFFF
+3 -3
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 3113 3113 if (err) 3114 3114 return err; 3115 3115 3116 + mlxsw_sp_port->link.autoneg = autoneg; 3117 + 3116 3118 if (!netif_running(dev)) 3117 3119 return 0; 3118 - 3119 - mlxsw_sp_port->link.autoneg = autoneg; 3120 3120 3121 3121 mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); 3122 3122 mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); ··· 3303 3303 err = mlxsw_sp_port_ets_set(mlxsw_sp_port, 3304 3304 MLXSW_REG_QEEC_HIERARCY_TC, 3305 3305 i + 8, i, 3306 - false, 0); 3306 + true, 100); 3307 3307 if (err) 3308 3308 return err; 3309 3309 }
+2 -2
drivers/net/ethernet/netronome/nfp/abm/cls.c
··· 39 39 } 40 40 if (knode->sel->off || knode->sel->offshift || knode->sel->offmask || 41 41 knode->sel->offoff || knode->fshift) { 42 - NL_SET_ERR_MSG_MOD(extack, "variable offseting not supported"); 42 + NL_SET_ERR_MSG_MOD(extack, "variable offsetting not supported"); 43 43 return false; 44 44 } 45 45 if (knode->sel->hoff || knode->sel->hmask) { ··· 78 78 79 79 k = &knode->sel->keys[0]; 80 80 if (k->offmask) { 81 - NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offseting not supported"); 81 + NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offsetting not supported"); 82 82 return false; 83 83 } 84 84 if (k->off) {
+7 -4
drivers/net/ethernet/socionext/netsec.c
··· 673 673 } 674 674 675 675 static void *netsec_alloc_rx_data(struct netsec_priv *priv, 676 - dma_addr_t *dma_handle, u16 *desc_len) 676 + dma_addr_t *dma_handle, u16 *desc_len, 677 + bool napi) 677 678 { 678 679 size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 679 680 size_t payload_len = NETSEC_RX_BUF_SZ; ··· 683 682 684 683 total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); 685 684 686 - buf = napi_alloc_frag(total_len); 685 + buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len); 687 686 if (!buf) 688 687 return NULL; 689 688 ··· 766 765 /* allocate a fresh buffer and map it to the hardware. 767 766 * This will eventually replace the old buffer in the hardware 768 767 */ 769 - buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len); 768 + buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len, 769 + true); 770 770 if (unlikely(!buf_addr)) 771 771 break; 772 772 ··· 1071 1069 void *buf; 1072 1070 u16 len; 1073 1071 1074 - buf = netsec_alloc_rx_data(priv, &dma_handle, &len); 1072 + buf = netsec_alloc_rx_data(priv, &dma_handle, &len, 1073 + false); 1075 1074 if (!buf) { 1076 1075 netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); 1077 1076 goto err_out;
+1 -1
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
··· 140 140 p->des0 |= cpu_to_le32(RDES0_OWN); 141 141 142 142 bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); 143 - p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK); 143 + p->des1 |= cpu_to_le32(bfsize1 & RDES1_BUFFER1_SIZE_MASK); 144 144 145 145 if (mode == STMMAC_CHAIN_MODE) 146 146 ndesc_rx_set_on_chain(p, end);
+2 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2616 2616 u32 chan; 2617 2617 int ret; 2618 2618 2619 - stmmac_check_ether_addr(priv); 2620 - 2621 2619 if (priv->hw->pcs != STMMAC_PCS_RGMII && 2622 2620 priv->hw->pcs != STMMAC_PCS_TBI && 2623 2621 priv->hw->pcs != STMMAC_PCS_RTBI) { ··· 4300 4302 ret = stmmac_hw_init(priv); 4301 4303 if (ret) 4302 4304 goto error_hw_init; 4305 + 4306 + stmmac_check_ether_addr(priv); 4303 4307 4304 4308 /* Configure real RX and TX queues */ 4305 4309 netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use);
+6 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
··· 159 159 }, 160 160 .driver_data = (void *)&galileo_stmmac_dmi_data, 161 161 }, 162 + /* 163 + * There are 2 types of SIMATIC IOT2000: IOT20202 and IOT2040. 164 + * The asset tag "6ES7647-0AA00-0YA2" is only for IOT2020 which 165 + * has only one pci network device while other asset tags are 166 + * for IOT2040 which has two. 167 + */ 162 168 { 163 169 .matches = { 164 170 DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), ··· 176 170 { 177 171 .matches = { 178 172 DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 179 - DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 180 - "6ES7647-0AA00-1YA2"), 181 173 }, 182 174 .driver_data = (void *)&iot2040_stmmac_dmi_data, 183 175 },
+9
drivers/net/phy/spi_ks8995.c
··· 159 159 }; 160 160 MODULE_DEVICE_TABLE(spi, ks8995_id); 161 161 162 + static const struct of_device_id ks8895_spi_of_match[] = { 163 + { .compatible = "micrel,ks8995" }, 164 + { .compatible = "micrel,ksz8864" }, 165 + { .compatible = "micrel,ksz8795" }, 166 + { }, 167 + }; 168 + MODULE_DEVICE_TABLE(of, ks8895_spi_of_match); 169 + 162 170 static inline u8 get_chip_id(u8 val) 163 171 { 164 172 return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; ··· 534 526 static struct spi_driver ks8995_driver = { 535 527 .driver = { 536 528 .name = "spi-ks8995", 529 + .of_match_table = of_match_ptr(ks8895_spi_of_match), 537 530 }, 538 531 .probe = ks8995_probe, 539 532 .remove = ks8995_remove,
+7
drivers/net/team/team.c
··· 1154 1154 return -EINVAL; 1155 1155 } 1156 1156 1157 + if (netdev_has_upper_dev(dev, port_dev)) { 1158 + NL_SET_ERR_MSG(extack, "Device is already an upper device of the team interface"); 1159 + netdev_err(dev, "Device %s is already an upper device of the team interface\n", 1160 + portname); 1161 + return -EBUSY; 1162 + } 1163 + 1157 1164 if (port_dev->features & NETIF_F_VLAN_CHALLENGED && 1158 1165 vlan_uses_dev(dev)) { 1159 1166 NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up");
+2
drivers/net/vrf.c
··· 873 873 .ndo_init = vrf_dev_init, 874 874 .ndo_uninit = vrf_dev_uninit, 875 875 .ndo_start_xmit = vrf_xmit, 876 + .ndo_set_mac_address = eth_mac_addr, 876 877 .ndo_get_stats64 = vrf_get_stats64, 877 878 .ndo_add_slave = vrf_add_slave, 878 879 .ndo_del_slave = vrf_del_slave, ··· 1273 1272 /* default to no qdisc; user can add if desired */ 1274 1273 dev->priv_flags |= IFF_NO_QUEUE; 1275 1274 dev->priv_flags |= IFF_NO_RX_HANDLER; 1275 + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 1276 1276 1277 1277 /* VRF devices do not care about MTU, but if the MTU is set 1278 1278 * too low then the ipv4 and ipv6 protocols are disabled
+7
drivers/nfc/st95hf/core.c
··· 1074 1074 }; 1075 1075 MODULE_DEVICE_TABLE(spi, st95hf_id); 1076 1076 1077 + static const struct of_device_id st95hf_spi_of_match[] = { 1078 + { .compatible = "st,st95hf" }, 1079 + { }, 1080 + }; 1081 + MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); 1082 + 1077 1083 static int st95hf_probe(struct spi_device *nfc_spi_dev) 1078 1084 { 1079 1085 int ret; ··· 1266 1260 .driver = { 1267 1261 .name = "st95hf", 1268 1262 .owner = THIS_MODULE, 1263 + .of_match_table = of_match_ptr(st95hf_spi_of_match), 1269 1264 }, 1270 1265 .id_table = st95hf_id, 1271 1266 .probe = st95hf_probe,
-1
drivers/of/of_net.c
··· 7 7 */ 8 8 #include <linux/etherdevice.h> 9 9 #include <linux/kernel.h> 10 - #include <linux/nvmem-consumer.h> 11 10 #include <linux/of_net.h> 12 11 #include <linux/phy.h> 13 12 #include <linux/export.h>
+1 -1
drivers/power/supply/goldfish_battery.c
··· 1 - // SPDX-License-Identifier: GPL 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 * Power supply driver for the goldfish emulator 4 4 *
+3 -3
drivers/s390/block/dasd_eckd.c
··· 2004 2004 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); 2005 2005 2006 2006 raw: 2007 - block->blocks = (private->real_cyl * 2007 + block->blocks = ((unsigned long) private->real_cyl * 2008 2008 private->rdc_data.trk_per_cyl * 2009 2009 blk_per_trk); 2010 2010 2011 2011 dev_info(&device->cdev->dev, 2012 - "DASD with %d KB/block, %d KB total size, %d KB/track, " 2012 + "DASD with %u KB/block, %lu KB total size, %u KB/track, " 2013 2013 "%s\n", (block->bp_block >> 10), 2014 - ((private->real_cyl * 2014 + (((unsigned long) private->real_cyl * 2015 2015 private->rdc_data.trk_per_cyl * 2016 2016 blk_per_trk * (block->bp_block >> 9)) >> 1), 2017 2017 ((blk_per_trk * block->bp_block) >> 10),
+1 -1
drivers/s390/char/con3270.c
··· 629 629 (void (*)(unsigned long)) con3270_read_tasklet, 630 630 (unsigned long) condev->read); 631 631 632 - raw3270_add_view(&condev->view, &con3270_fn, 1); 632 + raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ); 633 633 634 634 INIT_LIST_HEAD(&condev->freemem); 635 635 for (i = 0; i < CON3270_STRING_PAGES; i++) {
+2 -1
drivers/s390/char/fs3270.c
··· 463 463 464 464 init_waitqueue_head(&fp->wait); 465 465 fp->fs_pid = get_pid(task_pid(current)); 466 - rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); 466 + rc = raw3270_add_view(&fp->view, &fs3270_fn, minor, 467 + RAW3270_VIEW_LOCK_BH); 467 468 if (rc) { 468 469 fs3270_free_view(&fp->view); 469 470 goto out;
+2 -1
drivers/s390/char/raw3270.c
··· 920 920 * Add view to device with minor "minor". 921 921 */ 922 922 int 923 - raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) 923 + raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, int subclass) 924 924 { 925 925 unsigned long flags; 926 926 struct raw3270 *rp; ··· 942 942 view->cols = rp->cols; 943 943 view->ascebc = rp->ascebc; 944 944 spin_lock_init(&view->lock); 945 + lockdep_set_subclass(&view->lock, subclass); 945 946 list_add(&view->list, &rp->view_list); 946 947 rc = 0; 947 948 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
+3 -1
drivers/s390/char/raw3270.h
··· 150 150 struct raw3270_view { 151 151 struct list_head list; 152 152 spinlock_t lock; 153 + #define RAW3270_VIEW_LOCK_IRQ 0 154 + #define RAW3270_VIEW_LOCK_BH 1 153 155 atomic_t ref_count; 154 156 struct raw3270 *dev; 155 157 struct raw3270_fn *fn; ··· 160 158 unsigned char *ascebc; /* ascii -> ebcdic table */ 161 159 }; 162 160 163 - int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int); 161 + int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int); 164 162 int raw3270_activate_view(struct raw3270_view *); 165 163 void raw3270_del_view(struct raw3270_view *); 166 164 void raw3270_deactivate_view(struct raw3270_view *);
+2 -1
drivers/s390/char/tty3270.c
··· 980 980 return PTR_ERR(tp); 981 981 982 982 rc = raw3270_add_view(&tp->view, &tty3270_fn, 983 - tty->index + RAW3270_FIRSTMINOR); 983 + tty->index + RAW3270_FIRSTMINOR, 984 + RAW3270_VIEW_LOCK_BH); 984 985 if (rc) { 985 986 tty3270_free_view(tp); 986 987 return rc;
+1 -1
drivers/s390/crypto/ap_queue.c
··· 751 751 __ap_flush_queue(aq); 752 752 /* set REMOVE state to prevent new messages are queued in */ 753 753 aq->state = AP_STATE_REMOVE; 754 - del_timer_sync(&aq->timeout); 755 754 spin_unlock_bh(&aq->lock); 755 + del_timer_sync(&aq->timeout); 756 756 } 757 757 758 758 void ap_queue_remove(struct ap_queue *aq)
+2 -1
drivers/s390/crypto/pkey_api.c
··· 51 51 52 52 static void __init pkey_debug_init(void) 53 53 { 54 - debug_info = debug_register("pkey", 1, 1, 4 * sizeof(long)); 54 + /* 5 arguments per dbf entry (including the format string ptr) */ 55 + debug_info = debug_register("pkey", 1, 1, 5 * sizeof(long)); 55 56 debug_register_view(debug_info, &debug_sprintf_view); 56 57 debug_set_level(debug_info, 3); 57 58 }
+1
drivers/s390/net/ctcm_main.c
··· 1595 1595 if (priv->channel[direction] == NULL) { 1596 1596 if (direction == CTCM_WRITE) 1597 1597 channel_free(priv->channel[CTCM_READ]); 1598 + result = -ENODEV; 1598 1599 goto out_dev; 1599 1600 } 1600 1601 priv->channel[direction]->netdev = dev;
+1
drivers/scsi/aic7xxx/aic7770_osm.c
··· 91 91 ahc = ahc_alloc(&aic7xxx_driver_template, name); 92 92 if (ahc == NULL) 93 93 return (ENOMEM); 94 + ahc->dev = dev; 94 95 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, 95 96 eisaBase); 96 97 if (error != 0) {
+1
drivers/scsi/aic7xxx/aic7xxx.h
··· 943 943 * Platform specific device information. 944 944 */ 945 945 ahc_dev_softc_t dev_softc; 946 + struct device *dev; 946 947 947 948 /* 948 949 * Bus specific device information.
+4 -6
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 860 860 ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, 861 861 int flags, bus_dmamap_t *mapp) 862 862 { 863 - *vaddr = pci_alloc_consistent(ahc->dev_softc, 864 - dmat->maxsize, mapp); 863 + /* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */ 864 + *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC); 865 865 if (*vaddr == NULL) 866 866 return ENOMEM; 867 867 return 0; ··· 871 871 ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, 872 872 void* vaddr, bus_dmamap_t map) 873 873 { 874 - pci_free_consistent(ahc->dev_softc, dmat->maxsize, 875 - vaddr, map); 874 + dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map); 876 875 } 877 876 878 877 int ··· 1122 1123 1123 1124 host->transportt = ahc_linux_transport_template; 1124 1125 1125 - retval = scsi_add_host(host, 1126 - (ahc->dev_softc ? &ahc->dev_softc->dev : NULL)); 1126 + retval = scsi_add_host(host, ahc->dev); 1127 1127 if (retval) { 1128 1128 printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); 1129 1129 scsi_host_put(host);
+1
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
··· 250 250 } 251 251 } 252 252 ahc->dev_softc = pci; 253 + ahc->dev = &pci->dev; 253 254 error = ahc_pci_config(ahc, entry); 254 255 if (error != 0) { 255 256 ahc_free(ahc);
-1
drivers/scsi/libfc/fc_rport.c
··· 2162 2162 FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", 2163 2163 fc_rport_state(rdata)); 2164 2164 2165 - rdata->flags &= ~FC_RP_STARTED; 2166 2165 fc_rport_enter_delete(rdata, RPORT_EV_STOP); 2167 2166 mutex_unlock(&rdata->rp_mutex); 2168 2167 kref_put(&rdata->kref, fc_rport_destroy);
+5 -1
drivers/scsi/scsi_lib.c
··· 1706 1706 ret = BLK_STS_DEV_RESOURCE; 1707 1707 break; 1708 1708 default: 1709 + if (unlikely(!scsi_device_online(sdev))) 1710 + scsi_req(req)->result = DID_NO_CONNECT << 16; 1711 + else 1712 + scsi_req(req)->result = DID_ERROR << 16; 1709 1713 /* 1710 - * Make sure to release all allocated ressources when 1714 + * Make sure to release all allocated resources when 1711 1715 * we hit an error, as we will never see this command 1712 1716 * again. 1713 1717 */
+4 -6
drivers/staging/comedi/drivers/ni_usb6501.c
··· 463 463 464 464 size = usb_endpoint_maxp(devpriv->ep_tx); 465 465 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); 466 - if (!devpriv->usb_tx_buf) { 467 - kfree(devpriv->usb_rx_buf); 466 + if (!devpriv->usb_tx_buf) 468 467 return -ENOMEM; 469 - } 470 468 471 469 return 0; 472 470 } ··· 516 518 if (!devpriv) 517 519 return -ENOMEM; 518 520 521 + mutex_init(&devpriv->mut); 522 + usb_set_intfdata(intf, devpriv); 523 + 519 524 ret = ni6501_find_endpoints(dev); 520 525 if (ret) 521 526 return ret; ··· 526 525 ret = ni6501_alloc_usb_buffers(dev); 527 526 if (ret) 528 527 return ret; 529 - 530 - mutex_init(&devpriv->mut); 531 - usb_set_intfdata(intf, devpriv); 532 528 533 529 ret = comedi_alloc_subdevices(dev, 2); 534 530 if (ret)
+3 -5
drivers/staging/comedi/drivers/vmk80xx.c
··· 682 682 683 683 size = usb_endpoint_maxp(devpriv->ep_tx); 684 684 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); 685 - if (!devpriv->usb_tx_buf) { 686 - kfree(devpriv->usb_rx_buf); 685 + if (!devpriv->usb_tx_buf) 687 686 return -ENOMEM; 688 - } 689 687 690 688 return 0; 691 689 } ··· 798 800 799 801 devpriv->model = board->model; 800 802 803 + sema_init(&devpriv->limit_sem, 8); 804 + 801 805 ret = vmk80xx_find_usb_endpoints(dev); 802 806 if (ret) 803 807 return ret; ··· 807 807 ret = vmk80xx_alloc_usb_buffers(dev); 808 808 if (ret) 809 809 return ret; 810 - 811 - sema_init(&devpriv->limit_sem, 8); 812 810 813 811 usb_set_intfdata(intf, devpriv); 814 812
+1 -1
drivers/staging/erofs/data.c
··· 298 298 *last_block = current_block; 299 299 300 300 /* shift in advance in case of it followed by too many gaps */ 301 - if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) { 301 + if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) { 302 302 /* err should reassign to 0 after submitting */ 303 303 err = 0; 304 304 goto submit_bio_out;
+4 -4
drivers/staging/iio/adc/ad7192.c
··· 109 109 #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ 110 110 #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ 111 111 112 - #define AD7193_CH_AIN1P_AIN2M 0x000 /* AIN1(+) - AIN2(-) */ 113 - #define AD7193_CH_AIN3P_AIN4M 0x001 /* AIN3(+) - AIN4(-) */ 114 - #define AD7193_CH_AIN5P_AIN6M 0x002 /* AIN5(+) - AIN6(-) */ 115 - #define AD7193_CH_AIN7P_AIN8M 0x004 /* AIN7(+) - AIN8(-) */ 112 + #define AD7193_CH_AIN1P_AIN2M 0x001 /* AIN1(+) - AIN2(-) */ 113 + #define AD7193_CH_AIN3P_AIN4M 0x002 /* AIN3(+) - AIN4(-) */ 114 + #define AD7193_CH_AIN5P_AIN6M 0x004 /* AIN5(+) - AIN6(-) */ 115 + #define AD7193_CH_AIN7P_AIN8M 0x008 /* AIN7(+) - AIN8(-) */ 116 116 #define AD7193_CH_TEMP 0x100 /* Temp senseor */ 117 117 #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ 118 118 #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */
+1 -1
drivers/staging/iio/meter/ade7854.c
··· 269 269 static IIO_DEV_ATTR_IPEAK(0644, 270 270 ade7854_read_32bit, 271 271 ade7854_write_32bit, 272 - ADE7854_VPEAK); 272 + ADE7854_IPEAK); 273 273 static IIO_DEV_ATTR_APHCAL(0644, 274 274 ade7854_read_16bit, 275 275 ade7854_write_16bit,
+1 -1
drivers/staging/most/core.c
··· 1431 1431 1432 1432 INIT_LIST_HEAD(&iface->p->channel_list); 1433 1433 iface->p->dev_id = id; 1434 - snprintf(iface->p->name, STRING_SIZE, "mdev%d", id); 1434 + strcpy(iface->p->name, iface->description); 1435 1435 iface->dev.init_name = iface->p->name; 1436 1436 iface->dev.bus = &mc.bus; 1437 1437 iface->dev.parent = &mc.dev;
+3 -1
drivers/tty/serial/sc16is7xx.c
··· 1520 1520 #endif 1521 1521 return ret; 1522 1522 1523 + #ifdef CONFIG_SERIAL_SC16IS7XX_SPI 1523 1524 err_spi: 1525 + #endif 1524 1526 #ifdef CONFIG_SERIAL_SC16IS7XX_I2C 1525 1527 i2c_del_driver(&sc16is7xx_i2c_uart_driver); 1526 - #endif 1527 1528 err_i2c: 1529 + #endif 1528 1530 uart_unregister_driver(&sc16is7xx_uart); 1529 1531 return ret; 1530 1532 }
+4 -2
drivers/tty/serial/sh-sci.c
··· 2512 2512 * center of the last stop bit in sampling clocks. 2513 2513 */ 2514 2514 int last_stop = bits * 2 - 1; 2515 - int deviation = min_err * srr * last_stop / 2 / baud; 2515 + int deviation = DIV_ROUND_CLOSEST(min_err * last_stop * 2516 + (int)(srr + 1), 2517 + 2 * (int)baud); 2516 2518 2517 2519 if (abs(deviation) >= 2) { 2518 2520 /* At least two sampling clocks off at the 2519 2521 * last stop bit; we can increase the error 2520 2522 * margin by shifting the sampling point. 2521 2523 */ 2522 - int shift = min(-8, max(7, deviation / 2)); 2524 + int shift = clamp(deviation / 2, -8, 7); 2523 2525 2524 2526 hssrr |= (shift << HSCIF_SRHP_SHIFT) & 2525 2527 HSCIF_SRHP_MASK;
+2 -1
drivers/tty/vt/vt.c
··· 1520 1520 return; 1521 1521 } 1522 1522 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); 1523 - update_region(vc, (unsigned long) start, count); 1523 + if (con_should_update(vc)) 1524 + do_update_region(vc, (unsigned long) start, count); 1524 1525 vc->vc_need_wrap = 0; 1525 1526 } 1526 1527
+1 -2
fs/afs/callback.c
··· 203 203 */ 204 204 void afs_init_callback_state(struct afs_server *server) 205 205 { 206 - if (!test_and_clear_bit(AFS_SERVER_FL_NEW, &server->flags)) 207 - server->cb_s_break++; 206 + server->cb_s_break++; 208 207 } 209 208 210 209 /*
+1 -1
fs/afs/cmservice.c
··· 34 34 static int afs_deliver_yfs_cb_callback(struct afs_call *); 35 35 36 36 #define CM_NAME(name) \ 37 - const char afs_SRXCB##name##_name[] __tracepoint_string = \ 37 + char afs_SRXCB##name##_name[] __tracepoint_string = \ 38 38 "CB." #name 39 39 40 40 /*
+1 -3
fs/afs/inode.c
··· 216 216 set_nlink(inode, 2); 217 217 inode->i_uid = GLOBAL_ROOT_UID; 218 218 inode->i_gid = GLOBAL_ROOT_GID; 219 - inode->i_ctime.tv_sec = get_seconds(); 220 - inode->i_ctime.tv_nsec = 0; 221 - inode->i_atime = inode->i_mtime = inode->i_ctime; 219 + inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode); 222 220 inode->i_blocks = 0; 223 221 inode_set_iversion_raw(inode, 0); 224 222 inode->i_generation = 0;
+1 -3
fs/afs/internal.h
··· 474 474 time64_t put_time; /* Time at which last put */ 475 475 time64_t update_at; /* Time at which to next update the record */ 476 476 unsigned long flags; 477 - #define AFS_SERVER_FL_NEW 0 /* New server, don't inc cb_s_break */ 478 477 #define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */ 479 478 #define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */ 480 479 #define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */ ··· 826 827 827 828 static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode) 828 829 { 829 - return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break; 830 + return vnode->cb_break + vnode->cb_v_break; 830 831 } 831 832 832 833 static inline bool afs_cb_is_broken(unsigned int cb_break, ··· 834 835 const struct afs_cb_interest *cbi) 835 836 { 836 837 return !cbi || cb_break != (vnode->cb_break + 837 - cbi->server->cb_s_break + 838 838 vnode->volume->cb_v_break); 839 839 } 840 840
+5 -1
fs/afs/rxrpc.c
··· 572 572 case -ENODATA: 573 573 case -EBADMSG: 574 574 case -EMSGSIZE: 575 - default: 576 575 abort_code = RXGEN_CC_UNMARSHAL; 577 576 if (state != AFS_CALL_CL_AWAIT_REPLY) 578 577 abort_code = RXGEN_SS_UNMARSHAL; 579 578 rxrpc_kernel_abort_call(call->net->socket, call->rxcall, 580 579 abort_code, ret, "KUM"); 580 + goto local_abort; 581 + default: 582 + abort_code = RX_USER_ABORT; 583 + rxrpc_kernel_abort_call(call->net->socket, call->rxcall, 584 + abort_code, ret, "KER"); 581 585 goto local_abort; 582 586 } 583 587 }
-1
fs/afs/server.c
··· 226 226 RCU_INIT_POINTER(server->addresses, alist); 227 227 server->addr_version = alist->version; 228 228 server->uuid = *uuid; 229 - server->flags = (1UL << AFS_SERVER_FL_NEW); 230 229 server->update_at = ktime_get_real_seconds() + afs_server_update_delay; 231 230 rwlock_init(&server->fs_lock); 232 231 INIT_HLIST_HEAD(&server->cb_volumes);
+1
fs/afs/write.c
··· 264 264 first = page->index + 1; 265 265 lock_page(page); 266 266 generic_error_remove_page(mapping, page); 267 + unlock_page(page); 267 268 } 268 269 269 270 __pagevec_release(&pv);
+2
fs/cifs/cifsglob.h
··· 1333 1333 } 1334 1334 1335 1335 struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file); 1336 + void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_hdlr); 1336 1337 void cifsFileInfo_put(struct cifsFileInfo *cifs_file); 1337 1338 1338 1339 #define CIFS_CACHE_READ_FLG 1 ··· 1856 1855 #endif /* CONFIG_CIFS_ACL */ 1857 1856 1858 1857 void cifs_oplock_break(struct work_struct *work); 1858 + void cifs_queue_oplock_break(struct cifsFileInfo *cfile); 1859 1859 1860 1860 extern const struct slow_work_ops cifs_oplock_break_ops; 1861 1861 extern struct workqueue_struct *cifsiod_wq;
+25 -5
fs/cifs/file.c
··· 360 360 return cifs_file; 361 361 } 362 362 363 - /* 364 - * Release a reference on the file private data. This may involve closing 365 - * the filehandle out on the server. Must be called without holding 366 - * tcon->open_file_lock and cifs_file->file_info_lock. 363 + /** 364 + * cifsFileInfo_put - release a reference of file priv data 365 + * 366 + * Always potentially wait for oplock handler. See _cifsFileInfo_put(). 367 367 */ 368 368 void cifsFileInfo_put(struct cifsFileInfo *cifs_file) 369 + { 370 + _cifsFileInfo_put(cifs_file, true); 371 + } 372 + 373 + /** 374 + * _cifsFileInfo_put - release a reference of file priv data 375 + * 376 + * This may involve closing the filehandle @cifs_file out on the 377 + * server. Must be called without holding tcon->open_file_lock and 378 + * cifs_file->file_info_lock. 379 + * 380 + * If @wait_for_oplock_handler is true and we are releasing the last 381 + * reference, wait for any running oplock break handler of the file 382 + * and cancel any pending one. If calling this function from the 383 + * oplock break handler, you need to pass false. 384 + * 385 + */ 386 + void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) 369 387 { 370 388 struct inode *inode = d_inode(cifs_file->dentry); 371 389 struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); ··· 432 414 433 415 spin_unlock(&tcon->open_file_lock); 434 416 435 - oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); 417 + oplock_break_cancelled = wait_oplock_handler ? 418 + cancel_work_sync(&cifs_file->oplock_break) : false; 436 419 437 420 if (!tcon->need_reconnect && !cifs_file->invalidHandle) { 438 421 struct TCP_Server_Info *server = tcon->ses->server; ··· 4622 4603 cinode); 4623 4604 cifs_dbg(FYI, "Oplock release rc = %d\n", rc); 4624 4605 } 4606 + _cifsFileInfo_put(cfile, false /* do not wait for ourself */); 4625 4607 cifs_done_oplock_break(cinode); 4626 4608 } 4627 4609
+23 -2
fs/cifs/misc.c
··· 501 501 CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, 502 502 &pCifsInode->flags); 503 503 504 - queue_work(cifsoplockd_wq, 505 - &netfile->oplock_break); 504 + cifs_queue_oplock_break(netfile); 506 505 netfile->oplock_break_cancelled = false; 507 506 508 507 spin_unlock(&tcon->open_file_lock); ··· 604 605 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); 605 606 } 606 607 spin_unlock(&cinode->writers_lock); 608 + } 609 + 610 + /** 611 + * cifs_queue_oplock_break - queue the oplock break handler for cfile 612 + * 613 + * This function is called from the demultiplex thread when it 614 + * receives an oplock break for @cfile. 615 + * 616 + * Assumes the tcon->open_file_lock is held. 617 + * Assumes cfile->file_info_lock is NOT held. 618 + */ 619 + void cifs_queue_oplock_break(struct cifsFileInfo *cfile) 620 + { 621 + /* 622 + * Bump the handle refcount now while we hold the 623 + * open_file_lock to enforce the validity of it for the oplock 624 + * break handler. The matching put is done at the end of the 625 + * handler. 626 + */ 627 + cifsFileInfo_get(cfile); 628 + 629 + queue_work(cifsoplockd_wq, &cfile->oplock_break); 607 630 } 608 631 609 632 void cifs_done_oplock_break(struct cifsInodeInfo *cinode)
+3 -3
fs/cifs/smb2misc.c
··· 555 555 clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, 556 556 &cinode->flags); 557 557 558 - queue_work(cifsoplockd_wq, &cfile->oplock_break); 558 + cifs_queue_oplock_break(cfile); 559 559 kfree(lw); 560 560 return true; 561 561 } ··· 712 712 CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, 713 713 &cinode->flags); 714 714 spin_unlock(&cfile->file_info_lock); 715 - queue_work(cifsoplockd_wq, 716 - &cfile->oplock_break); 715 + 716 + cifs_queue_oplock_break(cfile); 717 717 718 718 spin_unlock(&tcon->open_file_lock); 719 719 spin_unlock(&cifs_tcp_ses_lock);
+2
fs/cifs/smb2ops.c
··· 2389 2389 2390 2390 rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov, 2391 2391 &resp_buftype); 2392 + if (!rc) 2393 + SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 2392 2394 if (!rc || !err_iov.iov_base) { 2393 2395 rc = -ENOENT; 2394 2396 goto free_path;
+7 -4
fs/cifs/smb2pdu.c
··· 832 832 } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { 833 833 /* ops set to 3.0 by default for default so update */ 834 834 ses->server->ops = &smb21_operations; 835 - } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) 835 + ses->server->vals = &smb21_values; 836 + } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) { 836 837 ses->server->ops = &smb311_operations; 838 + ses->server->vals = &smb311_values; 839 + } 837 840 } else if (le16_to_cpu(rsp->DialectRevision) != 838 841 ses->server->vals->protocol_id) { 839 842 /* if requested single dialect ensure returned dialect matched */ ··· 3451 3448 rqst.rq_nvec = 1; 3452 3449 3453 3450 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); 3454 - cifs_small_buf_release(req); 3455 - 3456 3451 rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; 3457 3452 3458 3453 if (rc) { ··· 3471 3470 trace_smb3_read_done(xid, req->PersistentFileId, 3472 3471 io_parms->tcon->tid, ses->Suid, 3473 3472 io_parms->offset, io_parms->length); 3473 + 3474 + cifs_small_buf_release(req); 3474 3475 3475 3476 *nbytes = le32_to_cpu(rsp->DataLength); 3476 3477 if ((*nbytes > CIFS_MAX_MSGSIZE) || ··· 3772 3769 3773 3770 rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst, 3774 3771 &resp_buftype, flags, &rsp_iov); 3775 - cifs_small_buf_release(req); 3776 3772 rsp = (struct smb2_write_rsp *)rsp_iov.iov_base; 3777 3773 3778 3774 if (rc) { ··· 3789 3787 io_parms->offset, *nbytes); 3790 3788 } 3791 3789 3790 + cifs_small_buf_release(req); 3792 3791 free_rsp_buf(resp_buftype, rsp); 3793 3792 return rc; 3794 3793 }
+30 -11
fs/io_uring.c
··· 338 338 tail = ctx->cached_cq_tail; 339 339 /* See comment at the top of the file */ 340 340 smp_rmb(); 341 - if (tail + 1 == READ_ONCE(ring->r.head)) 341 + if (tail - READ_ONCE(ring->r.head) == ring->ring_entries) 342 342 return NULL; 343 343 344 344 ctx->cached_cq_tail++; ··· 682 682 list_add_tail(&req->list, &ctx->poll_list); 683 683 } 684 684 685 - static void io_file_put(struct io_submit_state *state, struct file *file) 685 + static void io_file_put(struct io_submit_state *state) 686 686 { 687 - if (!state) { 688 - fput(file); 689 - } else if (state->file) { 687 + if (state->file) { 690 688 int diff = state->has_refs - state->used_refs; 691 689 692 690 if (diff) ··· 709 711 state->ios_left--; 710 712 return state->file; 711 713 } 712 - io_file_put(state, NULL); 714 + io_file_put(state); 713 715 } 714 716 state->file = fget_many(fd, state->ios_left); 715 717 if (!state->file) ··· 1669 1671 static void io_submit_state_end(struct io_submit_state *state) 1670 1672 { 1671 1673 blk_finish_plug(&state->plug); 1672 - io_file_put(state, NULL); 1674 + io_file_put(state); 1673 1675 if (state->free_reqs) 1674 1676 kmem_cache_free_bulk(req_cachep, state->free_reqs, 1675 1677 &state->reqs[state->cur_req]); ··· 1918 1920 unuse_mm(cur_mm); 1919 1921 mmput(cur_mm); 1920 1922 } 1923 + 1924 + if (kthread_should_park()) 1925 + kthread_parkme(); 1926 + 1921 1927 return 0; 1922 1928 } 1923 1929 ··· 2056 2054 if (ctx->sqo_thread) { 2057 2055 ctx->sqo_stop = 1; 2058 2056 mb(); 2057 + kthread_park(ctx->sqo_thread); 2059 2058 kthread_stop(ctx->sqo_thread); 2060 2059 ctx->sqo_thread = NULL; 2061 2060 } ··· 2239 2236 mmgrab(current->mm); 2240 2237 ctx->sqo_mm = current->mm; 2241 2238 2242 - ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); 2243 - if (!ctx->sq_thread_idle) 2244 - ctx->sq_thread_idle = HZ; 2245 - 2246 2239 ret = -EINVAL; 2247 2240 if (!cpu_possible(p->sq_thread_cpu)) 2248 2241 goto err; ··· 2248 2249 if (!capable(CAP_SYS_ADMIN)) 2249 2250 goto err; 2250 2251 2252 + ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); 2253 + if (!ctx->sq_thread_idle) 2254 + ctx->sq_thread_idle = HZ; 2255 + 2251 2256 if (p->flags & IORING_SETUP_SQ_AFF) { 2252 2257 int cpu; 2253 2258 2254 2259 cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS); 2260 + ret = -EINVAL; 2261 + if (!cpu_possible(p->sq_thread_cpu)) 2262 + goto err; 2263 + 2255 2264 ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, 2256 2265 ctx, cpu, 2257 2266 "io_uring-sq"); ··· 2929 2922 2930 2923 static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, 2931 2924 void __user *arg, unsigned nr_args) 2925 + __releases(ctx->uring_lock) 2926 + __acquires(ctx->uring_lock) 2932 2927 { 2933 2928 int ret; 2934 2929 2935 2930 percpu_ref_kill(&ctx->refs); 2931 + 2932 + /* 2933 + * Drop uring mutex before waiting for references to exit. If another 2934 + * thread is currently inside io_uring_enter() it might need to grab 2935 + * the uring_lock to make progress. If we hold it here across the drain 2936 + * wait, then we can deadlock. It's safe to drop the mutex here, since 2937 + * no new references will come in after we've killed the percpu ref. 2938 + */ 2939 + mutex_unlock(&ctx->uring_lock); 2936 2940 wait_for_completion(&ctx->ctx_done); 2941 + mutex_lock(&ctx->uring_lock); 2937 2942 2938 2943 switch (opcode) { 2939 2944 case IORING_REGISTER_BUFFERS:
+15 -2
fs/nfsd/nfs3proc.c
··· 442 442 struct nfsd3_readdirargs *argp = rqstp->rq_argp; 443 443 struct nfsd3_readdirres *resp = rqstp->rq_resp; 444 444 __be32 nfserr; 445 - int count; 445 + int count = 0; 446 + struct page **p; 447 + caddr_t page_addr = NULL; 446 448 447 449 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", 448 450 SVCFH_fmt(&argp->fh), ··· 464 462 nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, 465 463 &resp->common, nfs3svc_encode_entry); 466 464 memcpy(resp->verf, argp->verf, 8); 467 - resp->count = resp->buffer - argp->buffer; 465 + count = 0; 466 + for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) { 467 + page_addr = page_address(*p); 468 + 469 + if (((caddr_t)resp->buffer >= page_addr) && 470 + ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) { 471 + count += (caddr_t)resp->buffer - page_addr; 472 + break; 473 + } 474 + count += PAGE_SIZE; 475 + } 476 + resp->count = count >> 2; 468 477 if (resp->offset) { 469 478 loff_t offset = argp->cookie; 470 479
+9 -2
fs/nfsd/nfs3xdr.c
··· 573 573 nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) 574 574 { 575 575 struct nfsd3_readdirargs *args = rqstp->rq_argp; 576 + int len; 576 577 u32 max_blocksize = svc_max_payload(rqstp); 577 578 578 579 p = decode_fh(p, &args->fh); ··· 583 582 args->verf = p; p += 2; 584 583 args->dircount = ~0; 585 584 args->count = ntohl(*p++); 586 - args->count = min_t(u32, args->count, max_blocksize); 587 - args->buffer = page_address(*(rqstp->rq_next_page++)); 585 + len = args->count = min_t(u32, args->count, max_blocksize); 586 + 587 + while (len > 0) { 588 + struct page *p = *(rqstp->rq_next_page++); 589 + if (!args->buffer) 590 + args->buffer = page_address(p); 591 + len -= PAGE_SIZE; 592 + } 588 593 589 594 return xdr_argsize_check(rqstp, p); 590 595 }
+7 -1
fs/nfsd/nfs4callback.c
··· 1010 1010 cb->cb_seq_status = 1; 1011 1011 cb->cb_status = 0; 1012 1012 if (minorversion) { 1013 - if (!nfsd41_cb_get_slot(clp, task)) 1013 + if (!cb->cb_holds_slot && !nfsd41_cb_get_slot(clp, task)) 1014 1014 return; 1015 + cb->cb_holds_slot = true; 1015 1016 } 1016 1017 rpc_call_start(task); 1017 1018 } ··· 1038 1037 1039 1038 return true; 1040 1039 } 1040 + 1041 + if (!cb->cb_holds_slot) 1042 + goto need_restart; 1041 1043 1042 1044 switch (cb->cb_seq_status) { 1043 1045 case 0: ··· 1080 1076 cb->cb_seq_status); 1081 1077 } 1082 1078 1079 + cb->cb_holds_slot = false; 1083 1080 clear_bit(0, &clp->cl_cb_slot_busy); 1084 1081 rpc_wake_up_next(&clp->cl_cb_waitq); 1085 1082 dprintk("%s: freed slot, new seqid=%d\n", __func__, ··· 1288 1283 cb->cb_seq_status = 1; 1289 1284 cb->cb_status = 0; 1290 1285 cb->cb_need_restart = false; 1286 + cb->cb_holds_slot = false; 1291 1287 } 1292 1288 1293 1289 void nfsd4_run_cb(struct nfsd4_callback *cb)
+10 -2
fs/nfsd/nfs4state.c
··· 265 265 static void 266 266 free_blocked_lock(struct nfsd4_blocked_lock *nbl) 267 267 { 268 + locks_delete_block(&nbl->nbl_lock); 268 269 locks_release_private(&nbl->nbl_lock); 269 270 kfree(nbl); 270 271 } ··· 294 293 nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock, 295 294 nbl_lru); 296 295 list_del_init(&nbl->nbl_lru); 297 - locks_delete_block(&nbl->nbl_lock); 298 296 free_blocked_lock(nbl); 299 297 } 298 + } 299 + 300 + static void 301 + nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb) 302 + { 303 + struct nfsd4_blocked_lock *nbl = container_of(cb, 304 + struct nfsd4_blocked_lock, nbl_cb); 305 + locks_delete_block(&nbl->nbl_lock); 300 306 } 301 307 302 308 static int ··· 333 325 } 334 326 335 327 static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = { 328 + .prepare = nfsd4_cb_notify_lock_prepare, 336 329 .done = nfsd4_cb_notify_lock_done, 337 330 .release = nfsd4_cb_notify_lock_release, 338 331 }; ··· 4872 4863 nbl = list_first_entry(&reaplist, 4873 4864 struct nfsd4_blocked_lock, nbl_lru); 4874 4865 list_del_init(&nbl->nbl_lru); 4875 - locks_delete_block(&nbl->nbl_lock); 4876 4866 free_blocked_lock(nbl); 4877 4867 } 4878 4868 out:
+1
fs/nfsd/state.h
··· 70 70 int cb_seq_status; 71 71 int cb_status; 72 72 bool cb_need_restart; 73 + bool cb_holds_slot; 73 74 }; 74 75 75 76 struct nfsd4_callback_ops {
+18
fs/proc/task_mmu.c
··· 1143 1143 count = -EINTR; 1144 1144 goto out_mm; 1145 1145 } 1146 + /* 1147 + * Avoid to modify vma->vm_flags 1148 + * without locked ops while the 1149 + * coredump reads the vm_flags. 1150 + */ 1151 + if (!mmget_still_valid(mm)) { 1152 + /* 1153 + * Silently return "count" 1154 + * like if get_task_mm() 1155 + * failed. FIXME: should this 1156 + * function have returned 1157 + * -ESRCH if get_task_mm() 1158 + * failed like if 1159 + * get_proc_task() fails? 1160 + */ 1161 + up_write(&mm->mmap_sem); 1162 + goto out_mm; 1163 + } 1146 1164 for (vma = mm->mmap; vma; vma = vma->vm_next) { 1147 1165 vma->vm_flags &= ~VM_SOFTDIRTY; 1148 1166 vma_set_page_prot(vma);
+9
fs/userfaultfd.c
··· 629 629 630 630 /* the various vma->vm_userfaultfd_ctx still points to it */ 631 631 down_write(&mm->mmap_sem); 632 + /* no task can run (and in turn coredump) yet */ 633 + VM_WARN_ON(!mmget_still_valid(mm)); 632 634 for (vma = mm->mmap; vma; vma = vma->vm_next) 633 635 if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { 634 636 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; ··· 885 883 * taking the mmap_sem for writing. 886 884 */ 887 885 down_write(&mm->mmap_sem); 886 + if (!mmget_still_valid(mm)) 887 + goto skip_mm; 888 888 prev = NULL; 889 889 for (vma = mm->mmap; vma; vma = vma->vm_next) { 890 890 cond_resched(); ··· 909 905 vma->vm_flags = new_flags; 910 906 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; 911 907 } 908 + skip_mm: 912 909 up_write(&mm->mmap_sem); 913 910 mmput(mm); 914 911 wakeup: ··· 1338 1333 goto out; 1339 1334 1340 1335 down_write(&mm->mmap_sem); 1336 + if (!mmget_still_valid(mm)) 1337 + goto out_unlock; 1341 1338 vma = find_vma_prev(mm, start, &prev); 1342 1339 if (!vma) 1343 1340 goto out_unlock; ··· 1527 1520 goto out; 1528 1521 1529 1522 down_write(&mm->mmap_sem); 1523 + if (!mmget_still_valid(mm)) 1524 + goto out_unlock; 1530 1525 vma = find_vma_prev(mm, start, &prev); 1531 1526 if (!vma) 1532 1527 goto out_unlock;
-1
include/linux/blkdev.h
··· 548 548 struct rcu_head rcu_head; 549 549 wait_queue_head_t mq_freeze_wq; 550 550 struct percpu_ref q_usage_counter; 551 - struct list_head all_q_node; 552 551 553 552 struct blk_mq_tag_set *tag_set; 554 553 struct list_head tag_set_list;
+3 -2
include/linux/bvec.h
··· 160 160 bv->bv_page = nth_page(bv->bv_page, 1); 161 161 bv->bv_offset = 0; 162 162 } else { 163 - bv->bv_page = bvec->bv_page; 164 - bv->bv_offset = bvec->bv_offset; 163 + bv->bv_page = bvec_nth_page(bvec->bv_page, bvec->bv_offset / 164 + PAGE_SIZE); 165 + bv->bv_offset = bvec->bv_offset & ~PAGE_MASK; 165 166 } 166 167 bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset, 167 168 bvec->bv_len - iter_all->done);
+6 -1
include/linux/efi.h
··· 1611 1611 struct screen_info *si, efi_guid_t *proto, 1612 1612 unsigned long size); 1613 1613 1614 - bool efi_runtime_disabled(void); 1614 + #ifdef CONFIG_EFI 1615 + extern bool efi_runtime_disabled(void); 1616 + #else 1617 + static inline bool efi_runtime_disabled(void) { return true; } 1618 + #endif 1619 + 1615 1620 extern void efi_call_virt_check_flags(unsigned long flags, const char *call); 1616 1621 extern unsigned long efi_call_virt_save_flags(void); 1617 1622
+1
include/linux/elevator.h
··· 31 31 void (*exit_sched)(struct elevator_queue *); 32 32 int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int); 33 33 void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); 34 + void (*depth_updated)(struct blk_mq_hw_ctx *); 34 35 35 36 bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); 36 37 bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *);
+12
include/linux/etherdevice.h
··· 449 449 } 450 450 451 451 /** 452 + * eth_addr_inc() - Increment the given MAC address. 453 + * @addr: Pointer to a six-byte array containing Ethernet address to increment. 454 + */ 455 + static inline void eth_addr_inc(u8 *addr) 456 + { 457 + u64 u = ether_addr_to_u64(addr); 458 + 459 + u++; 460 + u64_to_ether_addr(u, addr); 461 + } 462 + 463 + /** 452 464 * is_etherdev_addr - Tell if given Ethernet address belongs to the device. 453 465 * @dev: Pointer to a device structure 454 466 * @addr: Pointer to a six-byte array containing the Ethernet address
+1
include/linux/kprobes.h
··· 173 173 struct kretprobe *rp; 174 174 kprobe_opcode_t *ret_addr; 175 175 struct task_struct *task; 176 + void *fp; 176 177 char data[0]; 177 178 }; 178 179
+21
include/linux/sched/mm.h
··· 49 49 __mmdrop(mm); 50 50 } 51 51 52 + /* 53 + * This has to be called after a get_task_mm()/mmget_not_zero() 54 + * followed by taking the mmap_sem for writing before modifying the 55 + * vmas or anything the coredump pretends not to change from under it. 56 + * 57 + * NOTE: find_extend_vma() called from GUP context is the only place 58 + * that can modify the "mm" (notably the vm_start/end) under mmap_sem 59 + * for reading and outside the context of the process, so it is also 60 + * the only case that holds the mmap_sem for reading that must call 61 + * this function. Generally if the mmap_sem is hold for reading 62 + * there's no need of this check after get_task_mm()/mmget_not_zero(). 63 + * 64 + * This function can be obsoleted and the check can be removed, after 65 + * the coredump code will hold the mmap_sem for writing before 66 + * invoking the ->core_dump methods. 67 + */ 68 + static inline bool mmget_still_valid(struct mm_struct *mm) 69 + { 70 + return likely(!mm->core_state); 71 + } 72 + 52 73 /** 53 74 * mmget() - Pin the address space associated with a &struct mm_struct. 54 75 * @mm: The address space to pin.
+1
include/linux/shmem_fs.h
··· 21 21 struct list_head swaplist; /* chain of maybes on swap */ 22 22 struct shared_policy policy; /* NUMA memory alloc policy */ 23 23 struct simple_xattrs xattrs; /* list of xattrs */ 24 + atomic_t stop_eviction; /* hold when working on inode */ 24 25 struct inode vfs_inode; 25 26 }; 26 27
+2
include/net/netfilter/nf_conntrack.h
··· 316 316 gfp_t flags); 317 317 void nf_ct_tmpl_free(struct nf_conn *tmpl); 318 318 319 + u32 nf_ct_get_id(const struct nf_conn *ct); 320 + 319 321 static inline void 320 322 nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info) 321 323 {
+6
include/net/netfilter/nf_conntrack_l4proto.h
··· 75 75 bool nf_conntrack_invert_icmpv6_tuple(struct nf_conntrack_tuple *tuple, 76 76 const struct nf_conntrack_tuple *orig); 77 77 78 + int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb, 79 + unsigned int dataoff, 80 + const struct nf_hook_state *state, 81 + u8 l4proto, 82 + union nf_inet_addr *outer_daddr); 83 + 78 84 int nf_conntrack_icmpv4_error(struct nf_conn *tmpl, 79 85 struct sk_buff *skb, 80 86 unsigned int dataoff,
+4 -2
include/uapi/linux/input-event-codes.h
··· 439 439 #define KEY_TITLE 0x171 440 440 #define KEY_SUBTITLE 0x172 441 441 #define KEY_ANGLE 0x173 442 - #define KEY_ZOOM 0x174 442 + #define KEY_FULL_SCREEN 0x174 /* AC View Toggle */ 443 + #define KEY_ZOOM KEY_FULL_SCREEN 443 444 #define KEY_MODE 0x175 444 445 #define KEY_KEYBOARD 0x176 445 - #define KEY_SCREEN 0x177 446 + #define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */ 447 + #define KEY_SCREEN KEY_ASPECT_RATIO 446 448 #define KEY_PC 0x178 /* Media Select Computer */ 447 449 #define KEY_TV 0x179 /* Media Select TV */ 448 450 #define KEY_TV2 0x17a /* Media Select Cable */
+2 -2
init/main.c
··· 582 582 page_alloc_init(); 583 583 584 584 pr_notice("Kernel command line: %s\n", boot_command_line); 585 + /* parameters may set static keys */ 586 + jump_label_init(); 585 587 parse_early_param(); 586 588 after_dashes = parse_args("Booting kernel", 587 589 static_command_line, __start___param, ··· 592 590 if (!IS_ERR_OR_NULL(after_dashes)) 593 591 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, 594 592 NULL, set_init_arg); 595 - 596 - jump_label_init(); 597 593 598 594 /* 599 595 * These use large bootmem allocations and must precede
+21 -16
kernel/events/core.c
··· 9077 9077 if (task == TASK_TOMBSTONE) 9078 9078 return; 9079 9079 9080 - if (!ifh->nr_file_filters) 9081 - return; 9080 + if (ifh->nr_file_filters) { 9081 + mm = get_task_mm(event->ctx->task); 9082 + if (!mm) 9083 + goto restart; 9082 9084 9083 - mm = get_task_mm(event->ctx->task); 9084 - if (!mm) 9085 - goto restart; 9086 - 9087 - down_read(&mm->mmap_sem); 9085 + down_read(&mm->mmap_sem); 9086 + } 9088 9087 9089 9088 raw_spin_lock_irqsave(&ifh->lock, flags); 9090 9089 list_for_each_entry(filter, &ifh->list, entry) { 9091 - event->addr_filter_ranges[count].start = 0; 9092 - event->addr_filter_ranges[count].size = 0; 9090 + if (filter->path.dentry) { 9091 + /* 9092 + * Adjust base offset if the filter is associated to a 9093 + * binary that needs to be mapped: 9094 + */ 9095 + event->addr_filter_ranges[count].start = 0; 9096 + event->addr_filter_ranges[count].size = 0; 9093 9097 9094 - /* 9095 - * Adjust base offset if the filter is associated to a binary 9096 - * that needs to be mapped: 9097 - */ 9098 - if (filter->path.dentry) 9099 9098 perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]); 9099 + } else { 9100 + event->addr_filter_ranges[count].start = filter->offset; 9101 + event->addr_filter_ranges[count].size = filter->size; 9102 + } 9100 9103 9101 9104 count++; 9102 9105 } ··· 9107 9104 event->addr_filters_gen++; 9108 9105 raw_spin_unlock_irqrestore(&ifh->lock, flags); 9109 9106 9110 - up_read(&mm->mmap_sem); 9107 + if (ifh->nr_file_filters) { 9108 + up_read(&mm->mmap_sem); 9111 9109 9112 - mmput(mm); 9110 + mmput(mm); 9111 + } 9113 9112 9114 9113 restart: 9115 9114 perf_event_stop(event, 1);
+15 -18
kernel/events/ring_buffer.c
··· 455 455 rb->aux_head += size; 456 456 } 457 457 458 - if (size || handle->aux_flags) { 459 - /* 460 - * Only send RECORD_AUX if we have something useful to communicate 461 - * 462 - * Note: the OVERWRITE records by themselves are not considered 463 - * useful, as they don't communicate any *new* information, 464 - * aside from the short-lived offset, that becomes history at 465 - * the next event sched-in and therefore isn't useful. 466 - * The userspace that needs to copy out AUX data in overwrite 467 - * mode should know to use user_page::aux_head for the actual 468 - * offset. So, from now on we don't output AUX records that 469 - * have *only* OVERWRITE flag set. 470 - */ 471 - 472 - if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE) 473 - perf_event_aux_event(handle->event, aux_head, size, 474 - handle->aux_flags); 475 - } 458 + /* 459 + * Only send RECORD_AUX if we have something useful to communicate 460 + * 461 + * Note: the OVERWRITE records by themselves are not considered 462 + * useful, as they don't communicate any *new* information, 463 + * aside from the short-lived offset, that becomes history at 464 + * the next event sched-in and therefore isn't useful. 465 + * The userspace that needs to copy out AUX data in overwrite 466 + * mode should know to use user_page::aux_head for the actual 467 + * offset. So, from now on we don't output AUX records that 468 + * have *only* OVERWRITE flag set. 469 + */ 470 + if (size || (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)) 471 + perf_event_aux_event(handle->event, aux_head, size, 472 + handle->aux_flags); 476 473 477 474 rb->user_page->aux_head = rb->aux_head; 478 475 if (rb_need_aux_wakeup(rb))
+2 -4
kernel/kprobes.c
··· 709 709 static int reuse_unused_kprobe(struct kprobe *ap) 710 710 { 711 711 struct optimized_kprobe *op; 712 - int ret; 713 712 714 713 /* 715 714 * Unused kprobe MUST be on the way of delayed unoptimizing (means ··· 719 720 /* Enable the probe again */ 720 721 ap->flags &= ~KPROBE_FLAG_DISABLED; 721 722 /* Optimize it again (remove from op->list) */ 722 - ret = kprobe_optready(ap); 723 - if (ret) 724 - return ret; 723 + if (!kprobe_optready(ap)) 724 + return -EINVAL; 725 725 726 726 optimize_kprobe(ap); 727 727 return 0;
+5 -4
kernel/locking/lockdep.c
··· 4907 4907 return; 4908 4908 4909 4909 raw_local_irq_save(flags); 4910 - arch_spin_lock(&lockdep_lock); 4911 - current->lockdep_recursion = 1; 4910 + if (!graph_lock()) 4911 + goto out_irq; 4912 + 4912 4913 pf = get_pending_free(); 4913 4914 hlist_for_each_entry_rcu(k, hash_head, hash_entry) { 4914 4915 if (k == key) { ··· 4921 4920 WARN_ON_ONCE(!found); 4922 4921 __lockdep_free_key_range(pf, key, 1); 4923 4922 call_rcu_zapped(pf); 4924 - current->lockdep_recursion = 0; 4925 - arch_spin_unlock(&lockdep_lock); 4923 + graph_unlock(); 4924 + out_irq: 4926 4925 raw_local_irq_restore(flags); 4927 4926 4928 4927 /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */
+1 -2
kernel/sched/deadline.c
··· 252 252 if (dl_entity_is_special(dl_se)) 253 253 return; 254 254 255 - WARN_ON(hrtimer_active(&dl_se->inactive_timer)); 256 255 WARN_ON(dl_se->dl_non_contending); 257 256 258 257 zerolag_time = dl_se->deadline - ··· 268 269 * If the "0-lag time" already passed, decrease the active 269 270 * utilization now, instead of starting a timer 270 271 */ 271 - if (zerolag_time < 0) { 272 + if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) { 272 273 if (dl_task(p)) 273 274 sub_running_bw(dl_se, dl_rq); 274 275 if (!dl_task(p) || p->state == TASK_DEAD) {
+25
kernel/sched/fair.c
··· 4885 4885 return HRTIMER_NORESTART; 4886 4886 } 4887 4887 4888 + extern const u64 max_cfs_quota_period; 4889 + 4888 4890 static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) 4889 4891 { 4890 4892 struct cfs_bandwidth *cfs_b = ··· 4894 4892 unsigned long flags; 4895 4893 int overrun; 4896 4894 int idle = 0; 4895 + int count = 0; 4897 4896 4898 4897 raw_spin_lock_irqsave(&cfs_b->lock, flags); 4899 4898 for (;;) { 4900 4899 overrun = hrtimer_forward_now(timer, cfs_b->period); 4901 4900 if (!overrun) 4902 4901 break; 4902 + 4903 + if (++count > 3) { 4904 + u64 new, old = ktime_to_ns(cfs_b->period); 4905 + 4906 + new = (old * 147) / 128; /* ~115% */ 4907 + new = min(new, max_cfs_quota_period); 4908 + 4909 + cfs_b->period = ns_to_ktime(new); 4910 + 4911 + /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ 4912 + cfs_b->quota *= new; 4913 + cfs_b->quota = div64_u64(cfs_b->quota, old); 4914 + 4915 + pr_warn_ratelimited( 4916 + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", 4917 + smp_processor_id(), 4918 + div_u64(new, NSEC_PER_USEC), 4919 + div_u64(cfs_b->quota, NSEC_PER_USEC)); 4920 + 4921 + /* reset count so we don't come right back in here */ 4922 + count = 0; 4923 + } 4903 4924 4904 4925 idle = do_sched_cfs_period_timer(cfs_b, overrun, flags); 4905 4926 }
+1 -1
kernel/signal.c
··· 3581 3581 if (flags) 3582 3582 return -EINVAL; 3583 3583 3584 - f = fdget_raw(pidfd); 3584 + f = fdget(pidfd); 3585 3585 if (!f.file) 3586 3586 return -EBADF; 3587 3587
+2 -2
kernel/time/sched_clock.c
··· 272 272 return cd.read_data[seq & 1].epoch_cyc; 273 273 } 274 274 275 - static int sched_clock_suspend(void) 275 + int sched_clock_suspend(void) 276 276 { 277 277 struct clock_read_data *rd = &cd.read_data[0]; 278 278 ··· 283 283 return 0; 284 284 } 285 285 286 - static void sched_clock_resume(void) 286 + void sched_clock_resume(void) 287 287 { 288 288 struct clock_read_data *rd = &cd.read_data[0]; 289 289
+2
kernel/time/tick-common.c
··· 487 487 trace_suspend_resume(TPS("timekeeping_freeze"), 488 488 smp_processor_id(), true); 489 489 system_state = SYSTEM_SUSPEND; 490 + sched_clock_suspend(); 490 491 timekeeping_suspend(); 491 492 } else { 492 493 tick_suspend_local(); ··· 511 510 512 511 if (tick_freeze_depth == num_online_cpus()) { 513 512 timekeeping_resume(); 513 + sched_clock_resume(); 514 514 system_state = SYSTEM_RUNNING; 515 515 trace_suspend_resume(TPS("timekeeping_freeze"), 516 516 smp_processor_id(), false);
+7
kernel/time/timekeeping.h
··· 14 14 extern void timekeeping_warp_clock(void); 15 15 extern int timekeeping_suspend(void); 16 16 extern void timekeeping_resume(void); 17 + #ifdef CONFIG_GENERIC_SCHED_CLOCK 18 + extern int sched_clock_suspend(void); 19 + extern void sched_clock_resume(void); 20 + #else 21 + static inline int sched_clock_suspend(void) { return 0; } 22 + static inline void sched_clock_resume(void) { } 23 + #endif 17 24 18 25 extern void do_timer(unsigned long ticks); 19 26 extern void update_wall_time(void);
+5 -1
kernel/trace/ftrace.c
··· 33 33 #include <linux/list.h> 34 34 #include <linux/hash.h> 35 35 #include <linux/rcupdate.h> 36 + #include <linux/kprobes.h> 36 37 37 38 #include <trace/events/sched.h> 38 39 ··· 6247 6246 tr->ops->func = ftrace_stub; 6248 6247 } 6249 6248 6250 - static inline void 6249 + static nokprobe_inline void 6251 6250 __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, 6252 6251 struct ftrace_ops *ignored, struct pt_regs *regs) 6253 6252 { ··· 6307 6306 { 6308 6307 __ftrace_ops_list_func(ip, parent_ip, NULL, regs); 6309 6308 } 6309 + NOKPROBE_SYMBOL(ftrace_ops_list_func); 6310 6310 #else 6311 6311 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) 6312 6312 { 6313 6313 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); 6314 6314 } 6315 + NOKPROBE_SYMBOL(ftrace_ops_no_ops); 6315 6316 #endif 6316 6317 6317 6318 /* ··· 6340 6337 preempt_enable_notrace(); 6341 6338 trace_clear_recursion(bit); 6342 6339 } 6340 + NOKPROBE_SYMBOL(ftrace_ops_assist_func); 6343 6341 6344 6342 /** 6345 6343 * ftrace_ops_get_func - get the function a trampoline should call
+2 -1
kernel/watchdog_hld.c
··· 135 135 if (__this_cpu_read(hard_watchdog_warn) == true) 136 136 return; 137 137 138 - pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu); 138 + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", 139 + this_cpu); 139 140 print_modules(); 140 141 print_irqtrace_events(current); 141 142 if (regs)
+3 -3
lib/Kconfig.debug
··· 761 761 config ARCH_HAS_KCOV 762 762 bool 763 763 help 764 - KCOV does not have any arch-specific code, but currently it is enabled 765 - only for x86_64. KCOV requires testing on other archs, and most likely 766 - disabling of instrumentation for some early boot code. 764 + An architecture should select this when it can successfully 765 + build and run with CONFIG_KCOV. This typically requires 766 + disabling instrumentation for some early boot code. 767 767 768 768 config CC_HAS_SANCOV_TRACE_PC 769 769 def_bool $(cc-option,-fsanitize-coverage=trace-pc)
+2
mm/kmemleak.c
··· 1401 1401 /* 1402 1402 * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency. 1403 1403 */ 1404 + #ifdef CONFIG_SMP 1404 1405 static void scan_large_block(void *start, void *end) 1405 1406 { 1406 1407 void *next; ··· 1413 1412 cond_resched(); 1414 1413 } 1415 1414 } 1415 + #endif 1416 1416 1417 1417 /* 1418 1418 * Scan a memory block corresponding to a kmemleak_object. A condition is
+6 -1
mm/mmap.c
··· 45 45 #include <linux/moduleparam.h> 46 46 #include <linux/pkeys.h> 47 47 #include <linux/oom.h> 48 + #include <linux/sched/mm.h> 48 49 49 50 #include <linux/uaccess.h> 50 51 #include <asm/cacheflush.h> ··· 2526 2525 vma = find_vma_prev(mm, addr, &prev); 2527 2526 if (vma && (vma->vm_start <= addr)) 2528 2527 return vma; 2529 - if (!prev || expand_stack(prev, addr)) 2528 + /* don't alter vm_end if the coredump is running */ 2529 + if (!prev || !mmget_still_valid(mm) || expand_stack(prev, addr)) 2530 2530 return NULL; 2531 2531 if (prev->vm_flags & VM_LOCKED) 2532 2532 populate_vma_page_range(prev, addr, prev->vm_end, NULL); ··· 2552 2550 if (vma->vm_start <= addr) 2553 2551 return vma; 2554 2552 if (!(vma->vm_flags & VM_GROWSDOWN)) 2553 + return NULL; 2554 + /* don't alter vm_start if the coredump is running */ 2555 + if (!mmget_still_valid(mm)) 2555 2556 return NULL; 2556 2557 start = vma->vm_start; 2557 2558 if (expand_stack(vma, addr))
+18 -12
mm/page_alloc.c
··· 8005 8005 bool has_unmovable_pages(struct zone *zone, struct page *page, int count, 8006 8006 int migratetype, int flags) 8007 8007 { 8008 - unsigned long pfn, iter, found; 8008 + unsigned long found; 8009 + unsigned long iter = 0; 8010 + unsigned long pfn = page_to_pfn(page); 8011 + const char *reason = "unmovable page"; 8009 8012 8010 8013 /* 8011 8014 * TODO we could make this much more efficient by not checking every ··· 8018 8015 * can still lead to having bootmem allocations in zone_movable. 8019 8016 */ 8020 8017 8021 - /* 8022 - * CMA allocations (alloc_contig_range) really need to mark isolate 8023 - * CMA pageblocks even when they are not movable in fact so consider 8024 - * them movable here. 8025 - */ 8026 - if (is_migrate_cma(migratetype) && 8027 - is_migrate_cma(get_pageblock_migratetype(page))) 8028 - return false; 8018 + if (is_migrate_cma_page(page)) { 8019 + /* 8020 + * CMA allocations (alloc_contig_range) really need to mark 8021 + * isolate CMA pageblocks even when they are not movable in fact 8022 + * so consider them movable here. 8023 + */ 8024 + if (is_migrate_cma(migratetype)) 8025 + return false; 8029 8026 8030 - pfn = page_to_pfn(page); 8031 - for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { 8027 + reason = "CMA page"; 8028 + goto unmovable; 8029 + } 8030 + 8031 + for (found = 0; iter < pageblock_nr_pages; iter++) { 8032 8032 unsigned long check = pfn + iter; 8033 8033 8034 8034 if (!pfn_valid_within(check)) ··· 8111 8105 unmovable: 8112 8106 WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE); 8113 8107 if (flags & REPORT_FAILURE) 8114 - dump_page(pfn_to_page(pfn+iter), "unmovable page"); 8108 + dump_page(pfn_to_page(pfn + iter), reason); 8115 8109 return true; 8116 8110 } 8117 8111
+4 -4
mm/percpu.c
··· 2567 2567 ai->groups[group].base_offset = areas[group] - base; 2568 2568 } 2569 2569 2570 - pr_info("Embedded %zu pages/cpu @%p s%zu r%zu d%zu u%zu\n", 2571 - PFN_DOWN(size_sum), base, ai->static_size, ai->reserved_size, 2570 + pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n", 2571 + PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, 2572 2572 ai->dyn_size, ai->unit_size); 2573 2573 2574 2574 rc = pcpu_setup_first_chunk(ai, base); ··· 2692 2692 } 2693 2693 2694 2694 /* we're ready, commit */ 2695 - pr_info("%d %s pages/cpu @%p s%zu r%zu d%zu\n", 2696 - unit_pages, psize_str, vm.addr, ai->static_size, 2695 + pr_info("%d %s pages/cpu s%zu r%zu d%zu\n", 2696 + unit_pages, psize_str, ai->static_size, 2697 2697 ai->reserved_size, ai->dyn_size); 2698 2698 2699 2699 rc = pcpu_setup_first_chunk(ai, vm.addr);
+27 -31
mm/shmem.c
··· 1081 1081 } 1082 1082 spin_unlock(&sbinfo->shrinklist_lock); 1083 1083 } 1084 - if (!list_empty(&info->swaplist)) { 1084 + while (!list_empty(&info->swaplist)) { 1085 + /* Wait while shmem_unuse() is scanning this inode... */ 1086 + wait_var_event(&info->stop_eviction, 1087 + !atomic_read(&info->stop_eviction)); 1085 1088 mutex_lock(&shmem_swaplist_mutex); 1086 - list_del_init(&info->swaplist); 1089 + /* ...but beware of the race if we peeked too early */ 1090 + if (!atomic_read(&info->stop_eviction)) 1091 + list_del_init(&info->swaplist); 1087 1092 mutex_unlock(&shmem_swaplist_mutex); 1088 1093 } 1089 1094 } ··· 1104 1099 static int shmem_find_swap_entries(struct address_space *mapping, 1105 1100 pgoff_t start, unsigned int nr_entries, 1106 1101 struct page **entries, pgoff_t *indices, 1107 - bool frontswap) 1102 + unsigned int type, bool frontswap) 1108 1103 { 1109 1104 XA_STATE(xas, &mapping->i_pages, start); 1110 1105 struct page *page; 1106 + swp_entry_t entry; 1111 1107 unsigned int ret = 0; 1112 1108 1113 1109 if (!nr_entries) ··· 1122 1116 if (!xa_is_value(page)) 1123 1117 continue; 1124 1118 1125 - if (frontswap) { 1126 - swp_entry_t entry = radix_to_swp_entry(page); 1127 - 1128 - if (!frontswap_test(swap_info[swp_type(entry)], 1129 - swp_offset(entry))) 1130 - continue; 1131 - } 1119 + entry = radix_to_swp_entry(page); 1120 + if (swp_type(entry) != type) 1121 + continue; 1122 + if (frontswap && 1123 + !frontswap_test(swap_info[type], swp_offset(entry))) 1124 + continue; 1132 1125 1133 1126 indices[ret] = xas.xa_index; 1134 1127 entries[ret] = page; ··· 1199 1194 1200 1195 pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries, 1201 1196 pvec.pages, indices, 1202 - frontswap); 1197 + type, frontswap); 1203 1198 if (pvec.nr == 0) { 1204 1199 ret = 0; 1205 1200 break; ··· 1232 1227 unsigned long *fs_pages_to_unuse) 1233 1228 { 1234 1229 struct shmem_inode_info *info, *next; 1235 - struct inode *inode; 1236 - struct inode *prev_inode = NULL; 1237 1230 int error = 0; 1238 1231 1239 1232 if (list_empty(&shmem_swaplist)) 1240 1233 return 0; 1241 1234 1242 1235 mutex_lock(&shmem_swaplist_mutex); 1243 - 1244 - /* 1245 - * The extra refcount on the inode is necessary to safely dereference 1246 - * p->next after re-acquiring the lock. New shmem inodes with swap 1247 - * get added to the end of the list and we will scan them all. 1248 - */ 1249 1236 list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) { 1250 1237 if (!info->swapped) { 1251 1238 list_del_init(&info->swaplist); 1252 1239 continue; 1253 1240 } 1254 - 1255 - inode = igrab(&info->vfs_inode); 1256 - if (!inode) 1257 - continue; 1258 - 1241 + /* 1242 + * Drop the swaplist mutex while searching the inode for swap; 1243 + * but before doing so, make sure shmem_evict_inode() will not 1244 + * remove placeholder inode from swaplist, nor let it be freed 1245 + * (igrab() would protect from unlink, but not from unmount). 1246 + */ 1247 + atomic_inc(&info->stop_eviction); 1259 1248 mutex_unlock(&shmem_swaplist_mutex); 1260 - if (prev_inode) 1261 - iput(prev_inode); 1262 - prev_inode = inode; 1263 1249 1264 - error = shmem_unuse_inode(inode, type, frontswap, 1250 + error = shmem_unuse_inode(&info->vfs_inode, type, frontswap, 1265 1251 fs_pages_to_unuse); 1266 1252 cond_resched(); 1267 1253 ··· 1260 1264 next = list_next_entry(info, swaplist); 1261 1265 if (!info->swapped) 1262 1266 list_del_init(&info->swaplist); 1267 + if (atomic_dec_and_test(&info->stop_eviction)) 1268 + wake_up_var(&info->stop_eviction); 1263 1269 if (error) 1264 1270 break; 1265 1271 } 1266 1272 mutex_unlock(&shmem_swaplist_mutex); 1267 - 1268 - if (prev_inode) 1269 - iput(prev_inode); 1270 1273 1271 1274 return error; 1272 1275 } ··· 2233 2238 info = SHMEM_I(inode); 2234 2239 memset(info, 0, (char *)inode - (char *)info); 2235 2240 spin_lock_init(&info->lock); 2241 + atomic_set(&info->stop_eviction, 0); 2236 2242 info->seals = F_SEAL_SEAL; 2237 2243 info->flags = flags & VM_NORESERVE; 2238 2244 INIT_LIST_HEAD(&info->shrinklist);
-1
mm/slab.c
··· 2374 2374 /* Slab management obj is off-slab. */ 2375 2375 freelist = kmem_cache_alloc_node(cachep->freelist_cache, 2376 2376 local_flags, nodeid); 2377 - freelist = kasan_reset_tag(freelist); 2378 2377 if (!freelist) 2379 2378 return NULL; 2380 2379 } else {
+17 -15
mm/swapfile.c
··· 2023 2023 * If the boolean frontswap is true, only unuse pages_to_unuse pages; 2024 2024 * pages_to_unuse==0 means all pages; ignored if frontswap is false 2025 2025 */ 2026 - #define SWAP_UNUSE_MAX_TRIES 3 2027 2026 int try_to_unuse(unsigned int type, bool frontswap, 2028 2027 unsigned long pages_to_unuse) 2029 2028 { ··· 2034 2035 struct page *page; 2035 2036 swp_entry_t entry; 2036 2037 unsigned int i; 2037 - int retries = 0; 2038 2038 2039 2039 if (!si->inuse_pages) 2040 2040 return 0; ··· 2051 2053 2052 2054 spin_lock(&mmlist_lock); 2053 2055 p = &init_mm.mmlist; 2054 - while ((p = p->next) != &init_mm.mmlist) { 2055 - if (signal_pending(current)) { 2056 - retval = -EINTR; 2057 - break; 2058 - } 2056 + while (si->inuse_pages && 2057 + !signal_pending(current) && 2058 + (p = p->next) != &init_mm.mmlist) { 2059 2059 2060 2060 mm = list_entry(p, struct mm_struct, mmlist); 2061 2061 if (!mmget_not_zero(mm)) ··· 2080 2084 mmput(prev_mm); 2081 2085 2082 2086 i = 0; 2083 - while ((i = find_next_to_unuse(si, i, frontswap)) != 0) { 2087 + while (si->inuse_pages && 2088 + !signal_pending(current) && 2089 + (i = find_next_to_unuse(si, i, frontswap)) != 0) { 2084 2090 2085 2091 entry = swp_entry(type, i); 2086 2092 page = find_get_page(swap_address_space(entry), i); ··· 2115 2117 * If yes, we would need to do retry the unuse logic again. 2116 2118 * Under global memory pressure, swap entries can be reinserted back 2117 2119 * into process space after the mmlist loop above passes over them. 2118 - * Its not worth continuosuly retrying to unuse the swap in this case. 2119 - * So we try SWAP_UNUSE_MAX_TRIES times. 2120 + * 2121 + * Limit the number of retries? No: when mmget_not_zero() above fails, 2122 + * that mm is likely to be freeing swap from exit_mmap(), which proceeds 2123 + * at its own independent pace; and even shmem_writepage() could have 2124 + * been preempted after get_swap_page(), temporarily hiding that swap. 2125 + * It's easy and robust (though cpu-intensive) just to keep retrying. 2120 2126 */ 2121 - if (++retries >= SWAP_UNUSE_MAX_TRIES) 2122 - retval = -EBUSY; 2123 - else if (si->inuse_pages) 2124 - goto retry; 2125 - 2127 + if (si->inuse_pages) { 2128 + if (!signal_pending(current)) 2129 + goto retry; 2130 + retval = -EINTR; 2131 + } 2126 2132 out: 2127 2133 return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval; 2128 2134 }
+9 -20
mm/vmscan.c
··· 2176 2176 * 10TB 320 32GB 2177 2177 */ 2178 2178 static bool inactive_list_is_low(struct lruvec *lruvec, bool file, 2179 - struct mem_cgroup *memcg, 2180 2179 struct scan_control *sc, bool actual_reclaim) 2181 2180 { 2182 2181 enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE; ··· 2196 2197 inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx); 2197 2198 active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx); 2198 2199 2199 - if (memcg) 2200 - refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); 2201 - else 2202 - refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); 2203 - 2204 2200 /* 2205 2201 * When refaults are being observed, it means a new workingset 2206 2202 * is being established. Disable active list protection to get 2207 2203 * rid of the stale workingset quickly. 2208 2204 */ 2205 + refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); 2209 2206 if (file && actual_reclaim && lruvec->refaults != refaults) { 2210 2207 inactive_ratio = 0; 2211 2208 } else { ··· 2222 2227 } 2223 2228 2224 2229 static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, 2225 - struct lruvec *lruvec, struct mem_cgroup *memcg, 2226 - struct scan_control *sc) 2230 + struct lruvec *lruvec, struct scan_control *sc) 2227 2231 { 2228 2232 if (is_active_lru(lru)) { 2229 - if (inactive_list_is_low(lruvec, is_file_lru(lru), 2230 - memcg, sc, true)) 2233 + if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true)) 2231 2234 shrink_active_list(nr_to_scan, lruvec, sc, lru); 2232 2235 return 0; 2233 2236 } ··· 2325 2332 * anonymous pages on the LRU in eligible zones. 2326 2333 * Otherwise, the small LRU gets thrashed. 2327 2334 */ 2328 - if (!inactive_list_is_low(lruvec, false, memcg, sc, false) && 2335 + if (!inactive_list_is_low(lruvec, false, sc, false) && 2329 2336 lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx) 2330 2337 >> sc->priority) { 2331 2338 scan_balance = SCAN_ANON; ··· 2343 2350 * lruvec even if it has plenty of old anonymous pages unless the 2344 2351 * system is under heavy pressure. 2345 2352 */ 2346 - if (!inactive_list_is_low(lruvec, true, memcg, sc, false) && 2353 + if (!inactive_list_is_low(lruvec, true, sc, false) && 2347 2354 lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) { 2348 2355 scan_balance = SCAN_FILE; 2349 2356 goto out; ··· 2496 2503 nr[lru] -= nr_to_scan; 2497 2504 2498 2505 nr_reclaimed += shrink_list(lru, nr_to_scan, 2499 - lruvec, memcg, sc); 2506 + lruvec, sc); 2500 2507 } 2501 2508 } 2502 2509 ··· 2563 2570 * Even if we did not try to evict anon pages at all, we want to 2564 2571 * rebalance the anon lru active/inactive ratio. 2565 2572 */ 2566 - if (inactive_list_is_low(lruvec, false, memcg, sc, true)) 2573 + if (inactive_list_is_low(lruvec, false, sc, true)) 2567 2574 shrink_active_list(SWAP_CLUSTER_MAX, lruvec, 2568 2575 sc, LRU_ACTIVE_ANON); 2569 2576 } ··· 2962 2969 unsigned long refaults; 2963 2970 struct lruvec *lruvec; 2964 2971 2965 - if (memcg) 2966 - refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); 2967 - else 2968 - refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); 2969 - 2970 2972 lruvec = mem_cgroup_lruvec(pgdat, memcg); 2973 + refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); 2971 2974 lruvec->refaults = refaults; 2972 2975 } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL))); 2973 2976 } ··· 3328 3339 do { 3329 3340 struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg); 3330 3341 3331 - if (inactive_list_is_low(lruvec, false, memcg, sc, true)) 3342 + if (inactive_list_is_low(lruvec, false, sc, true)) 3332 3343 shrink_active_list(SWAP_CLUSTER_MAX, lruvec, 3333 3344 sc, LRU_ACTIVE_ANON); 3334 3345
-5
mm/vmstat.c
··· 1274 1274 #endif 1275 1275 #endif /* CONFIG_MEMORY_BALLOON */ 1276 1276 #ifdef CONFIG_DEBUG_TLBFLUSH 1277 - #ifdef CONFIG_SMP 1278 1277 "nr_tlb_remote_flush", 1279 1278 "nr_tlb_remote_flush_received", 1280 - #else 1281 - "", /* nr_tlb_remote_flush */ 1282 - "", /* nr_tlb_remote_flush_received */ 1283 - #endif /* CONFIG_SMP */ 1284 1279 "nr_tlb_local_flush_all", 1285 1280 "nr_tlb_local_flush_one", 1286 1281 #endif /* CONFIG_DEBUG_TLBFLUSH */
+2 -1
net/bridge/netfilter/ebtables.c
··· 2027 2027 if (match_kern) 2028 2028 match_kern->match_size = ret; 2029 2029 2030 - if (WARN_ON(type == EBT_COMPAT_TARGET && size_left)) 2030 + /* rule should have no remaining data after target */ 2031 + if (type == EBT_COMPAT_TARGET && size_left) 2031 2032 return -EINVAL; 2032 2033 2033 2034 match32 = (struct compat_ebt_entry_mwt *) buf;
+24 -10
net/ipv4/route.c
··· 1198 1198 return dst; 1199 1199 } 1200 1200 1201 - static void ipv4_link_failure(struct sk_buff *skb) 1201 + static void ipv4_send_dest_unreach(struct sk_buff *skb) 1202 1202 { 1203 1203 struct ip_options opt; 1204 - struct rtable *rt; 1205 1204 int res; 1206 1205 1207 1206 /* Recompile ip options since IPCB may not be valid anymore. 1207 + * Also check we have a reasonable ipv4 header. 1208 1208 */ 1209 - memset(&opt, 0, sizeof(opt)); 1210 - opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); 1211 - 1212 - rcu_read_lock(); 1213 - res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); 1214 - rcu_read_unlock(); 1215 - 1216 - if (res) 1209 + if (!pskb_network_may_pull(skb, sizeof(struct iphdr)) || 1210 + ip_hdr(skb)->version != 4 || ip_hdr(skb)->ihl < 5) 1217 1211 return; 1218 1212 1213 + memset(&opt, 0, sizeof(opt)); 1214 + if (ip_hdr(skb)->ihl > 5) { 1215 + if (!pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4)) 1216 + return; 1217 + opt.optlen = ip_hdr(skb)->ihl * 4 - sizeof(struct iphdr); 1218 + 1219 + rcu_read_lock(); 1220 + res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); 1221 + rcu_read_unlock(); 1222 + 1223 + if (res) 1224 + return; 1225 + } 1219 1226 __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); 1227 + } 1228 + 1229 + static void ipv4_link_failure(struct sk_buff *skb) 1230 + { 1231 + struct rtable *rt; 1232 + 1233 + ipv4_send_dest_unreach(skb); 1220 1234 1221 1235 rt = skb_rtable(skb); 1222 1236 if (rt)
+4 -1
net/ipv4/sysctl_net_ipv4.c
··· 49 49 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; 50 50 static int comp_sack_nr_max = 255; 51 51 static u32 u32_max_div_HZ = UINT_MAX / HZ; 52 + static int one_day_secs = 24 * 3600; 52 53 53 54 /* obsolete */ 54 55 static int sysctl_tcp_low_latency __read_mostly; ··· 1161 1160 .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen, 1162 1161 .maxlen = sizeof(int), 1163 1162 .mode = 0644, 1164 - .proc_handler = proc_dointvec 1163 + .proc_handler = proc_dointvec_minmax, 1164 + .extra1 = &zero, 1165 + .extra2 = &one_day_secs 1165 1166 }, 1166 1167 { 1167 1168 .procname = "tcp_autocorking",
+1 -1
net/ipv6/addrlabel.c
··· 476 476 } 477 477 478 478 if (nlmsg_attrlen(nlh, sizeof(*ifal))) { 479 - NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump requewst"); 479 + NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump request"); 480 480 return -EINVAL; 481 481 } 482 482
+5 -1
net/ncsi/ncsi-rsp.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 13 #include <linux/netdevice.h> 14 + #include <linux/etherdevice.h> 14 15 #include <linux/skbuff.h> 15 16 16 17 #include <net/ncsi.h> ··· 668 667 ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 669 668 memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN); 670 669 /* Increase mac address by 1 for BMC's address */ 671 - saddr.sa_data[ETH_ALEN - 1]++; 670 + eth_addr_inc((u8 *)saddr.sa_data); 671 + if (!is_valid_ether_addr((const u8 *)saddr.sa_data)) 672 + return -ENXIO; 673 + 672 674 ret = ops->ndo_set_mac_address(ndev, &saddr); 673 675 if (ret < 0) 674 676 netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
+1 -1
net/netfilter/ipvs/ip_vs_core.c
··· 1678 1678 if (!cp) { 1679 1679 int v; 1680 1680 1681 - if (!sysctl_schedule_icmp(ipvs)) 1681 + if (ipip || !sysctl_schedule_icmp(ipvs)) 1682 1682 return NF_ACCEPT; 1683 1683 1684 1684 if (!ip_vs_try_to_schedule(ipvs, AF_INET, skb, pd, &v, &cp, &ciph))
+38 -5
net/netfilter/nf_conntrack_core.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/random.h> 27 27 #include <linux/jhash.h> 28 + #include <linux/siphash.h> 28 29 #include <linux/err.h> 29 30 #include <linux/percpu.h> 30 31 #include <linux/moduleparam.h> ··· 449 448 return true; 450 449 } 451 450 EXPORT_SYMBOL_GPL(nf_ct_invert_tuple); 451 + 452 + /* Generate a almost-unique pseudo-id for a given conntrack. 453 + * 454 + * intentionally doesn't re-use any of the seeds used for hash 455 + * table location, we assume id gets exposed to userspace. 456 + * 457 + * Following nf_conn items do not change throughout lifetime 458 + * of the nf_conn after it has been committed to main hash table: 459 + * 460 + * 1. nf_conn address 461 + * 2. nf_conn->ext address 462 + * 3. nf_conn->master address (normally NULL) 463 + * 4. tuple 464 + * 5. the associated net namespace 465 + */ 466 + u32 nf_ct_get_id(const struct nf_conn *ct) 467 + { 468 + static __read_mostly siphash_key_t ct_id_seed; 469 + unsigned long a, b, c, d; 470 + 471 + net_get_random_once(&ct_id_seed, sizeof(ct_id_seed)); 472 + 473 + a = (unsigned long)ct; 474 + b = (unsigned long)ct->master ^ net_hash_mix(nf_ct_net(ct)); 475 + c = (unsigned long)ct->ext; 476 + d = (unsigned long)siphash(&ct->tuplehash, sizeof(ct->tuplehash), 477 + &ct_id_seed); 478 + #ifdef CONFIG_64BIT 479 + return siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &ct_id_seed); 480 + #else 481 + return siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &ct_id_seed); 482 + #endif 483 + } 484 + EXPORT_SYMBOL_GPL(nf_ct_get_id); 452 485 453 486 static void 454 487 clean_from_lists(struct nf_conn *ct) ··· 1017 982 1018 983 /* set conntrack timestamp, if enabled. */ 1019 984 tstamp = nf_conn_tstamp_find(ct); 1020 - if (tstamp) { 1021 - if (skb->tstamp == 0) 1022 - __net_timestamp(skb); 985 + if (tstamp) 986 + tstamp->start = ktime_get_real_ns(); 1023 987 1024 - tstamp->start = ktime_to_ns(skb->tstamp); 1025 - } 1026 988 /* Since the lookup is lockless, hash insertion must be done after 1027 989 * starting the timer and setting the CONFIRMED bit. The RCU barriers 1028 990 * guarantee that no other CPU can find the conntrack before the above ··· 1382 1350 /* save hash for reusing when confirming */ 1383 1351 *(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash; 1384 1352 ct->status = 0; 1353 + ct->timeout = 0; 1385 1354 write_pnet(&ct->ct_net, net); 1386 1355 memset(&ct->__nfct_init_offset[0], 0, 1387 1356 offsetof(struct nf_conn, proto) -
+29 -5
net/netfilter/nf_conntrack_netlink.c
··· 29 29 #include <linux/spinlock.h> 30 30 #include <linux/interrupt.h> 31 31 #include <linux/slab.h> 32 + #include <linux/siphash.h> 32 33 33 34 #include <linux/netfilter.h> 34 35 #include <net/netlink.h> ··· 486 485 487 486 static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct) 488 487 { 489 - if (nla_put_be32(skb, CTA_ID, htonl((unsigned long)ct))) 488 + __be32 id = (__force __be32)nf_ct_get_id(ct); 489 + 490 + if (nla_put_be32(skb, CTA_ID, id)) 490 491 goto nla_put_failure; 491 492 return 0; 492 493 ··· 1289 1286 } 1290 1287 1291 1288 if (cda[CTA_ID]) { 1292 - u_int32_t id = ntohl(nla_get_be32(cda[CTA_ID])); 1293 - if (id != (u32)(unsigned long)ct) { 1289 + __be32 id = nla_get_be32(cda[CTA_ID]); 1290 + 1291 + if (id != (__force __be32)nf_ct_get_id(ct)) { 1294 1292 nf_ct_put(ct); 1295 1293 return -ENOENT; 1296 1294 } ··· 2696 2692 2697 2693 static const union nf_inet_addr any_addr; 2698 2694 2695 + static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp) 2696 + { 2697 + static __read_mostly siphash_key_t exp_id_seed; 2698 + unsigned long a, b, c, d; 2699 + 2700 + net_get_random_once(&exp_id_seed, sizeof(exp_id_seed)); 2701 + 2702 + a = (unsigned long)exp; 2703 + b = (unsigned long)exp->helper; 2704 + c = (unsigned long)exp->master; 2705 + d = (unsigned long)siphash(&exp->tuple, sizeof(exp->tuple), &exp_id_seed); 2706 + 2707 + #ifdef CONFIG_64BIT 2708 + return (__force __be32)siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &exp_id_seed); 2709 + #else 2710 + return (__force __be32)siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &exp_id_seed); 2711 + #endif 2712 + } 2713 + 2699 2714 static int 2700 2715 ctnetlink_exp_dump_expect(struct sk_buff *skb, 2701 2716 const struct nf_conntrack_expect *exp) ··· 2762 2739 } 2763 2740 #endif 2764 2741 if (nla_put_be32(skb, CTA_EXPECT_TIMEOUT, htonl(timeout)) || 2765 - nla_put_be32(skb, CTA_EXPECT_ID, htonl((unsigned long)exp)) || 2742 + nla_put_be32(skb, CTA_EXPECT_ID, nf_expect_get_id(exp)) || 2766 2743 nla_put_be32(skb, CTA_EXPECT_FLAGS, htonl(exp->flags)) || 2767 2744 nla_put_be32(skb, CTA_EXPECT_CLASS, htonl(exp->class))) 2768 2745 goto nla_put_failure; ··· 3067 3044 3068 3045 if (cda[CTA_EXPECT_ID]) { 3069 3046 __be32 id = nla_get_be32(cda[CTA_EXPECT_ID]); 3070 - if (ntohl(id) != (u32)(unsigned long)exp) { 3047 + 3048 + if (id != nf_expect_get_id(exp)) { 3071 3049 nf_ct_expect_put(exp); 3072 3050 return -ENOENT; 3073 3051 }
+1 -1
net/netfilter/nf_conntrack_proto.c
··· 55 55 struct va_format vaf; 56 56 va_list args; 57 57 58 - if (net->ct.sysctl_log_invalid != protonum || 58 + if (net->ct.sysctl_log_invalid != protonum && 59 59 net->ct.sysctl_log_invalid != IPPROTO_RAW) 60 60 return; 61 61
+74 -23
net/netfilter/nf_conntrack_proto_icmp.c
··· 103 103 return NF_ACCEPT; 104 104 } 105 105 106 - /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ 107 - static int 108 - icmp_error_message(struct nf_conn *tmpl, struct sk_buff *skb, 109 - const struct nf_hook_state *state) 106 + /* Check inner header is related to any of the existing connections */ 107 + int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb, 108 + unsigned int dataoff, 109 + const struct nf_hook_state *state, 110 + u8 l4proto, union nf_inet_addr *outer_daddr) 110 111 { 111 112 struct nf_conntrack_tuple innertuple, origtuple; 112 113 const struct nf_conntrack_tuple_hash *h; 113 114 const struct nf_conntrack_zone *zone; 114 115 enum ip_conntrack_info ctinfo; 115 116 struct nf_conntrack_zone tmp; 117 + union nf_inet_addr *ct_daddr; 118 + enum ip_conntrack_dir dir; 119 + struct nf_conn *ct; 116 120 117 121 WARN_ON(skb_nfct(skb)); 118 122 zone = nf_ct_zone_tmpl(tmpl, skb, &tmp); 119 123 120 124 /* Are they talking about one of our connections? */ 121 - if (!nf_ct_get_tuplepr(skb, 122 - skb_network_offset(skb) + ip_hdrlen(skb) 123 - + sizeof(struct icmphdr), 124 - PF_INET, state->net, &origtuple)) { 125 - pr_debug("icmp_error_message: failed to get tuple\n"); 125 + if (!nf_ct_get_tuplepr(skb, dataoff, 126 + state->pf, state->net, &origtuple)) 126 127 return -NF_ACCEPT; 127 - } 128 128 129 129 /* Ordinarily, we'd expect the inverted tupleproto, but it's 130 130 been preserved inside the ICMP. */ 131 - if (!nf_ct_invert_tuple(&innertuple, &origtuple)) { 132 - pr_debug("icmp_error_message: no match\n"); 131 + if (!nf_ct_invert_tuple(&innertuple, &origtuple)) 132 + return -NF_ACCEPT; 133 + 134 + h = nf_conntrack_find_get(state->net, zone, &innertuple); 135 + if (!h) 136 + return -NF_ACCEPT; 137 + 138 + /* Consider: A -> T (=This machine) -> B 139 + * Conntrack entry will look like this: 140 + * Original: A->B 141 + * Reply: B->T (SNAT case) OR A 142 + * 143 + * When this function runs, we got packet that looks like this: 144 + * iphdr|icmphdr|inner_iphdr|l4header (tcp, udp, ..). 145 + * 146 + * Above nf_conntrack_find_get() makes lookup based on inner_hdr, 147 + * so we should expect that destination of the found connection 148 + * matches outer header destination address. 149 + * 150 + * In above example, we can consider these two cases: 151 + * 1. Error coming in reply direction from B or M (middle box) to 152 + * T (SNAT case) or A. 153 + * Inner saddr will be B, dst will be T or A. 154 + * The found conntrack will be reply tuple (B->T/A). 155 + * 2. Error coming in original direction from A or M to B. 156 + * Inner saddr will be A, inner daddr will be B. 157 + * The found conntrack will be original tuple (A->B). 158 + * 159 + * In both cases, conntrack[dir].dst == inner.dst. 160 + * 161 + * A bogus packet could look like this: 162 + * Inner: B->T 163 + * Outer: B->X (other machine reachable by T). 164 + * 165 + * In this case, lookup yields connection A->B and will 166 + * set packet from B->X as *RELATED*, even though no connection 167 + * from X was ever seen. 168 + */ 169 + ct = nf_ct_tuplehash_to_ctrack(h); 170 + dir = NF_CT_DIRECTION(h); 171 + ct_daddr = &ct->tuplehash[dir].tuple.dst.u3; 172 + if (!nf_inet_addr_cmp(outer_daddr, ct_daddr)) { 173 + if (state->pf == AF_INET) { 174 + nf_l4proto_log_invalid(skb, state->net, state->pf, 175 + l4proto, 176 + "outer daddr %pI4 != inner %pI4", 177 + &outer_daddr->ip, &ct_daddr->ip); 178 + } else if (state->pf == AF_INET6) { 179 + nf_l4proto_log_invalid(skb, state->net, state->pf, 180 + l4proto, 181 + "outer daddr %pI6 != inner %pI6", 182 + &outer_daddr->ip6, &ct_daddr->ip6); 183 + } 184 + nf_ct_put(ct); 133 185 return -NF_ACCEPT; 134 186 } 135 187 136 188 ctinfo = IP_CT_RELATED; 137 - 138 - h = nf_conntrack_find_get(state->net, zone, &innertuple); 139 - if (!h) { 140 - pr_debug("icmp_error_message: no match\n"); 141 - return -NF_ACCEPT; 142 - } 143 - 144 - if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) 189 + if (dir == IP_CT_DIR_REPLY) 145 190 ctinfo += IP_CT_IS_REPLY; 146 191 147 192 /* Update skb to refer to this connection */ 148 - nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo); 193 + nf_ct_set(skb, ct, ctinfo); 149 194 return NF_ACCEPT; 150 195 } 151 196 ··· 207 162 struct sk_buff *skb, unsigned int dataoff, 208 163 const struct nf_hook_state *state) 209 164 { 165 + union nf_inet_addr outer_daddr; 210 166 const struct icmphdr *icmph; 211 167 struct icmphdr _ih; 212 168 213 169 /* Not enough header? */ 214 - icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); 170 + icmph = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); 215 171 if (icmph == NULL) { 216 172 icmp_error_log(skb, state, "short packet"); 217 173 return -NF_ACCEPT; ··· 245 199 icmph->type != ICMP_REDIRECT) 246 200 return NF_ACCEPT; 247 201 248 - return icmp_error_message(tmpl, skb, state); 202 + memset(&outer_daddr, 0, sizeof(outer_daddr)); 203 + outer_daddr.ip = ip_hdr(skb)->daddr; 204 + 205 + dataoff += sizeof(*icmph); 206 + return nf_conntrack_inet_error(tmpl, skb, dataoff, state, 207 + IPPROTO_ICMP, &outer_daddr); 249 208 } 250 209 251 210 #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
+6 -46
net/netfilter/nf_conntrack_proto_icmpv6.c
··· 123 123 return NF_ACCEPT; 124 124 } 125 125 126 - static int 127 - icmpv6_error_message(struct net *net, struct nf_conn *tmpl, 128 - struct sk_buff *skb, 129 - unsigned int icmp6off) 130 - { 131 - struct nf_conntrack_tuple intuple, origtuple; 132 - const struct nf_conntrack_tuple_hash *h; 133 - enum ip_conntrack_info ctinfo; 134 - struct nf_conntrack_zone tmp; 135 - 136 - WARN_ON(skb_nfct(skb)); 137 - 138 - /* Are they talking about one of our connections? */ 139 - if (!nf_ct_get_tuplepr(skb, 140 - skb_network_offset(skb) 141 - + sizeof(struct ipv6hdr) 142 - + sizeof(struct icmp6hdr), 143 - PF_INET6, net, &origtuple)) { 144 - pr_debug("icmpv6_error: Can't get tuple\n"); 145 - return -NF_ACCEPT; 146 - } 147 - 148 - /* Ordinarily, we'd expect the inverted tupleproto, but it's 149 - been preserved inside the ICMP. */ 150 - if (!nf_ct_invert_tuple(&intuple, &origtuple)) { 151 - pr_debug("icmpv6_error: Can't invert tuple\n"); 152 - return -NF_ACCEPT; 153 - } 154 - 155 - ctinfo = IP_CT_RELATED; 156 - 157 - h = nf_conntrack_find_get(net, nf_ct_zone_tmpl(tmpl, skb, &tmp), 158 - &intuple); 159 - if (!h) { 160 - pr_debug("icmpv6_error: no match\n"); 161 - return -NF_ACCEPT; 162 - } else { 163 - if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) 164 - ctinfo += IP_CT_IS_REPLY; 165 - } 166 - 167 - /* Update skb to refer to this connection */ 168 - nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo); 169 - return NF_ACCEPT; 170 - } 171 126 172 127 static void icmpv6_error_log(const struct sk_buff *skb, 173 128 const struct nf_hook_state *state, ··· 137 182 unsigned int dataoff, 138 183 const struct nf_hook_state *state) 139 184 { 185 + union nf_inet_addr outer_daddr; 140 186 const struct icmp6hdr *icmp6h; 141 187 struct icmp6hdr _ih; 142 188 int type; ··· 166 210 if (icmp6h->icmp6_type >= 128) 167 211 return NF_ACCEPT; 168 212 169 - return icmpv6_error_message(state->net, tmpl, skb, dataoff); 213 + memcpy(&outer_daddr.ip6, &ipv6_hdr(skb)->daddr, 214 + sizeof(outer_daddr.ip6)); 215 + dataoff += sizeof(*icmp6h); 216 + return nf_conntrack_inet_error(tmpl, skb, dataoff, state, 217 + IPPROTO_ICMPV6, &outer_daddr); 170 218 } 171 219 172 220 #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
+8 -3
net/netfilter/nf_nat_core.c
··· 415 415 case IPPROTO_ICMPV6: 416 416 /* id is same for either direction... */ 417 417 keyptr = &tuple->src.u.icmp.id; 418 - min = range->min_proto.icmp.id; 419 - range_size = ntohs(range->max_proto.icmp.id) - 420 - ntohs(range->min_proto.icmp.id) + 1; 418 + if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) { 419 + min = 0; 420 + range_size = 65536; 421 + } else { 422 + min = ntohs(range->min_proto.icmp.id); 423 + range_size = ntohs(range->max_proto.icmp.id) - 424 + ntohs(range->min_proto.icmp.id) + 1; 425 + } 421 426 goto find_free_id; 422 427 #if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE) 423 428 case IPPROTO_GRE:
+1 -1
net/netfilter/nf_tables_api.c
··· 1544 1544 if (IS_ERR(type)) 1545 1545 return PTR_ERR(type); 1546 1546 } 1547 - if (!(type->hook_mask & (1 << hook->num))) 1547 + if (hook->num > NF_MAX_HOOKS || !(type->hook_mask & (1 << hook->num))) 1548 1548 return -EOPNOTSUPP; 1549 1549 1550 1550 if (type->type == NFT_CHAIN_T_NAT &&
+14 -9
net/netfilter/xt_time.c
··· 163 163 s64 stamp; 164 164 165 165 /* 166 - * We cannot use get_seconds() instead of __net_timestamp() here. 166 + * We need real time here, but we can neither use skb->tstamp 167 + * nor __net_timestamp(). 168 + * 169 + * skb->tstamp and skb->skb_mstamp_ns overlap, however, they 170 + * use different clock types (real vs monotonic). 171 + * 167 172 * Suppose you have two rules: 168 - * 1. match before 13:00 169 - * 2. match after 13:00 173 + * 1. match before 13:00 174 + * 2. match after 13:00 175 + * 170 176 * If you match against processing time (get_seconds) it 171 177 * may happen that the same packet matches both rules if 172 - * it arrived at the right moment before 13:00. 178 + * it arrived at the right moment before 13:00, so it would be 179 + * better to check skb->tstamp and set it via __net_timestamp() 180 + * if needed. This however breaks outgoing packets tx timestamp, 181 + * and causes them to get delayed forever by fq packet scheduler. 173 182 */ 174 - if (skb->tstamp == 0) 175 - __net_timestamp((struct sk_buff *)skb); 176 - 177 - stamp = ktime_to_ns(skb->tstamp); 178 - stamp = div_s64(stamp, NSEC_PER_SEC); 183 + stamp = get_seconds(); 179 184 180 185 if (info->flags & XT_TIME_LOCAL_TZ) 181 186 /* Adjust for local timezone */
+11
net/rds/ib_fmr.c
··· 44 44 else 45 45 pool = rds_ibdev->mr_1m_pool; 46 46 47 + if (atomic_read(&pool->dirty_count) >= pool->max_items / 10) 48 + queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10); 49 + 50 + /* Switch pools if one of the pool is reaching upper limit */ 51 + if (atomic_read(&pool->dirty_count) >= pool->max_items * 9 / 10) { 52 + if (pool->pool_type == RDS_IB_MR_8K_POOL) 53 + pool = rds_ibdev->mr_1m_pool; 54 + else 55 + pool = rds_ibdev->mr_8k_pool; 56 + } 57 + 47 58 ibmr = rds_ib_try_reuse_ibmr(pool); 48 59 if (ibmr) 49 60 return ibmr;
-3
net/rds/ib_rdma.c
··· 454 454 struct rds_ib_mr *ibmr = NULL; 455 455 int iter = 0; 456 456 457 - if (atomic_read(&pool->dirty_count) >= pool->max_items_soft / 10) 458 - queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10); 459 - 460 457 while (1) { 461 458 ibmr = rds_ib_reuse_mr(pool); 462 459 if (ibmr)
+16 -11
net/rose/rose_loopback.c
··· 16 16 #include <linux/init.h> 17 17 18 18 static struct sk_buff_head loopback_queue; 19 + #define ROSE_LOOPBACK_LIMIT 1000 19 20 static struct timer_list loopback_timer; 20 21 21 22 static void rose_set_loopback_timer(void); ··· 36 35 37 36 int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh) 38 37 { 39 - struct sk_buff *skbn; 38 + struct sk_buff *skbn = NULL; 40 39 41 - skbn = skb_clone(skb, GFP_ATOMIC); 40 + if (skb_queue_len(&loopback_queue) < ROSE_LOOPBACK_LIMIT) 41 + skbn = skb_clone(skb, GFP_ATOMIC); 42 42 43 - kfree_skb(skb); 44 - 45 - if (skbn != NULL) { 43 + if (skbn) { 44 + consume_skb(skb); 46 45 skb_queue_tail(&loopback_queue, skbn); 47 46 48 47 if (!rose_loopback_running()) 49 48 rose_set_loopback_timer(); 49 + } else { 50 + kfree_skb(skb); 50 51 } 51 52 52 53 return 1; 53 54 } 54 55 55 - 56 56 static void rose_set_loopback_timer(void) 57 57 { 58 - del_timer(&loopback_timer); 59 - 60 - loopback_timer.expires = jiffies + 10; 61 - add_timer(&loopback_timer); 58 + mod_timer(&loopback_timer, jiffies + 10); 62 59 } 63 60 64 61 static void rose_loopback_timer(struct timer_list *unused) ··· 67 68 struct sock *sk; 68 69 unsigned short frametype; 69 70 unsigned int lci_i, lci_o; 71 + int count; 70 72 71 - while ((skb = skb_dequeue(&loopback_queue)) != NULL) { 73 + for (count = 0; count < ROSE_LOOPBACK_LIMIT; count++) { 74 + skb = skb_dequeue(&loopback_queue); 75 + if (!skb) 76 + return; 72 77 if (skb->len < ROSE_MIN_LEN) { 73 78 kfree_skb(skb); 74 79 continue; ··· 109 106 kfree_skb(skb); 110 107 } 111 108 } 109 + if (!skb_queue_empty(&loopback_queue)) 110 + mod_timer(&loopback_timer, jiffies + 1); 112 111 } 113 112 114 113 void __exit rose_loopback_clear(void)
+8 -4
net/rxrpc/input.c
··· 1161 1161 * handle data received on the local endpoint 1162 1162 * - may be called in interrupt context 1163 1163 * 1164 - * The socket is locked by the caller and this prevents the socket from being 1165 - * shut down and the local endpoint from going away, thus sk_user_data will not 1166 - * be cleared until this function returns. 1164 + * [!] Note that as this is called from the encap_rcv hook, the socket is not 1165 + * held locked by the caller and nothing prevents sk_user_data on the UDP from 1166 + * being cleared in the middle of processing this function. 1167 1167 * 1168 1168 * Called with the RCU read lock held from the IP layer via UDP. 1169 1169 */ 1170 1170 int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) 1171 1171 { 1172 + struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk); 1172 1173 struct rxrpc_connection *conn; 1173 1174 struct rxrpc_channel *chan; 1174 1175 struct rxrpc_call *call = NULL; 1175 1176 struct rxrpc_skb_priv *sp; 1176 - struct rxrpc_local *local = udp_sk->sk_user_data; 1177 1177 struct rxrpc_peer *peer = NULL; 1178 1178 struct rxrpc_sock *rx = NULL; 1179 1179 unsigned int channel; ··· 1181 1181 1182 1182 _enter("%p", udp_sk); 1183 1183 1184 + if (unlikely(!local)) { 1185 + kfree_skb(skb); 1186 + return 0; 1187 + } 1184 1188 if (skb->tstamp == 0) 1185 1189 skb->tstamp = ktime_get_real(); 1186 1190
+2 -1
net/rxrpc/local_object.c
··· 304 304 ret = -ENOMEM; 305 305 sock_error: 306 306 mutex_unlock(&rxnet->local_mutex); 307 - kfree(local); 307 + if (local) 308 + call_rcu(&local->rcu, rxrpc_local_rcu); 308 309 _leave(" = %d", ret); 309 310 return ERR_PTR(ret); 310 311
+3
net/sunrpc/cache.c
··· 54 54 h->last_refresh = now; 55 55 } 56 56 57 + static inline int cache_is_valid(struct cache_head *h); 57 58 static void cache_fresh_locked(struct cache_head *head, time_t expiry, 58 59 struct cache_detail *detail); 59 60 static void cache_fresh_unlocked(struct cache_head *head, ··· 106 105 if (cache_is_expired(detail, tmp)) { 107 106 hlist_del_init_rcu(&tmp->cache_list); 108 107 detail->entries --; 108 + if (cache_is_valid(tmp) == -EAGAIN) 109 + set_bit(CACHE_NEGATIVE, &tmp->flags); 109 110 cache_fresh_locked(tmp, 0, detail); 110 111 freeme = tmp; 111 112 break;
+5 -2
net/sunrpc/clnt.c
··· 2081 2081 * test first. 2082 2082 */ 2083 2083 if (rpc_task_transmitted(task)) { 2084 - if (task->tk_status == 0) 2085 - xprt_request_wait_receive(task); 2084 + task->tk_status = 0; 2085 + xprt_request_wait_receive(task); 2086 2086 return; 2087 2087 } 2088 2088 ··· 2166 2166 call_bc_transmit_status(struct rpc_task *task) 2167 2167 { 2168 2168 struct rpc_rqst *req = task->tk_rqstp; 2169 + 2170 + if (rpc_task_transmitted(task)) 2171 + task->tk_status = 0; 2169 2172 2170 2173 dprint_status(task); 2171 2174
+2 -2
net/tls/tls_device.c
··· 904 904 goto release_netdev; 905 905 906 906 free_sw_resources: 907 + up_read(&device_offload_lock); 907 908 tls_sw_free_resources_rx(sk); 909 + down_read(&device_offload_lock); 908 910 release_ctx: 909 911 ctx->priv_ctx_rx = NULL; 910 912 release_netdev: ··· 941 939 } 942 940 out: 943 941 up_read(&device_offload_lock); 944 - kfree(tls_ctx->rx.rec_seq); 945 - kfree(tls_ctx->rx.iv); 946 942 tls_sw_release_resources_rx(sk); 947 943 } 948 944
+10 -3
net/tls/tls_device_fallback.c
··· 194 194 195 195 static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln) 196 196 { 197 + struct sock *sk = skb->sk; 198 + int delta; 199 + 197 200 skb_copy_header(nskb, skb); 198 201 199 202 skb_put(nskb, skb->len); ··· 204 201 update_chksum(nskb, headln); 205 202 206 203 nskb->destructor = skb->destructor; 207 - nskb->sk = skb->sk; 204 + nskb->sk = sk; 208 205 skb->destructor = NULL; 209 206 skb->sk = NULL; 210 - refcount_add(nskb->truesize - skb->truesize, 211 - &nskb->sk->sk_wmem_alloc); 207 + 208 + delta = nskb->truesize - skb->truesize; 209 + if (likely(delta < 0)) 210 + WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc)); 211 + else if (delta) 212 + refcount_add(delta, &sk->sk_wmem_alloc); 212 213 } 213 214 214 215 /* This function may be called after the user socket is already
+1 -4
net/tls/tls_main.c
··· 293 293 #endif 294 294 } 295 295 296 - if (ctx->rx_conf == TLS_SW) { 297 - kfree(ctx->rx.rec_seq); 298 - kfree(ctx->rx.iv); 296 + if (ctx->rx_conf == TLS_SW) 299 297 tls_sw_free_resources_rx(sk); 300 - } 301 298 302 299 #ifdef CONFIG_TLS_DEVICE 303 300 if (ctx->rx_conf == TLS_HW)
+3
net/tls/tls_sw.c
··· 2091 2091 struct tls_context *tls_ctx = tls_get_ctx(sk); 2092 2092 struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 2093 2093 2094 + kfree(tls_ctx->rx.rec_seq); 2095 + kfree(tls_ctx->rx.iv); 2096 + 2094 2097 if (ctx->aead_recv) { 2095 2098 kfree_skb(ctx->recv_pkt); 2096 2099 ctx->recv_pkt = NULL;
+1 -1
scripts/atomic/gen-atomics.sh
··· 13 13 gen-atomic-fallback.sh linux/atomic-fallback.h 14 14 EOF 15 15 while read script header; do 16 - ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header} 16 + /bin/sh ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header} 17 17 HASH="$(sha1sum ${LINUXDIR}/include/${header})" 18 18 HASH="${HASH%% *}" 19 19 printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header}
+1 -1
security/device_cgroup.c
··· 560 560 devcg->behavior == DEVCG_DEFAULT_ALLOW) { 561 561 rc = dev_exception_add(devcg, ex); 562 562 if (rc) 563 - break; 563 + return rc; 564 564 } else { 565 565 /* 566 566 * in the other possible cases:
+10 -2
sound/core/info.c
··· 713 713 INIT_LIST_HEAD(&entry->list); 714 714 entry->parent = parent; 715 715 entry->module = module; 716 - if (parent) 716 + if (parent) { 717 + mutex_lock(&parent->access); 717 718 list_add_tail(&entry->list, &parent->children); 719 + mutex_unlock(&parent->access); 720 + } 718 721 return entry; 719 722 } 720 723 ··· 795 792 list_for_each_entry_safe(p, n, &entry->children, list) 796 793 snd_info_free_entry(p); 797 794 798 - list_del(&entry->list); 795 + p = entry->parent; 796 + if (p) { 797 + mutex_lock(&p->access); 798 + list_del(&entry->list); 799 + mutex_unlock(&p->access); 800 + } 799 801 kfree(entry->name); 800 802 if (entry->private_free) 801 803 entry->private_free(entry);
+9 -9
sound/core/init.c
··· 382 382 card->shutdown = 1; 383 383 spin_unlock(&card->files_lock); 384 384 385 - /* phase 1: disable fops (user space) operations for ALSA API */ 386 - mutex_lock(&snd_card_mutex); 387 - snd_cards[card->number] = NULL; 388 - clear_bit(card->number, snd_cards_lock); 389 - mutex_unlock(&snd_card_mutex); 390 - 391 - /* phase 2: replace file->f_op with special dummy operations */ 392 - 385 + /* replace file->f_op with special dummy operations */ 393 386 spin_lock(&card->files_lock); 394 387 list_for_each_entry(mfile, &card->files_list, list) { 395 388 /* it's critical part, use endless loop */ ··· 398 405 } 399 406 spin_unlock(&card->files_lock); 400 407 401 - /* phase 3: notify all connected devices about disconnection */ 408 + /* notify all connected devices about disconnection */ 402 409 /* at this point, they cannot respond to any calls except release() */ 403 410 404 411 #if IS_ENABLED(CONFIG_SND_MIXER_OSS) ··· 414 421 device_del(&card->card_dev); 415 422 card->registered = false; 416 423 } 424 + 425 + /* disable fops (user space) operations for ALSA API */ 426 + mutex_lock(&snd_card_mutex); 427 + snd_cards[card->number] = NULL; 428 + clear_bit(card->number, snd_cards_lock); 429 + mutex_unlock(&snd_card_mutex); 430 + 417 431 #ifdef CONFIG_PM 418 432 wake_up(&card->power_sleep); 419 433 #endif
+1
sound/pci/hda/hda_codec.c
··· 969 969 970 970 /* power-up all before initialization */ 971 971 hda_set_power_state(codec, AC_PWRST_D0); 972 + codec->core.dev.power.power_state = PMSG_ON; 972 973 973 974 snd_hda_codec_proc_new(codec); 974 975
+6
sound/pci/hda/patch_realtek.c
··· 7266 7266 {0x12, 0x90a60140}, 7267 7267 {0x14, 0x90170150}, 7268 7268 {0x21, 0x02211020}), 7269 + SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 7270 + {0x21, 0x02211020}), 7269 7271 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, 7270 7272 {0x14, 0x90170110}, 7271 7273 {0x21, 0x02211020}), ··· 7378 7376 {0x21, 0x0221101f}), 7379 7377 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 7380 7378 ALC256_STANDARD_PINS), 7379 + SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 7380 + {0x14, 0x90170110}, 7381 + {0x1b, 0x01011020}, 7382 + {0x21, 0x0221101f}), 7381 7383 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC, 7382 7384 {0x14, 0x90170110}, 7383 7385 {0x1b, 0x90a70130},
+1
tools/include/uapi/sound/asound.h
··· 32 32 33 33 #ifndef __KERNEL__ 34 34 #include <stdlib.h> 35 + #include <time.h> 35 36 #endif 36 37 37 38 /*
+1 -1
tools/lib/traceevent/event-parse.c
··· 2233 2233 return val & 0xffffffff; 2234 2234 2235 2235 if (strcmp(type, "u64") == 0 || 2236 - strcmp(type, "s64")) 2236 + strcmp(type, "s64") == 0) 2237 2237 return val; 2238 2238 2239 2239 if (strcmp(type, "s8") == 0)
+1
tools/perf/builtin-stat.c
··· 1308 1308 for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) 1309 1309 perf_header__set_feat(&session->header, feat); 1310 1310 1311 + perf_header__clear_feat(&session->header, HEADER_DIR_FORMAT); 1311 1312 perf_header__clear_feat(&session->header, HEADER_BUILD_ID); 1312 1313 perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); 1313 1314 perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK);
+1
tools/perf/builtin-top.c
··· 1377 1377 * */ 1378 1378 .overwrite = 0, 1379 1379 .sample_time = true, 1380 + .sample_time_set = true, 1380 1381 }, 1381 1382 .max_stack = sysctl__max_stack(), 1382 1383 .annotation_opts = annotation__default_options,
+1 -1
tools/perf/scripts/python/export-to-sqlite.py
··· 331 331 'return_id,' 332 332 '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,' 333 333 'parent_call_path_id,' 334 - 'parent_id' 334 + 'calls.parent_id' 335 335 ' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id') 336 336 337 337 do_query(query, 'CREATE VIEW samples_view AS '
+6 -2
tools/perf/util/env.c
··· 57 57 else if (prog_id > node->info_linear->info.id) 58 58 n = n->rb_right; 59 59 else 60 - break; 60 + goto out; 61 61 } 62 + node = NULL; 62 63 64 + out: 63 65 up_read(&env->bpf_progs.lock); 64 66 return node; 65 67 } ··· 111 109 else if (btf_id > node->id) 112 110 n = n->rb_right; 113 111 else 114 - break; 112 + goto out; 115 113 } 114 + node = NULL; 116 115 117 116 up_read(&env->bpf_progs.lock); 117 + out: 118 118 return node; 119 119 } 120 120
+9 -5
tools/perf/util/evlist.c
··· 1868 1868 { 1869 1869 struct perf_evlist *evlist = arg; 1870 1870 bool draining = false; 1871 - int i; 1871 + int i, done = 0; 1872 1872 1873 - while (draining || !(evlist->thread.done)) { 1874 - if (draining) 1875 - draining = false; 1876 - else if (evlist->thread.done) 1873 + while (!done) { 1874 + bool got_data = false; 1875 + 1876 + if (evlist->thread.done) 1877 1877 draining = true; 1878 1878 1879 1879 if (!draining) ··· 1894 1894 pr_warning("cannot locate proper evsel for the side band event\n"); 1895 1895 1896 1896 perf_mmap__consume(map); 1897 + got_data = true; 1897 1898 } 1898 1899 perf_mmap__read_done(map); 1899 1900 } 1901 + 1902 + if (draining && !got_data) 1903 + break; 1900 1904 } 1901 1905 return NULL; 1902 1906 }
+6 -6
tools/perf/util/evsel.c
··· 2368 2368 if (data->user_regs.abi) { 2369 2369 u64 mask = evsel->attr.sample_regs_user; 2370 2370 2371 - sz = hweight_long(mask) * sizeof(u64); 2371 + sz = hweight64(mask) * sizeof(u64); 2372 2372 OVERFLOW_CHECK(array, sz, max_size); 2373 2373 data->user_regs.mask = mask; 2374 2374 data->user_regs.regs = (u64 *)array; ··· 2424 2424 if (data->intr_regs.abi != PERF_SAMPLE_REGS_ABI_NONE) { 2425 2425 u64 mask = evsel->attr.sample_regs_intr; 2426 2426 2427 - sz = hweight_long(mask) * sizeof(u64); 2427 + sz = hweight64(mask) * sizeof(u64); 2428 2428 OVERFLOW_CHECK(array, sz, max_size); 2429 2429 data->intr_regs.mask = mask; 2430 2430 data->intr_regs.regs = (u64 *)array; ··· 2552 2552 if (type & PERF_SAMPLE_REGS_USER) { 2553 2553 if (sample->user_regs.abi) { 2554 2554 result += sizeof(u64); 2555 - sz = hweight_long(sample->user_regs.mask) * sizeof(u64); 2555 + sz = hweight64(sample->user_regs.mask) * sizeof(u64); 2556 2556 result += sz; 2557 2557 } else { 2558 2558 result += sizeof(u64); ··· 2580 2580 if (type & PERF_SAMPLE_REGS_INTR) { 2581 2581 if (sample->intr_regs.abi) { 2582 2582 result += sizeof(u64); 2583 - sz = hweight_long(sample->intr_regs.mask) * sizeof(u64); 2583 + sz = hweight64(sample->intr_regs.mask) * sizeof(u64); 2584 2584 result += sz; 2585 2585 } else { 2586 2586 result += sizeof(u64); ··· 2710 2710 if (type & PERF_SAMPLE_REGS_USER) { 2711 2711 if (sample->user_regs.abi) { 2712 2712 *array++ = sample->user_regs.abi; 2713 - sz = hweight_long(sample->user_regs.mask) * sizeof(u64); 2713 + sz = hweight64(sample->user_regs.mask) * sizeof(u64); 2714 2714 memcpy(array, sample->user_regs.regs, sz); 2715 2715 array = (void *)array + sz; 2716 2716 } else { ··· 2746 2746 if (type & PERF_SAMPLE_REGS_INTR) { 2747 2747 if (sample->intr_regs.abi) { 2748 2748 *array++ = sample->intr_regs.abi; 2749 - sz = hweight_long(sample->intr_regs.mask) * sizeof(u64); 2749 + sz = hweight64(sample->intr_regs.mask) * sizeof(u64); 2750 2750 memcpy(array, sample->intr_regs.regs, sz); 2751 2751 array = (void *)array + sz; 2752 2752 } else {
+13 -9
tools/perf/util/header.c
··· 2606 2606 perf_env__insert_bpf_prog_info(env, info_node); 2607 2607 } 2608 2608 2609 + up_write(&env->bpf_progs.lock); 2609 2610 return 0; 2610 2611 out: 2611 2612 free(info_linear); ··· 2624 2623 static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused) 2625 2624 { 2626 2625 struct perf_env *env = &ff->ph->env; 2626 + struct btf_node *node = NULL; 2627 2627 u32 count, i; 2628 + int err = -1; 2628 2629 2629 2630 if (ff->ph->needs_swap) { 2630 2631 pr_warning("interpreting btf from systems with endianity is not yet supported\n"); ··· 2639 2636 down_write(&env->bpf_progs.lock); 2640 2637 2641 2638 for (i = 0; i < count; ++i) { 2642 - struct btf_node *node; 2643 2639 u32 id, data_size; 2644 2640 2645 2641 if (do_read_u32(ff, &id)) 2646 - return -1; 2642 + goto out; 2647 2643 if (do_read_u32(ff, &data_size)) 2648 - return -1; 2644 + goto out; 2649 2645 2650 2646 node = malloc(sizeof(struct btf_node) + data_size); 2651 2647 if (!node) 2652 - return -1; 2648 + goto out; 2653 2649 2654 2650 node->id = id; 2655 2651 node->data_size = data_size; 2656 2652 2657 - if (__do_read(ff, node->data, data_size)) { 2658 - free(node); 2659 - return -1; 2660 - } 2653 + if (__do_read(ff, node->data, data_size)) 2654 + goto out; 2661 2655 2662 2656 perf_env__insert_btf(env, node); 2657 + node = NULL; 2663 2658 } 2664 2659 2660 + err = 0; 2661 + out: 2665 2662 up_write(&env->bpf_progs.lock); 2666 - return 0; 2663 + free(node); 2664 + return err; 2667 2665 } 2668 2666 2669 2667 struct feature_ops {
+17 -3
tools/perf/util/map.c
··· 261 261 return kmap && kmap->name[0]; 262 262 } 263 263 264 + bool __map__is_bpf_prog(const struct map *map) 265 + { 266 + const char *name; 267 + 268 + if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO) 269 + return true; 270 + 271 + /* 272 + * If PERF_RECORD_BPF_EVENT is not included, the dso will not have 273 + * type of DSO_BINARY_TYPE__BPF_PROG_INFO. In such cases, we can 274 + * guess the type based on name. 275 + */ 276 + name = map->dso->short_name; 277 + return name && (strstr(name, "bpf_prog_") == name); 278 + } 279 + 264 280 bool map__has_symbols(const struct map *map) 265 281 { 266 282 return dso__has_symbols(map->dso); ··· 926 910 rc = strcmp(m->dso->short_name, map->dso->short_name); 927 911 if (rc < 0) 928 912 p = &(*p)->rb_left; 929 - else if (rc > 0) 930 - p = &(*p)->rb_right; 931 913 else 932 - return; 914 + p = &(*p)->rb_right; 933 915 } 934 916 rb_link_node(&map->rb_node_name, parent, p); 935 917 rb_insert_color(&map->rb_node_name, &maps->names);
+3 -1
tools/perf/util/map.h
··· 159 159 160 160 bool __map__is_kernel(const struct map *map); 161 161 bool __map__is_extra_kernel_map(const struct map *map); 162 + bool __map__is_bpf_prog(const struct map *map); 162 163 163 164 static inline bool __map__is_kmodule(const struct map *map) 164 165 { 165 - return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map); 166 + return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) && 167 + !__map__is_bpf_prog(map); 166 168 } 167 169 168 170 bool map__has_symbols(const struct map *map);
+5
tools/testing/selftests/net/run_afpackettests
··· 6 6 exit 0 7 7 fi 8 8 9 + ret=0 9 10 echo "--------------------" 10 11 echo "running psock_fanout test" 11 12 echo "--------------------" 12 13 ./in_netns.sh ./psock_fanout 13 14 if [ $? -ne 0 ]; then 14 15 echo "[FAIL]" 16 + ret=1 15 17 else 16 18 echo "[PASS]" 17 19 fi ··· 24 22 ./in_netns.sh ./psock_tpacket 25 23 if [ $? -ne 0 ]; then 26 24 echo "[FAIL]" 25 + ret=1 27 26 else 28 27 echo "[PASS]" 29 28 fi ··· 35 32 ./in_netns.sh ./txring_overwrite 36 33 if [ $? -ne 0 ]; then 37 34 echo "[FAIL]" 35 + ret=1 38 36 else 39 37 echo "[PASS]" 40 38 fi 39 + exit $ret
+1 -1
tools/testing/selftests/net/run_netsocktests
··· 7 7 ./socket 8 8 if [ $? -ne 0 ]; then 9 9 echo "[FAIL]" 10 + exit 1 10 11 else 11 12 echo "[PASS]" 12 13 fi 13 -
+2 -1
tools/testing/selftests/netfilter/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Makefile for netfilter selftests 3 3 4 - TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh 4 + TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \ 5 + conntrack_icmp_related.sh 5 6 6 7 include ../lib.mk
+283
tools/testing/selftests/netfilter/conntrack_icmp_related.sh
··· 1 + #!/bin/bash 2 + # 3 + # check that ICMP df-needed/pkttoobig icmp are set are set as related 4 + # state 5 + # 6 + # Setup is: 7 + # 8 + # nsclient1 -> nsrouter1 -> nsrouter2 -> nsclient2 9 + # MTU 1500, except for nsrouter2 <-> nsclient2 link (1280). 10 + # ping nsclient2 from nsclient1, checking that conntrack did set RELATED 11 + # 'fragmentation needed' icmp packet. 12 + # 13 + # In addition, nsrouter1 will perform IP masquerading, i.e. also 14 + # check the icmp errors are propagated to the correct host as per 15 + # nat of "established" icmp-echo "connection". 16 + 17 + # Kselftest framework requirement - SKIP code is 4. 18 + ksft_skip=4 19 + ret=0 20 + 21 + nft --version > /dev/null 2>&1 22 + if [ $? -ne 0 ];then 23 + echo "SKIP: Could not run test without nft tool" 24 + exit $ksft_skip 25 + fi 26 + 27 + ip -Version > /dev/null 2>&1 28 + if [ $? -ne 0 ];then 29 + echo "SKIP: Could not run test without ip tool" 30 + exit $ksft_skip 31 + fi 32 + 33 + cleanup() { 34 + for i in 1 2;do ip netns del nsclient$i;done 35 + for i in 1 2;do ip netns del nsrouter$i;done 36 + } 37 + 38 + ipv4() { 39 + echo -n 192.168.$1.2 40 + } 41 + 42 + ipv6 () { 43 + echo -n dead:$1::2 44 + } 45 + 46 + check_counter() 47 + { 48 + ns=$1 49 + name=$2 50 + expect=$3 51 + local lret=0 52 + 53 + cnt=$(ip netns exec $ns nft list counter inet filter "$name" | grep -q "$expect") 54 + if [ $? -ne 0 ]; then 55 + echo "ERROR: counter $name in $ns has unexpected value (expected $expect)" 1>&2 56 + ip netns exec $ns nft list counter inet filter "$name" 1>&2 57 + lret=1 58 + fi 59 + 60 + return $lret 61 + } 62 + 63 + check_unknown() 64 + { 65 + expect="packets 0 bytes 0" 66 + for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do 67 + check_counter $n "unknown" "$expect" 68 + if [ $? -ne 0 ] ;then 69 + return 1 70 + fi 71 + done 72 + 73 + return 0 74 + } 75 + 76 + for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do 77 + ip netns add $n 78 + ip -net $n link set lo up 79 + done 80 + 81 + DEV=veth0 82 + ip link add $DEV netns nsclient1 type veth peer name eth1 netns nsrouter1 83 + DEV=veth0 84 + ip link add $DEV netns nsclient2 type veth peer name eth1 netns nsrouter2 85 + 86 + DEV=veth0 87 + ip link add $DEV netns nsrouter1 type veth peer name eth2 netns nsrouter2 88 + 89 + DEV=veth0 90 + for i in 1 2; do 91 + ip -net nsclient$i link set $DEV up 92 + ip -net nsclient$i addr add $(ipv4 $i)/24 dev $DEV 93 + ip -net nsclient$i addr add $(ipv6 $i)/64 dev $DEV 94 + done 95 + 96 + ip -net nsrouter1 link set eth1 up 97 + ip -net nsrouter1 link set veth0 up 98 + 99 + ip -net nsrouter2 link set eth1 up 100 + ip -net nsrouter2 link set eth2 up 101 + 102 + ip -net nsclient1 route add default via 192.168.1.1 103 + ip -net nsclient1 -6 route add default via dead:1::1 104 + 105 + ip -net nsclient2 route add default via 192.168.2.1 106 + ip -net nsclient2 route add default via dead:2::1 107 + 108 + i=3 109 + ip -net nsrouter1 addr add 192.168.1.1/24 dev eth1 110 + ip -net nsrouter1 addr add 192.168.3.1/24 dev veth0 111 + ip -net nsrouter1 addr add dead:1::1/64 dev eth1 112 + ip -net nsrouter1 addr add dead:3::1/64 dev veth0 113 + ip -net nsrouter1 route add default via 192.168.3.10 114 + ip -net nsrouter1 -6 route add default via dead:3::10 115 + 116 + ip -net nsrouter2 addr add 192.168.2.1/24 dev eth1 117 + ip -net nsrouter2 addr add 192.168.3.10/24 dev eth2 118 + ip -net nsrouter2 addr add dead:2::1/64 dev eth1 119 + ip -net nsrouter2 addr add dead:3::10/64 dev eth2 120 + ip -net nsrouter2 route add default via 192.168.3.1 121 + ip -net nsrouter2 route add default via dead:3::1 122 + 123 + sleep 2 124 + for i in 4 6; do 125 + ip netns exec nsrouter1 sysctl -q net.ipv$i.conf.all.forwarding=1 126 + ip netns exec nsrouter2 sysctl -q net.ipv$i.conf.all.forwarding=1 127 + done 128 + 129 + for netns in nsrouter1 nsrouter2; do 130 + ip netns exec $netns nft -f - <<EOF 131 + table inet filter { 132 + counter unknown { } 133 + counter related { } 134 + chain forward { 135 + type filter hook forward priority 0; policy accept; 136 + meta l4proto icmpv6 icmpv6 type "packet-too-big" ct state "related" counter name "related" accept 137 + meta l4proto icmp icmp type "destination-unreachable" ct state "related" counter name "related" accept 138 + meta l4proto { icmp, icmpv6 } ct state new,established accept 139 + counter name "unknown" drop 140 + } 141 + } 142 + EOF 143 + done 144 + 145 + ip netns exec nsclient1 nft -f - <<EOF 146 + table inet filter { 147 + counter unknown { } 148 + counter related { } 149 + chain input { 150 + type filter hook input priority 0; policy accept; 151 + meta l4proto { icmp, icmpv6 } ct state established,untracked accept 152 + 153 + meta l4proto { icmp, icmpv6 } ct state "related" counter name "related" accept 154 + counter name "unknown" drop 155 + } 156 + } 157 + EOF 158 + 159 + ip netns exec nsclient2 nft -f - <<EOF 160 + table inet filter { 161 + counter unknown { } 162 + counter new { } 163 + counter established { } 164 + 165 + chain input { 166 + type filter hook input priority 0; policy accept; 167 + meta l4proto { icmp, icmpv6 } ct state established,untracked accept 168 + 169 + meta l4proto { icmp, icmpv6 } ct state "new" counter name "new" accept 170 + meta l4proto { icmp, icmpv6 } ct state "established" counter name "established" accept 171 + counter name "unknown" drop 172 + } 173 + chain output { 174 + type filter hook output priority 0; policy accept; 175 + meta l4proto { icmp, icmpv6 } ct state established,untracked accept 176 + 177 + meta l4proto { icmp, icmpv6 } ct state "new" counter name "new" 178 + meta l4proto { icmp, icmpv6 } ct state "established" counter name "established" 179 + counter name "unknown" drop 180 + } 181 + } 182 + EOF 183 + 184 + 185 + # make sure NAT core rewrites adress of icmp error if nat is used according to 186 + # conntrack nat information (icmp error will be directed at nsrouter1 address, 187 + # but it needs to be routed to nsclient1 address). 188 + ip netns exec nsrouter1 nft -f - <<EOF 189 + table ip nat { 190 + chain postrouting { 191 + type nat hook postrouting priority 0; policy accept; 192 + ip protocol icmp oifname "veth0" counter masquerade 193 + } 194 + } 195 + table ip6 nat { 196 + chain postrouting { 197 + type nat hook postrouting priority 0; policy accept; 198 + ip6 nexthdr icmpv6 oifname "veth0" counter masquerade 199 + } 200 + } 201 + EOF 202 + 203 + ip netns exec nsrouter2 ip link set eth1 mtu 1280 204 + ip netns exec nsclient2 ip link set veth0 mtu 1280 205 + sleep 1 206 + 207 + ip netns exec nsclient1 ping -c 1 -s 1000 -q -M do 192.168.2.2 >/dev/null 208 + if [ $? -ne 0 ]; then 209 + echo "ERROR: netns ip routing/connectivity broken" 1>&2 210 + cleanup 211 + exit 1 212 + fi 213 + ip netns exec nsclient1 ping6 -q -c 1 -s 1000 dead:2::2 >/dev/null 214 + if [ $? -ne 0 ]; then 215 + echo "ERROR: netns ipv6 routing/connectivity broken" 1>&2 216 + cleanup 217 + exit 1 218 + fi 219 + 220 + check_unknown 221 + if [ $? -ne 0 ]; then 222 + ret=1 223 + fi 224 + 225 + expect="packets 0 bytes 0" 226 + for netns in nsrouter1 nsrouter2 nsclient1;do 227 + check_counter "$netns" "related" "$expect" 228 + if [ $? -ne 0 ]; then 229 + ret=1 230 + fi 231 + done 232 + 233 + expect="packets 2 bytes 2076" 234 + check_counter nsclient2 "new" "$expect" 235 + if [ $? -ne 0 ]; then 236 + ret=1 237 + fi 238 + 239 + ip netns exec nsclient1 ping -q -c 1 -s 1300 -M do 192.168.2.2 > /dev/null 240 + if [ $? -eq 0 ]; then 241 + echo "ERROR: ping should have failed with PMTU too big error" 1>&2 242 + ret=1 243 + fi 244 + 245 + # nsrouter2 should have generated the icmp error, so 246 + # related counter should be 0 (its in forward). 247 + expect="packets 0 bytes 0" 248 + check_counter "nsrouter2" "related" "$expect" 249 + if [ $? -ne 0 ]; then 250 + ret=1 251 + fi 252 + 253 + # but nsrouter1 should have seen it, same for nsclient1. 254 + expect="packets 1 bytes 576" 255 + for netns in nsrouter1 nsclient1;do 256 + check_counter "$netns" "related" "$expect" 257 + if [ $? -ne 0 ]; then 258 + ret=1 259 + fi 260 + done 261 + 262 + ip netns exec nsclient1 ping6 -c 1 -s 1300 dead:2::2 > /dev/null 263 + if [ $? -eq 0 ]; then 264 + echo "ERROR: ping6 should have failed with PMTU too big error" 1>&2 265 + ret=1 266 + fi 267 + 268 + expect="packets 2 bytes 1856" 269 + for netns in nsrouter1 nsclient1;do 270 + check_counter "$netns" "related" "$expect" 271 + if [ $? -ne 0 ]; then 272 + ret=1 273 + fi 274 + done 275 + 276 + if [ $ret -eq 0 ];then 277 + echo "PASS: icmp mtu error had RELATED state" 278 + else 279 + echo "ERROR: icmp error RELATED state test has failed" 280 + fi 281 + 282 + cleanup 283 + exit $ret
+53 -3
tools/testing/selftests/netfilter/nft_nat.sh
··· 347 347 test_masquerade6() 348 348 { 349 349 local family=$1 350 + local natflags=$1 350 351 local lret=0 351 352 352 353 ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null ··· 381 380 table $family nat { 382 381 chain postrouting { 383 382 type nat hook postrouting priority 0; policy accept; 384 - meta oif veth0 masquerade 383 + meta oif veth0 masquerade $natflags 385 384 } 386 385 } 387 386 EOF ··· 392 391 393 392 ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 394 393 if [ $? -ne 0 ] ; then 394 + <<<<<<< HEAD 395 395 echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" 396 + ======= 397 + echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags" 398 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 396 399 lret=1 397 400 fi 398 401 ··· 433 428 fi 434 429 done 435 430 431 + <<<<<<< HEAD 436 432 ip netns exec ns0 nft flush chain $family nat postrouting 433 + ======= 434 + ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 435 + if [ $? -ne 0 ] ; then 436 + echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)" 437 + lret=1 438 + fi 439 + 440 + ip netns exec ns0 nft flush chain ip6 nat postrouting 441 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 437 442 if [ $? -ne 0 ]; then 438 443 echo "ERROR: Could not flush $family nat postrouting" 1>&2 439 444 lret=1 440 445 fi 441 446 447 + <<<<<<< HEAD 442 448 test $lret -eq 0 && echo "PASS: $family IPv6 masquerade for ns2" 449 + ======= 450 + test $lret -eq 0 && echo "PASS: IPv6 masquerade $natflags for ns2" 451 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 443 452 444 453 return $lret 445 454 } 446 455 447 456 test_masquerade() 448 457 { 458 + <<<<<<< HEAD 449 459 local family=$1 460 + ======= 461 + local natflags=$1 462 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 450 463 local lret=0 451 464 452 465 ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null ··· 472 449 473 450 ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 474 451 if [ $? -ne 0 ] ; then 475 - echo "ERROR: canot ping ns1 from ns2" 452 + echo "ERROR: cannot ping ns1 from ns2 $natflags" 476 453 lret=1 477 454 fi 478 455 ··· 498 475 table $family nat { 499 476 chain postrouting { 500 477 type nat hook postrouting priority 0; policy accept; 501 - meta oif veth0 masquerade 478 + meta oif veth0 masquerade $natflags 502 479 } 503 480 } 504 481 EOF ··· 509 486 510 487 ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 511 488 if [ $? -ne 0 ] ; then 489 + <<<<<<< HEAD 512 490 echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" 491 + ======= 492 + echo "ERROR: cannot ping ns1 from ns2 with active ip masquere $natflags" 493 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 513 494 lret=1 514 495 fi 515 496 ··· 549 522 fi 550 523 done 551 524 525 + <<<<<<< HEAD 552 526 ip netns exec ns0 nft flush chain $family nat postrouting 527 + ======= 528 + ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 529 + if [ $? -ne 0 ] ; then 530 + echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)" 531 + lret=1 532 + fi 533 + 534 + ip netns exec ns0 nft flush chain ip nat postrouting 535 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 553 536 if [ $? -ne 0 ]; then 554 537 echo "ERROR: Could not flush $family nat postrouting" 1>&2 555 538 lret=1 556 539 fi 557 540 541 + <<<<<<< HEAD 558 542 test $lret -eq 0 && echo "PASS: $family IP masquerade for ns2" 543 + ======= 544 + test $lret -eq 0 && echo "PASS: IP masquerade $natflags for ns2" 545 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 559 546 560 547 return $lret 561 548 } ··· 843 802 $test_inet_nat && test_local_dnat6 inet 844 803 845 804 reset_counters 805 + <<<<<<< HEAD 846 806 test_masquerade ip 847 807 test_masquerade6 ip6 848 808 reset_counters 849 809 $test_inet_nat && test_masquerade inet 850 810 $test_inet_nat && test_masquerade6 inet 811 + ======= 812 + test_masquerade "" 813 + test_masquerade6 "" 814 + 815 + reset_counters 816 + test_masquerade "fully-random" 817 + test_masquerade6 "fully-random" 818 + >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 851 819 852 820 reset_counters 853 821 test_redirect ip
+2 -2
tools/testing/selftests/proc/proc-pid-vm.c
··· 187 187 ph.p_offset = 0; 188 188 ph.p_vaddr = VADDR; 189 189 ph.p_paddr = 0; 190 - ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); 191 - ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); 190 + ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; 191 + ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; 192 192 ph.p_align = 4096; 193 193 194 194 fd = openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700);
+10 -10
tools/testing/selftests/proc/proc-self-map-files-002.c
··· 46 46 47 47 int main(void) 48 48 { 49 - const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); 50 - #ifdef __arm__ 51 - unsigned long va = 2 * PAGE_SIZE; 52 - #else 53 - unsigned long va = 0; 54 - #endif 49 + const int PAGE_SIZE = sysconf(_SC_PAGESIZE); 50 + const unsigned long va_max = 1UL << 32; 51 + unsigned long va; 55 52 void *p; 56 53 int fd; 57 54 unsigned long a, b; ··· 57 60 if (fd == -1) 58 61 return 1; 59 62 60 - p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); 61 - if (p == MAP_FAILED) { 62 - if (errno == EPERM) 63 - return 4; 63 + for (va = 0; va < va_max; va += PAGE_SIZE) { 64 + p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); 65 + if (p == (void *)va) 66 + break; 67 + } 68 + if (va == va_max) { 69 + fprintf(stderr, "error: mmap doesn't like you\n"); 64 70 return 1; 65 71 } 66 72