Linux 5.15.184
Greg Kroah-Hartman
maintainerI'm announcing the release of the 5.15.184 kernel.
All users of the 5.15 kernel series must upgrade.
The updated 5.15.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.15.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/ABI/testing/sysfs-devices-system-cpu | 1 Documentation/admin-guide/hw-vuln/index.rst | 1 Documentation/admin-guide/hw-vuln/indirect-target-selection.rst | 156 ++++++ Documentation/admin-guide/kernel-parameters.txt | 15 Makefile | 2 arch/x86/Kconfig | 11 arch/x86/entry/entry_64.S | 20 arch/x86/include/asm/alternative.h | 32 + arch/x86/include/asm/cpufeatures.h | 3 arch/x86/include/asm/msr-index.h | 8 arch/x86/include/asm/nospec-branch.h | 57 +- arch/x86/kernel/alternative.c | 243 +++++++++- arch/x86/kernel/cpu/bugs.c | 139 +++++ arch/x86/kernel/cpu/common.c | 63 ++ arch/x86/kernel/ftrace.c | 4 arch/x86/kernel/kprobes/core.c | 1 arch/x86/kernel/module.c | 15 arch/x86/kernel/static_call.c | 2 arch/x86/kernel/vmlinux.lds.S | 10 arch/x86/kvm/x86.c | 4 arch/x86/lib/retpoline.S | 39 + arch/x86/net/bpf_jit_comp.c | 8 block/fops.c | 5 drivers/acpi/pptt.c | 11 drivers/base/cpu.c | 8 drivers/clocksource/i8253.c | 6 drivers/dma/dmatest.c | 6 drivers/dma/idxd/init.c | 8 drivers/dma/ti/k3-udma.c | 10 drivers/iio/adc/ad7768-1.c | 2 drivers/iio/chemical/sps30.c | 2 drivers/infiniband/sw/rxe/rxe_cq.c | 5 drivers/net/dsa/sja1105/sja1105_main.c | 6 drivers/net/ethernet/cadence/macb_main.c | 19 drivers/net/ethernet/intel/ice/ice_arfs.c | 9 drivers/net/ethernet/intel/ice/ice_lib.c | 5 drivers/net/ethernet/intel/ice/ice_main.c | 20 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 7 drivers/net/wireless/mediatek/mt76/dma.c | 1 drivers/phy/renesas/phy-rcar-gen3-usb2.c | 7 drivers/phy/tegra/xusb.c | 8 drivers/platform/x86/asus-wmi.c | 3 drivers/spi/spi-loopback-test.c | 2 drivers/usb/typec/altmodes/displayport.c | 18 drivers/usb/typec/ucsi/displayport.c | 19 drivers/usb/typec/ucsi/ucsi.c | 34 + drivers/usb/typec/ucsi/ucsi.h | 3 drivers/usb/typec/ucsi/ucsi_ccg.c | 5 fs/btrfs/discard.c | 17 fs/btrfs/extent-tree.c | 25 - fs/btrfs/extent_io.c | 15 fs/nfs/nfs4proc.c | 9 fs/nfs/pnfs.c | 9 include/linux/cpu.h | 2 include/linux/module.h | 5 include/net/netfilter/nf_tables.h | 2 include/net/sch_generic.h | 15 kernel/trace/trace_dynevent.c | 16 kernel/trace/trace_dynevent.h | 1 kernel/trace/trace_events_trigger.c | 2 kernel/trace/trace_functions.c | 6 kernel/trace/trace_kprobe.c | 2 kernel/trace/trace_probe.c | 9 kernel/trace/trace_uprobe.c | 2 net/netfilter/nf_tables_api.c | 54 +- net/netfilter/nft_immediate.c | 2 net/sched/sch_codel.c | 2 net/sched/sch_fq.c | 2 net/sched/sch_fq_codel.c | 2 net/sched/sch_fq_pie.c | 2 net/sched/sch_hhf.c | 2 net/sched/sch_pie.c | 2 net/sctp/sysctl.c | 4 samples/ftrace/sample-trace-array.c | 2 sound/pci/es1968.c | 6 sound/sh/Kconfig | 2 sound/usb/quirks.c | 4 tools/testing/selftests/vm/compaction_test.c | 19 78 files changed, 1115 insertions(+), 190 deletions(-)
Abdun Nihaal (1):
qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd()
Alexander Lobakin (1):
ice: arfs: fix use-after-free when freeing @rx_cpu_rmap
Andrei Kuchynski (1):
usb: typec: ucsi: displayport: Fix deadlock
Borislav Petkov (AMD) (1):
x86/alternative: Optimize returns patching
Christian Heusel (1):
ALSA: usb-audio: Add sample rate quirk for Audioengine D1
Claudiu Beznea (1):
phy: renesas: rcar-gen3-usb2: Set timing registers only once
Cong Wang (1):
net_sched: Flush gso_skb list too during ->change()
Dan Carpenter (1):
usb: typec: fix potential array underflow in ucsi_ccg_sync_control()
David Lechner (1):
iio: chemical: sps30: use aligned_s64 for timestamp
Eric Biggers (1):
x86/its: Fix build errors when CONFIG_MODULES=n
Eric Dumazet (1):
sctp: add mutual exclusion in proc_sctp_do_udp_port()
Fedor Pchelkin (1):
wifi: mt76: disable napi on driver removal
Feng Tang (1):
selftests/mm: compaction_test: support platform with huge mount of memory
Fengnan Chang (1):
block: fix direct io NOWAIT flag not work
Filipe Manana (2):
btrfs: fix discard worker infinite loop after disabling discard
btrfs: don't BUG_ON() when 0 reference count at btrfs_lookup_extent_info()
Florian Westphal (2):
netfilter: nf_tables: pass nft_chain to destroy function, not nft_ctx
netfilter: nf_tables: do not defer rule destruction via call_rcu
GONG Ruiqi (1):
usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
Geert Uytterhoeven (2):
spi: loopback-test: Do not split 1024-byte hexdumps
ALSA: sh: SND_AICA should depend on SH_DMA_API
Greg Kroah-Hartman (1):
Linux 5.15.184
Hans de Goede (1):
platform/x86: asus-wmi: Fix wlan_ctrl_by_user detection
Jeremy Linton (1):
ACPI: PPTT: Fix processor subtable walk
Jonathan Cameron (1):
iio: adc: ad7768-1: Fix insufficient alignment of timestamp.
Josef Bacik (1):
btrfs: do not clean up repair bio if submit fails
Josh Poimboeuf (1):
x86/alternatives: Remove faulty optimization
Li Lingfeng (1):
nfs: handle failure of nfs_get_lock_context in unlock path
Ma Ke (1):
phy: Fix error handling in tegra_xusb_port_init
Masami Hiramatsu (Google) (1):
tracing: probes: Fix a possible race in trace_probe_log APIs
Mathieu Othacehe (1):
net: cadence: macb: Fix a possible deadlock in macb_halt_tx.
Nathan Lynch (1):
dmaengine: Revert "dmaengine: dmatest: Fix dmatest waiting less when interrupted"
Nicolas Chauvet (1):
ALSA: usb-audio: Add sample rate quirk for Microdia JP001 USB Camera
Pablo Neira Ayuso (1):
netfilter: nf_tables: wait for rcu grace period on net_device removal
Pawan Gupta (10):
x86/speculation: Simplify and make CALL_NOSPEC consistent x86/speculation: Add a conditional CS prefix to CALL_NOSPEC x86/speculation: Remove the extra #ifdef around CALL_NOSPEC
Documentation: x86/bugs/its: Add ITS documentation x86/its: Enumerate Indirect Target Selection (ITS) bug x86/its: Add support for ITS-safe indirect thunk x86/its: Add support for ITS-safe return thunk x86/its: Enable Indirect Target Selection mitigation x86/its: Add "vmexit" option to skip mitigation on some CPUs x86/its: Align RETs in BHB clear sequence to avoid thunking
Peter Zijlstra (3):
x86,nospec: Simplify {JMP,CALL}_NOSPEC x86/its: Use dynamic thunks for indirect branches x86/its: FineIBT-paranoid vs ITS
RD Babiera (1):
usb: typec: altmodes/displayport: create sysfs nodes as driver's default device attribute group
Ronald Wahl (1):
dmaengine: ti: k3-udma: Add missing locking
Sebastian Andrzej Siewior (1):
clocksource/i8253: Use raw_spinlock_irqsave() in clockevent_i8253_disable()
Shuai Xue (2):
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_groups
Steven Rostedt (1):
tracing: samples: Initialize trace_array_printk() with the correct function
Thomas Gleixner (1):
x86/modules: Set VM_FLUSH_RESET_PERMS in module_alloc()
Trond Myklebust (1):
NFSv4/pnfs: Reset the layout state after a layoutreturn
Vladimir Oltean (1):
net: dsa: sja1105: discard incoming frames in BR_STATE_LISTENING
Wentao Liang (1):
ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
Yemike Abhilash Chandra (1):
dmaengine: ti: k3-udma: Use cap_mask directly from dma_device structure instead of a local copy
Zhu Yanjun (1):
RDMA/rxe: Fix slab-use-after-free Read in rxe_queue_cleanup bug
pengdonglin (2):
ftrace: Fix preemption accounting for stacktrace trigger command
ftrace: Fix preemption accounting for stacktrace filter command
Greg Kroah-Hartman
maintainerDocumentation/ABI/testing/sysfs-devices-system-cpu +1 -0
@@ -512,6 +512,7 @@ Description: information about CPUs heterogeneity. What: /sys/devices/system/cpu/vulnerabilities /sys/devices/system/cpu/vulnerabilities/gather_data_sampling + /sys/devices/system/cpu/vulnerabilities/indirect_target_selection /sys/devices/system/cpu/vulnerabilities/itlb_multihit /sys/devices/system/cpu/vulnerabilities/l1tf /sys/devices/system/cpu/vulnerabilities/mds
Documentation/admin-guide/hw-vuln/index.rst +1 -0
@@ -22,3 +22,4 @@ are configurable at compile, boot or run time. gather_data_sampling.rst srso reg-file-data-sampling + indirect-target-selection
Documentation/admin-guide/hw-vuln/indirect-target-selection.rst new file +156 -0
156 lines not on this page · raw message
Documentation/admin-guide/kernel-parameters.txt +15 -0
@@ -1926,6 +1926,20 @@ different crypto accelerators. This option can be used to achieve best performance for particular HW. + indirect_target_selection= [X86,Intel] Mitigation control for Indirect + Target Selection(ITS) bug in Intel CPUs. Updated + microcode is also required for a fix in IBPB. + + on: Enable mitigation (default). + off: Disable mitigation. + force: Force the ITS bug and deploy default + mitigation. + vmexit: Only deploy mitigation if CPU is affected by + guest/host isolation part of ITS. + + For details see: + Documentation/admin-guide/hw-vuln/indirect-target-selection.rst + init= [KNL] Format: <full_path> Run specified binary instead of /sbin/init as init
@@ -3073,6 +3087,7 @@ improves system performance, but it may also expose users to several CPU vulnerabilities. Equivalent to: gather_data_sampling=off [X86] + indirect_target_selection=off [X86] kpti=0 [ARM64] kvm.nx_huge_pages=off [X86] l1tf=off [X86]
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 15 -SUBLEVEL = 183 +SUBLEVEL = 184 EXTRAVERSION = NAME = Trick or Treat
arch/x86/Kconfig +11 -0
@@ -2517,6 +2517,17 @@ config MITIGATION_SPECTRE_BHI indirect branches. See <file:Documentation/admin-guide/hw-vuln/spectre.rst> +config MITIGATION_ITS + bool "Enable Indirect Target Selection mitigation" + depends on CPU_SUP_INTEL && X86_64 + depends on RETPOLINE && RETHUNK + default y + help + Enable Indirect Target Selection (ITS) mitigation. ITS is a bug in + BPU on some Intel CPUs that may allow Spectre V2 style attacks. If + disabled, mitigation cannot be enabled via cmdline. + See <file:Documentation/admin-guide/hw-vuln/indirect-target-selection.rst> + endif config ARCH_HAS_ADD_PAGES
arch/x86/entry/entry_64.S +17 -3
@@ -1530,7 +1530,9 @@ SYM_CODE_END(rewind_stack_and_make_dead) * ORC to unwind properly. * * The alignment is for performance and not for safety, and may be safely - * refactored in the future if needed. + * refactored in the future if needed. The .skips are for safety, to ensure + * that all RETs are in the second half of a cacheline to mitigate Indirect + * Target Selection, rather than taking the slowpath via its_return_thunk. */ SYM_FUNC_START(clear_bhb_loop) push %rbp
@@ -1540,10 +1542,22 @@ SYM_FUNC_START(clear_bhb_loop) call 1f jmp 5f .align 64, 0xcc + /* + * Shift instructions so that the RET is in the upper half of the + * cacheline and don't take the slowpath to its_return_thunk. + */ + .skip 32 - (.Lret1 - 1f), 0xcc ANNOTATE_INTRA_FUNCTION_CALL 1: call 2f - RET +.Lret1: RET .align 64, 0xcc + /* + * As above shift instructions for RET at .Lret2 as well. + * + * This should be ideally be: .skip 32 - (.Lret2 - 2f), 0xcc + * but some Clang versions (e.g. 18) don't like this. + */ + .skip 32 - 18, 0xcc 2: movl $5, %eax 3: jmp 4f nop
@@ -1551,7 +1565,7 @@ SYM_FUNC_START(clear_bhb_loop) jnz 3b sub $1, %ecx jnz 1b - RET +.Lret2: RET 5: lfence pop %rbp RET
arch/x86/include/asm/alternative.h +32 -0
@@ -5,6 +5,7 @@#include <linux/types.h> #include <linux/stringify.h> #include <asm/asm.h> +#include <asm/bug.h> #define ALTINSTR_FLAG_INV (1 << 15)#define ALT_NOT (feat) ((feat) | ALTINSTR_FLAG_INV)
@@ -80,6 +81,37 @@ extern void apply_returns(s32 *start, s32 *end);struct module ; +#ifdef CONFIG_MITIGATION_ITS +extern void its_init_mod (struct module *mod); +extern void its_fini_mod (struct module *mod); +extern void its_free_mod (struct module *mod); +extern u8 *its_static_thunk (int reg); +#else /* CONFIG_MITIGATION_ITS */ +static inline void its_init_mod (struct module *mod) { } +static inline void its_fini_mod (struct module *mod) { } +static inline void its_free_mod (struct module *mod) { } +static inline u8 *its_static_thunk (int reg) +{ +WARN_ONCE (1 ,"ITS not compiled in" ); + +return NULL ; +} +#endif + +#ifdef CONFIG_RETHUNK +extern bool cpu_wants_rethunk (void ); +extern bool cpu_wants_rethunk_at (void *addr); +#else +static __always_inline bool cpu_wants_rethunk(void) +{ +return false; +} +static __always_inline bool cpu_wants_rethunk_at(void *addr) +{ +return false; +} +#endif +#ifdef CONFIG_SMP extern void alternatives_smp_module_add(struct module *mod, char *name, void *locks, void *locks_end,
arch/x86/include/asm/cpufeatures.h +3 -0
@@ -433,6 +433,7 @@#define X86_FEATURE_BHI_CTRL (21*32+ 2)/* "" BHI_DIS_S HW control available */ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3)/* "" BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4)/* "" Clear branch history at vmexit using SW loop */ +#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32 + 5)/* "" Use thunk for indirect branches in lower half of cacheline */ /* * BUG word(s)
@@ -483,4 +484,6 @@#define X86_BUG_RFDS X86_BUG(1*32 + 2)/* CPU is vulnerable to Register File Data Sampling */ #define X86_BUG_BHI X86_BUG(1*32 + 3)/* CPU is affected by Branch History Injection */ #define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4)/* "ibpb_no_ret" IBPB omits return target predictions */ +#define X86_BUG_ITS X86_BUG(1*32 + 5)/* CPU is affected by Indirect Target Selection */ +#define X86_BUG_ITS_NATIVE_ONLY X86_BUG(1*32 + 6)/* CPU is affected by ITS, VMX is not affected */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/msr-index.h +8 -0
@@ -183,6 +183,14 @@* VERW clears CPU Register * File. */ +#define ARCH_CAP_ITS_NO BIT_ULL(62)/* +* Not susceptible to +* Indirect Target Selection. +* This bit is not set by +* HW, but is synthesized by +* VMMs for guests to know +* their affected status. +*/ #define MSR_IA32_FLUSH_CMD 0x0000010b#define L1D_FLUSH BIT(0)/*
arch/x86/include/asm/nospec-branch.h +41 -16
98 lines not on this page · raw message
arch/x86/kernel/alternative.c +239 -4
282 lines not on this page · raw message
arch/x86/kernel/cpu/bugs.c +136 -3
193 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +51 -12
91 lines not on this page · raw message
arch/x86/kernel/ftrace.c +1 -3
@@ -367,7 +367,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) goto fail; ip = trampoline + size; -if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) +if (cpu_wants_rethunk_at (ip))__text_gen_insn (ip,JMP32_INSN_OPCODE , ip, x86_return_thunk,JMP32_INSN_SIZE );else memcpy (ip, retq,sizeof (retq));
@@ -422,8 +422,6 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)/* ALLOC_TRAMP flags lets us know we created it */ ops->flags |=FTRACE_OPS_FL_ALLOC_TRAMP ; -set_vm_flush_reset_perms (trampoline); -if (likely (system_state !=SYSTEM_BOOTING ))set_memory_ro ((unsigned long )trampoline, npages);set_memory_x ((unsigned long )trampoline, npages);
arch/x86/kernel/kprobes/core.c +0 -1
@@ -403,7 +403,6 @@ void *alloc_insn_page(void)if (!page)return NULL ; -set_vm_flush_reset_perms (page);/* * First make the page read-only, and only then make it executable to * prevent it from being W+X in between.
arch/x86/kernel/module.c +11 -4
@@ -74,10 +74,10 @@ void *module_alloc(unsigned long size)return NULL ; p =__vmalloc_node_range (size,MODULE_ALIGN , -MODULES_VADDR +get_module_load_offset (), -MODULES_END , gfp_mask, -PAGE_KERNEL ,VM_DEFER_KMEMLEAK ,NUMA_NO_NODE , -__builtin_return_address (0 )); +MODULES_VADDR +get_module_load_offset (), +MODULES_END , gfp_mask,PAGE_KERNEL , +VM_FLUSH_RESET_PERMS |VM_DEFER_KMEMLEAK , +NUMA_NO_NODE ,__builtin_return_address (0 ));if (p && (kasan_module_alloc (p, size, gfp_mask) <0 )) {vfree (p);return NULL ;
@@ -283,10 +283,16 @@ int module_finalize(const Elf_Ehdr *hdr,void *pseg = (void *)para->sh_addr;apply_paravirt (pseg, pseg + para->sh_size); } + +its_init_mod (me); +if (retpolines) {void *rseg = (void *)retpolines->sh_addr;apply_retpolines (rseg, rseg + retpolines->sh_size); } + +its_fini_mod (me); +if (returns) {void *rseg = (void *)returns->sh_addr;apply_returns (rseg, rseg + returns->sh_size);
@@ -317,4 +323,5 @@ int module_finalize(const Elf_Ehdr *hdr,void module_arch_cleanup (struct module *mod) {alternatives_smp_module_del (mod); +its_free_mod (mod); }
arch/x86/kernel/static_call.c +1 -1
@@ -81,7 +81,7 @@ static void __ref __static_call_transform(void *insn, enum insn_type type,break ;case RET : -if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) +if (cpu_wants_rethunk_at (insn)) code =text_gen_insn (JMP32_INSN_OPCODE , insn, x86_return_thunk);else code = &retinsn;
arch/x86/kernel/vmlinux.lds.S +10 -0
@@ -532,6 +532,16 @@ INIT_PER_CPU(irq_stack_backing_store); "SRSO function pair won't alias"); #endif +#if defined(CONFIG_MITIGATION_ITS) && !defined(CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B) +. = ASSERT(__x86_indirect_its_thunk_rax & 0x20, "__x86_indirect_thunk_rax not in second half of cacheline"); +. = ASSERT(((__x86_indirect_its_thunk_rcx - __x86_indirect_its_thunk_rax) % 64) == 0, "Indirect thunks are not cacheline apart"); +. = ASSERT(__x86_indirect_its_thunk_array == __x86_indirect_its_thunk_rax, "Gap in ITS thunk array"); +#endif + +#if defined(CONFIG_MITIGATION_ITS) && !defined(CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B) +. = ASSERT(its_return_thunk & 0x20, "its_return_thunk not in second half of cacheline"); +#endif + #endif /* CONFIG_X86_64 */ #ifdef CONFIG_KEXEC_CORE
arch/x86/kvm/x86.c +3 -1
@@ -1499,7 +1499,7 @@ static unsigned int num_msr_based_features; ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO | \ - ARCH_CAP_RFDS_NO | ARCH_CAP_RFDS_CLEAR | ARCH_CAP_BHI_NO) + ARCH_CAP_RFDS_NO | ARCH_CAP_RFDS_CLEAR | ARCH_CAP_BHI_NO | ARCH_CAP_ITS_NO)static u64 kvm_get_arch_capabilities (void ) {
@@ -1538,6 +1538,8 @@ static u64 kvm_get_arch_capabilities(void) data |=ARCH_CAP_MDS_NO ;if (!boot_cpu_has_bug (X86_BUG_RFDS )) data |=ARCH_CAP_RFDS_NO ; +if (!boot_cpu_has_bug (X86_BUG_ITS )) + data |=ARCH_CAP_ITS_NO ;if (!boot_cpu_has (X86_FEATURE_RTM )) {/*
arch/x86/lib/retpoline.S +39 -0
@@ -254,6 +254,45 @@ SYM_FUNC_START(entry_untrain_ret) SYM_FUNC_END(entry_untrain_ret) __EXPORT_THUNK(entry_untrain_ret) +#ifdef CONFIG_MITIGATION_ITS + +.macro ITS_THUNK reg + +SYM_INNER_LABEL(__x86_indirect_its_thunk_\reg, SYM_L_GLOBAL) + UNWIND_HINT_EMPTY + ANNOTATE_NOENDBR + ANNOTATE_RETPOLINE_SAFE + jmp *%\reg + int3 + .align 32, 0xcc /* fill to the end of the line */ + .skip 32, 0xcc /* skip to the next upper half */ +.endm + +/* ITS mitigation requires thunks be aligned to upper half of cacheline */ +.align 64, 0xcc +.skip 32, 0xcc +SYM_CODE_START(__x86_indirect_its_thunk_array) + +#define GEN(reg) ITS_THUNK reg +#include <asm/GEN-for-each-reg.h> +#undef GEN + + .align 64, 0xcc +SYM_CODE_END(__x86_indirect_its_thunk_array) + +.align 64, 0xcc +.skip 32, 0xcc +SYM_CODE_START(its_return_thunk) + UNWIND_HINT_FUNC + ANNOTATE_NOENDBR + ANNOTATE_UNRET_SAFE + ret + int3 +SYM_CODE_END(its_return_thunk) +EXPORT_SYMBOL(its_return_thunk) + +#endif /* CONFIG_MITIGATION_ITS */ + SYM_CODE_START(__x86_return_thunk) UNWIND_HINT_FUNC ANNOTATE_NOENDBR
arch/x86/net/bpf_jit_comp.c +6 -2
@@ -446,7 +446,11 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)u8 *prog = *pprog; #ifdef CONFIG_RETPOLINE -if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) { + if (IS_ENABLED(CONFIG_MITIGATION_ITS) && + cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS)) { + OPTIMIZER_HIDE_VAR(reg); + emit_jump(&prog, its_static_thunk(reg), ip); + } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE_LFENCE)) { EMIT_LFENCE(); EMIT2(0xFF, 0xE0 + reg); } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) {
@@ -462,7 +466,7 @@ static void emit_return(u8 **pprog, u8 *ip) {u8 *prog = *pprog; -if (cpu_feature_enabled (X86_FEATURE_RETHUNK )) { +if (cpu_wants_rethunk ()) {emit_jump (&prog, x86_return_thunk, ip); }else {EMIT1 (0xC3 );/* ret */
block/fops.c +4 -1
@@ -259,7 +259,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,blk_finish_plug (&plug);return -EAGAIN ; } - bio->bi_opf |=REQ_NOWAIT ; }if (is_read) {
@@ -270,6 +269,10 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, bio->bi_opf =dio_bio_write_op (iocb);task_io_account_write (bio->bi_iter.bi_size); } + +if (iocb->ki_flags &IOCB_NOWAIT ) + bio->bi_opf |=REQ_NOWAIT ; + dio->size += bio->bi_iter.bi_size; pos += bio->bi_iter.bi_size;
drivers/acpi/pptt.c +8 -3
@@ -219,16 +219,18 @@ static int acpi_pptt_leaf_node(struct acpi_table_header *table_hdr, sizeof(struct acpi_table_pptt)); proc_sz =sizeof (struct acpi_pptt_processor ); -while ((unsigned long )entry + proc_sz < table_end) { +/* ignore subtable types that are smaller than a processor node */ +while ((unsigned long )entry + proc_sz <= table_end) { cpu_node = (struct acpi_pptt_processor *)entry; +if (entry->type ==ACPI_PPTT_TYPE_PROCESSOR && cpu_node->parent == node_entry)return 0 ;if (entry->length ==0 )return 0 ; + entry = ACPI_ADD_PTR(struct acpi_subtable_header, entry, entry->length); - }return 1 ; }
@@ -261,15 +263,18 @@ static struct acpi_pptt_processor *acpi_find_processor_node(struct acpi_table_he proc_sz =sizeof (struct acpi_pptt_processor );/* find the processor structure associated with this cpuid */ -while ((unsigned long )entry + proc_sz < table_end) { +while ((unsigned long )entry + proc_sz <= table_end) { cpu_node = (struct acpi_pptt_processor *)entry;if (entry->length ==0 ) {pr_warn ("Invalid zero length subtable\n" );break ; } +/* entry->length may not equal proc_sz, revalidate the processor structure length */ if (entry->type ==ACPI_PPTT_TYPE_PROCESSOR && acpi_cpu_id == cpu_node->acpi_processor_id && + (unsigned long )entry + entry->length <= table_end && + entry->length == proc_sz + cpu_node->number_of_priv_resources *sizeof (u32) &&acpi_pptt_leaf_node (table_hdr, cpu_node)) {return (struct acpi_pptt_processor *)entry; }
drivers/base/cpu.c +8 -0
@@ -595,6 +595,12 @@ ssize_t __weak cpu_show_reg_file_data_sampling(struct device *dev,return sysfs_emit (buf,"Not affected\n" ); } +ssize_t __weak cpu_show_indirect_target_selection (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sysfs_emit (buf,"Not affected\n" ); +} + static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
@@ -609,6 +615,7 @@ static DEVICE_ATTR(retbleed, 0444, cpu_show_retbleed, NULL); static DEVICE_ATTR(gather_data_sampling, 0444, cpu_show_gds, NULL); static DEVICE_ATTR(spec_rstack_overflow, 0444, cpu_show_spec_rstack_overflow, NULL); static DEVICE_ATTR(reg_file_data_sampling, 0444, cpu_show_reg_file_data_sampling, NULL); +static DEVICE_ATTR(indirect_target_selection, 0444, cpu_show_indirect_target_selection, NULL);static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_meltdown.attr,
@@ -625,6 +632,7 @@ static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_gather_data_sampling.attr, &dev_attr_spec_rstack_overflow.attr, &dev_attr_reg_file_data_sampling.attr, + &dev_attr_indirect_target_selection.attr, NULL };
drivers/clocksource/i8253.c +4 -2
@@ -103,7 +103,9 @@ int __init clocksource_i8253_init(void)#ifdef CONFIG_CLKEVT_I8253 void clockevent_i8253_disable (void ) { -raw_spin_lock (&i8253_lock); +unsigned long flags; + +raw_spin_lock_irqsave (&i8253_lock, flags);/* * Writing the MODE register should stop the counter, according to
@@ -133,7 +135,7 @@ void clockevent_i8253_disable(void)outb_p (0x30 ,PIT_MODE ); -raw_spin_unlock (&i8253_lock); +raw_spin_unlock_irqrestore (&i8253_lock, flags); }static int pit_shutdown (struct clock_event_device *evt)
drivers/dma/dmatest.c +3 -3
@@ -828,9 +828,9 @@ static int dmatest_func(void *data) }else {dma_async_issue_pending (chan); -wait_event_timeout (thread->done_wait, - done->done, -msecs_to_jiffies (params->timeout)); +wait_event_freezable_timeout (thread->done_wait, + done->done, +msecs_to_jiffies (params->timeout)); status =dma_async_is_tx_complete (chan, cookie,NULL ,NULL );
drivers/dma/idxd/init.c +8 -0
@@ -289,6 +289,7 @@ static int idxd_setup_engines(struct idxd_device *idxd) rc =dev_set_name (conf_dev,"engine%d.%d" , idxd->id, engine->id);if (rc <0 ) {put_device (conf_dev); +kfree (engine); goto err; }
@@ -302,7 +303,10 @@ static int idxd_setup_engines(struct idxd_device *idxd) engine = idxd->engines[i]; conf_dev =engine_confdev (engine);put_device (conf_dev); +kfree (engine); } +kfree (idxd->engines); +return rc; }
@@ -336,6 +340,7 @@ static int idxd_setup_groups(struct idxd_device *idxd) rc =dev_set_name (conf_dev,"group%d.%d" , idxd->id, group->id);if (rc <0 ) {put_device (conf_dev); +kfree (group); goto err; }
@@ -355,7 +360,10 @@ static int idxd_setup_groups(struct idxd_device *idxd)while (--i >=0 ) { group = idxd->groups[i];put_device (group_confdev (group)); +kfree (group); } +kfree (idxd->groups); +return rc; }
drivers/dma/ti/k3-udma.c +8 -2
@@ -1082,8 +1082,11 @@ static void udma_check_tx_completion(struct work_struct *work)u32 residue_diff;ktime_t time_diff;unsigned long delay; +unsigned long flags;while (1 ) { +spin_lock_irqsave (&uc->vc.lock, flags); +if (uc->desc) {/* Get previous residue and time stamp */ residue_diff = uc->tx_drain.residue;
@@ -1118,6 +1121,8 @@ static void udma_check_tx_completion(struct work_struct *work)break ; } +spin_unlock_irqrestore (&uc->vc.lock, flags); +usleep_range (ktime_to_us (delay),ktime_to_us (delay) +10 );continue ;
@@ -1134,6 +1139,8 @@ static void udma_check_tx_completion(struct work_struct *work)break ; } + +spin_unlock_irqrestore (&uc->vc.lock, flags); }static irqreturn_t udma_ring_irq_handler (int irq,void *data)
@@ -4203,7 +4210,6 @@ static struct dma_chan *udma_of_xlate(struct of_phandle_args *dma_spec, struct of_dma *ofdma) {struct udma_dev *ud = ofdma->of_dma_data; -dma_cap_mask_t mask = ud->ddev.cap_mask;struct udma_filter_param filter_param;struct dma_chan *chan;
@@ -4235,7 +4241,7 @@ static struct dma_chan *udma_of_xlate(struct of_phandle_args *dma_spec, } } - chan =__dma_request_channel (&mask, udma_dma_filter_fn, &filter_param, + chan =__dma_request_channel (&ud->ddev.cap_mask, udma_dma_filter_fn, &filter_param, ofdma->of_node);if (!chan) {dev_err (ud->dev,"get channel fail in %s.\n" , __func__);
drivers/iio/adc/ad7768-1.c +1 -1
@@ -169,7 +169,7 @@ struct ad7768_state {union {struct {__be32 chan; -s64 timestamp; +aligned_s64 timestamp; } scan;__be32 d32;u8 d8[2 ];
drivers/iio/chemical/sps30.c +1 -1
@@ -108,7 +108,7 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)int ret;struct {s32 data[4 ];/* PM1, PM2P5, PM4, PM10 */ -s64 ts; +aligned_s64 ts; } scan;mutex_lock (&state->lock);
drivers/infiniband/sw/rxe/rxe_cq.c +1 -4
@@ -71,11 +71,8 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, err =do_mmap_info (rxe, uresp ? &uresp->mi :NULL , udata, cq->queue->buf, cq->queue->buf_size, &cq->queue->ip); -if (err) { -vfree (cq->queue->buf); -kfree (cq->queue); +if (err)return err; - }if (uresp) cq->is_user =1 ;
drivers/net/dsa/sja1105/sja1105_main.c +1 -5
@@ -1969,6 +1969,7 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port,switch (state) {case BR_STATE_DISABLED :case BR_STATE_BLOCKING : +case BR_STATE_LISTENING :/* From UM10944 description of DRPDTAG (why put this there?): * "Management traffic flows to the port regardless of the state * of the INGRESS flag". So BPDUs are still be allowed to pass.
@@ -1978,11 +1979,6 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port, mac[port].egress = false; mac[port].dyn_learn = false;break ; -case BR_STATE_LISTENING : - mac[port].ingress = true; - mac[port].egress = false; - mac[port].dyn_learn = false; -break ;case BR_STATE_LEARNING : mac[port].ingress = true; mac[port].egress = false;
drivers/net/ethernet/cadence/macb_main.c +6 -13
@@ -986,22 +986,15 @@ static void macb_update_stats(struct macb *bp)static int macb_halt_tx (struct macb *bp) { -unsigned long halt_time, timeout; -u32 status; +u32 status;macb_writel (bp,NCR ,macb_readl (bp,NCR ) |MACB_BIT (THALT )); - timeout = jiffies +usecs_to_jiffies (MACB_HALT_TIMEOUT ); -do { - halt_time = jiffies; - status =macb_readl (bp,TSR ); -if (!(status &MACB_BIT (TGO ))) -return 0 ; - -udelay (250 ); - }while (time_before (halt_time, timeout)); - -return -ETIMEDOUT ; +/* Poll TSR until TGO is cleared or timeout. */ +return read_poll_timeout_atomic (macb_readl, status, + !(status &MACB_BIT (TGO )), +250 ,MACB_HALT_TIMEOUT , false, + bp,TSR ); }static void macb_tx_unmap (struct macb *bp,struct macb_tx_skb *tx_skb)
drivers/net/ethernet/intel/ice/ice_arfs.c +2 -7
@@ -577,7 +577,7 @@ void ice_free_cpu_rx_rmap(struct ice_vsi *vsi) {struct net_device *netdev; -if (!vsi || vsi->type !=ICE_VSI_PF || !vsi->arfs_fltr_list) +if (!vsi || vsi->type !=ICE_VSI_PF )return ; netdev = vsi->netdev;
@@ -599,7 +599,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)int base_idx, i;if (!vsi || vsi->type !=ICE_VSI_PF ) -return -EINVAL ; +return 0 ; pf = vsi->back; netdev = vsi->netdev;
@@ -636,7 +636,6 @@ void ice_remove_arfs(struct ice_pf *pf)if (!pf_vsi)return ; -ice_free_cpu_rx_rmap (pf_vsi);ice_clear_arfs (pf_vsi); }
@@ -653,9 +652,5 @@ void ice_rebuild_arfs(struct ice_pf *pf)return ;ice_remove_arfs (pf); -if (ice_set_cpu_rx_rmap (pf_vsi)) { -dev_err (ice_pf_to_dev (pf),"Failed to rebuild aRFS\n" ); -return ; - }ice_init_arfs (pf_vsi); }
drivers/net/ethernet/intel/ice/ice_lib.c +4 -1
@@ -2645,6 +2645,8 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)return ; vsi->irqs_ready = false; +ice_free_cpu_rx_rmap (vsi); +ice_for_each_q_vector (vsi, i) {u16 vector = i + base;int irq_num;
@@ -2658,7 +2660,8 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)continue ;/* clear the affinity notifier in the IRQ descriptor */ -irq_set_affinity_notifier (irq_num,NULL ); +if (!IS_ENABLED (CONFIG_RFS_ACCEL )) +irq_set_affinity_notifier (irq_num,NULL );/* clear the affinity_mask in the IRQ descriptor */ irq_set_affinity_hint (irq_num,NULL );
drivers/net/ethernet/intel/ice/ice_main.c +8 -12
@@ -2393,6 +2393,13 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)irq_set_affinity_hint (irq_num, &q_vector->affinity_mask); } + err =ice_set_cpu_rx_rmap (vsi); +if (err) { +netdev_err (vsi->netdev,"Failed to setup CPU RMAP on VSI %u: %pe\n" , + vsi->vsi_num,ERR_PTR (err)); + goto free_q_irqs; + } + vsi->irqs_ready = true;return 0 ;
@@ -3380,22 +3387,12 @@ static int ice_setup_pf_sw(struct ice_pf *pf)*/ ice_napi_add (vsi); - status =ice_set_cpu_rx_rmap (vsi); -if (status) { -dev_err (ice_pf_to_dev (pf),"Failed to set CPU Rx map VSI %d error %d\n" , - vsi->vsi_num, status); - status = -EINVAL ; - goto unroll_napi_add; - } status =ice_init_mac_fltr (pf);if (status) - goto free_cpu_rx_map; + goto unroll_napi_add;return status; -free_cpu_rx_map: -ice_free_cpu_rx_rmap (vsi); - unroll_napi_add:if (vsi) {ice_napi_del (vsi);
@@ -4886,7 +4883,6 @@ static int __maybe_unused ice_suspend(struct device *dev)continue ;ice_vsi_free_q_vectors (pf->vsi[v]); } -ice_free_cpu_rx_rmap (ice_get_main_vsi (pf));ice_clear_interrupt_scheme (pf);pci_save_state (pdev);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +5 -2
@@ -1485,8 +1485,11 @@ static int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *adapter, u8 cmd_o } cmd_op = (cmd.rsp.arg[0 ] &0xff ); -if (cmd.rsp.arg[0 ] >>25 ==2 ) -return 2 ; +if (cmd.rsp.arg[0 ] >>25 ==2 ) { + ret =2 ; + goto out; + } +if (cmd_op ==QLCNIC_BC_CMD_CHANNEL_INIT )set_bit (QLC_BC_VF_STATE , &vf->state);else
drivers/net/wireless/mediatek/mt76/dma.c +1 -0
@@ -684,6 +684,7 @@ void mt76_dma_cleanup(struct mt76_dev *dev)int i;mt76_worker_disable (&dev->tx_worker); +napi_disable (&dev->tx_napi);netif_napi_del (&dev->tx_napi);for (i =0 ; i <ARRAY_SIZE (dev->phy.q_tx); i++) {
drivers/phy/renesas/phy-rcar-gen3-usb2.c +5 -2
@@ -453,8 +453,11 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) val =readl (usb2_base +USB2_INT_ENABLE ); val |=USB2_INT_ENABLE_UCOM_INTEN | rphy->int_enable_bits;writel (val, usb2_base +USB2_INT_ENABLE ); -writel (USB2_SPD_RSM_TIMSET_INIT , usb2_base +USB2_SPD_RSM_TIMSET ); -writel (USB2_OC_TIMSET_INIT , usb2_base +USB2_OC_TIMSET ); + +if (!rcar_gen3_is_any_rphy_initialized (channel)) { +writel (USB2_SPD_RSM_TIMSET_INIT , usb2_base +USB2_SPD_RSM_TIMSET ); +writel (USB2_OC_TIMSET_INIT , usb2_base +USB2_OC_TIMSET ); + }/* Initialize otg part */ if (channel->is_otg_channel) {
drivers/phy/tegra/xusb.c +4 -4
@@ -542,16 +542,16 @@ static int tegra_xusb_port_init(struct tegra_xusb_port *port, err =dev_set_name (&port->dev,"%s-%u" , name, index);if (err <0 ) - goto unregister; + goto put_device; err =device_add (&port->dev);if (err <0 ) - goto unregister; + goto put_device;return 0 ; -unregister: -device_unregister (&port->dev); +put_device: +put_device (&port->dev);return err; }
drivers/platform/x86/asus-wmi.c +2 -1
@@ -3052,7 +3052,8 @@ static int asus_wmi_add(struct platform_device *pdev) goto fail_leds;asus_wmi_get_devstate (asus,ASUS_WMI_DEVID_WLAN , &result); -if (result & (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) +if ((result & (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) == + (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) asus->driver->wlan_ctrl_by_user =1 ;if (!(asus->driver->wlan_ctrl_by_user &&ashs_present ())) {
drivers/spi/spi-loopback-test.c +1 -1
@@ -383,7 +383,7 @@ MODULE_LICENSE("GPL");static void spi_test_print_hex_dump (char *pre,const void *ptr,size_t len) {/* limit the hex_dump */ -if (len <1024 ) { +if (len <=1024 ) {print_hex_dump (KERN_INFO , pre,DUMP_PREFIX_OFFSET ,16 ,1 , ptr, len,0 );
drivers/usb/typec/altmodes/displayport.c +9 -9
@@ -521,22 +521,26 @@ static ssize_t pin_assignment_show(struct device *dev, }static DEVICE_ATTR_RW (pin_assignment); -static struct attribute *dp_altmode_attrs[] = { +static struct attribute *displayport_attrs[] = { &dev_attr_configuration.attr, &dev_attr_pin_assignment.attr,NULL }; -static const struct attribute_group dp_altmode_group = { +static const struct attribute_group displayport_group = { .name ="displayport" , - .attrs = dp_altmode_attrs, + .attrs = displayport_attrs, +}; + +static const struct attribute_group *displayport_groups[] = { + &displayport_group, +NULL , };int dp_altmode_probe (struct typec_altmode *alt) {const struct typec_altmode *port =typec_altmode_get_partner (alt);struct dp_altmode *dp; -int ret;/* FIXME: Port can only be DFP_U. */
@@ -547,10 +551,6 @@ int dp_altmode_probe(struct typec_altmode *alt) DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)))return -ENODEV ; - ret =sysfs_create_group (&alt->dev.kobj, &dp_altmode_group); -if (ret) -return ret; - dp =devm_kzalloc (&alt->dev,sizeof (*dp),GFP_KERNEL );if (!dp)return -ENOMEM ;
@@ -576,7 +576,6 @@ void dp_altmode_remove(struct typec_altmode *alt) {struct dp_altmode *dp =typec_altmode_get_drvdata (alt); -sysfs_remove_group (&alt->dev.kobj, &dp_altmode_group);cancel_work_sync (&dp->work); }EXPORT_SYMBOL_GPL (dp_altmode_remove);
@@ -594,6 +593,7 @@ static struct typec_altmode_driver dp_altmode_driver = { .driver = { .name = "typec_displayport", .owner = THIS_MODULE, + .dev_groups = displayport_groups, }, };module_typec_altmode_driver (dp_altmode_driver);
drivers/usb/typec/ucsi/displayport.c +11 -8
@@ -54,7 +54,8 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)u8 cur =0 ;int ret; -mutex_lock (&dp->con->lock); +if (!ucsi_con_mutex_lock (dp->con)) +return -ENOTCONN ;if (!dp->override && dp->initialized) {const struct typec_altmode *p =typec_altmode_get_partner (alt);
@@ -100,7 +101,7 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)schedule_work (&dp->work); ret =0 ; err_unlock: -mutex_unlock (&dp->con->lock); +ucsi_con_mutex_unlock (dp->con);return ret; }
@@ -112,7 +113,8 @@ static int ucsi_displayport_exit(struct typec_altmode *alt)u64 command;int ret =0 ; -mutex_lock (&dp->con->lock); +if (!ucsi_con_mutex_lock (dp->con)) +return -ENOTCONN ;if (!dp->override) {const struct typec_altmode *p =typec_altmode_get_partner (alt);
@@ -144,7 +146,7 @@ static int ucsi_displayport_exit(struct typec_altmode *alt)schedule_work (&dp->work); out_unlock: -mutex_unlock (&dp->con->lock); +ucsi_con_mutex_unlock (dp->con);return ret; }
@@ -202,20 +204,21 @@ static int ucsi_displayport_vdm(struct typec_altmode *alt,int cmd =PD_VDO_CMD (header);int svdm_version; -mutex_lock (&dp->con->lock); +if (!ucsi_con_mutex_lock (dp->con)) +return -ENOTCONN ;if (!dp->override && dp->initialized) {const struct typec_altmode *p =typec_altmode_get_partner (alt);dev_warn (&p->dev,"firmware doesn't support alternate mode overriding\n" ); -mutex_unlock (&dp->con->lock); +ucsi_con_mutex_unlock (dp->con);return -EOPNOTSUPP ; } svdm_version =typec_altmode_get_svdm_version (alt);if (svdm_version <0 ) { -mutex_unlock (&dp->con->lock); +ucsi_con_mutex_unlock (dp->con);return svdm_version; }
@@ -259,7 +262,7 @@ static int ucsi_displayport_vdm(struct typec_altmode *alt,break ; } -mutex_unlock (&dp->con->lock); +ucsi_con_mutex_unlock (dp->con);return 0 ; }
drivers/usb/typec/ucsi/ucsi.c +34 -0
@@ -1351,6 +1351,40 @@ void ucsi_set_drvdata(struct ucsi *ucsi, void *data) }EXPORT_SYMBOL_GPL (ucsi_set_drvdata); +/** +* ucsi_con_mutex_lock - Acquire the connector mutex +* @con: The connector interface to lock +* +* Returns true on success, false if the connector is disconnected +*/ +bool ucsi_con_mutex_lock (struct ucsi_connector *con) +{ +bool mutex_locked = false; +bool connected = true; + +while (connected && !mutex_locked) { + mutex_locked =mutex_trylock (&con->lock) !=0 ; + connected = con->status.flags &UCSI_CONSTAT_CONNECTED ; +if (connected && !mutex_locked) +msleep (20 ); + } + + connected = connected && con->partner; +if (!connected && mutex_locked) +mutex_unlock (&con->lock); + +return connected; +} + +/** +* ucsi_con_mutex_unlock - Release the connector mutex +* @con: The connector interface to unlock +*/ +void ucsi_con_mutex_unlock (struct ucsi_connector *con) +{ +mutex_unlock (&con->lock); +} +/** * ucsi_create - Allocate UCSI instance * @dev: Device interface to the PPM (Platform Policy Manager)
drivers/usb/typec/ucsi/ucsi.h +3 -0
@@ -15,6 +15,7 @@struct ucsi ;struct ucsi_altmode ; +struct ucsi_connector ;/* UCSI offsets (Bytes) */ #define UCSI_VERSION 0
@@ -62,6 +63,8 @@ int ucsi_register(struct ucsi *ucsi);void ucsi_unregister (struct ucsi *ucsi);void *ucsi_get_drvdata (struct ucsi *ucsi);void ucsi_set_drvdata (struct ucsi *ucsi,void *data); +bool ucsi_con_mutex_lock (struct ucsi_connector *con); +void ucsi_con_mutex_unlock (struct ucsi_connector *con);void ucsi_connector_change (struct ucsi *ucsi,u8 num);
drivers/usb/typec/ucsi/ucsi_ccg.c +5 -0
@@ -573,6 +573,10 @@ static int ucsi_ccg_sync_write(struct ucsi *ucsi, unsigned int offset, uc->has_multiple_dp) { con_index = (uc->last_cmd_sent >>16 ) &UCSI_CMD_CONNECTOR_MASK ; +if (con_index ==0 ) { + ret = -EINVAL ; + goto err_put; + } con = &uc->ucsi->connector[con_index -1 ];ucsi_ccg_update_set_new_cam_cmd (uc, con, (u64 *)val); }
@@ -587,6 +591,7 @@ static int ucsi_ccg_sync_write(struct ucsi *ucsi, unsigned int offset, err_clear_bit:clear_bit (DEV_CMD_PENDING , &uc->flags); +err_put:pm_runtime_put_sync (uc->dev);mutex_unlock (&uc->lock);
fs/btrfs/discard.c +15 -2
@@ -78,8 +78,6 @@ static void __add_to_discard_list(struct btrfs_discard_ctl *discard_ctl, struct btrfs_block_group *block_group) {lockdep_assert_held (&discard_ctl->lock); -if (!btrfs_run_discard_work (discard_ctl)) -return ;if (list_empty (&block_group->discard_list) || block_group->discard_index ==BTRFS_DISCARD_INDEX_UNUSED ) {
@@ -102,6 +100,9 @@ static void add_to_discard_list(struct btrfs_discard_ctl *discard_ctl,if (!btrfs_is_block_group_data_only (block_group))return ; +if (!btrfs_run_discard_work (discard_ctl)) +return ; +spin_lock (&discard_ctl->lock);__add_to_discard_list (discard_ctl, block_group);spin_unlock (&discard_ctl->lock);
@@ -233,6 +234,18 @@ static struct btrfs_block_group *peek_discard_list( block_group->used != 0) {if (btrfs_is_block_group_data_only (block_group)) {__add_to_discard_list (discard_ctl, block_group); +/* +* The block group must have been moved to other +* discard list even if discard was disabled in +* the meantime or a transaction abort happened, +* otherwise we can end up in an infinite loop, +* always jumping into the 'again' label and +* keep getting this block group over and over +* in case there are no other block groups in +* the discard lists. +*/ +ASSERT (block_group->discard_index != +BTRFS_DISCARD_INDEX_UNUSED ); }else {list_del_init (&block_group->discard_list);btrfs_put_block_group (block_group);
fs/btrfs/extent-tree.c +20 -5
@@ -176,6 +176,14 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, ei =btrfs_item_ptr (leaf, path->slots[0 ], struct btrfs_extent_item); num_refs =btrfs_extent_refs (leaf, ei); +if (unlikely (num_refs ==0 )) { + ret = -EUCLEAN ; +btrfs_err (fs_info, +"unexpected zero reference count for extent item (%llu %u %llu)" , + key.objectid, key.type, key.offset); +btrfs_abort_transaction (trans, ret); + goto out_free; + } extent_flags =btrfs_extent_flags (leaf, ei); }else { ret = -EINVAL ;
@@ -187,8 +195,6 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, goto out_free; } - -BUG_ON (num_refs ==0 ); }else { num_refs =0 ; extent_flags =0 ;
@@ -218,10 +224,19 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, goto search_again; }spin_lock (&head->lock); -if (head->extent_op && head->extent_op->update_flags) +if (head->extent_op && head->extent_op->update_flags) { extent_flags |= head->extent_op->flags_to_set; -else -BUG_ON (num_refs ==0 ); + }else if (unlikely (num_refs ==0 )) { +spin_unlock (&head->lock); +mutex_unlock (&head->mutex); +spin_unlock (&delayed_refs->lock); + ret = -EUCLEAN ; +btrfs_err (fs_info, +"unexpected zero reference count for extent %llu (%s)" , + bytenr, metadata ?"metadata" :"data" ); +btrfs_abort_transaction (trans, ret); + goto out_free; + } num_refs += head->ref_mod;spin_unlock (&head->lock);
fs/btrfs/extent_io.c +7 -8
@@ -2624,7 +2624,6 @@ int btrfs_repair_one_sector(struct inode *inode,const int icsum = bio_offset >> fs_info->sectorsize_bits;struct bio *repair_bio;struct btrfs_io_bio *repair_io_bio; -blk_status_t status;btrfs_debug (fs_info,"repair read error: read error at %llu" , start);
@@ -2664,13 +2663,13 @@ int btrfs_repair_one_sector(struct inode *inode,"repair read error: submitting new read to mirror %d" , failrec->this_mirror); - status =submit_bio_hook (inode, repair_bio, failrec->this_mirror, - failrec->bio_flags); -if (status) { -free_io_failure (failure_tree, tree, failrec); -bio_put (repair_bio); - } -return blk_status_to_errno (status); +/* +* At this point we have a bio, so any errors from submit_bio_hook() +* will be handled by the endio on the repair_bio, so we can't return an +* error here. +*/ +submit_bio_hook (inode, repair_bio, failrec->this_mirror, failrec->bio_flags); +return BLK_STS_OK ; }static void end_page_read (struct page *page,bool uptodate,u64 start,u32 len)
fs/nfs/nfs4proc.c +8 -1
@@ -6835,10 +6835,18 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,struct nfs4_unlockdata *p;struct nfs4_state *state = lsp->ls_state;struct inode *inode = state->inode; +struct nfs_lock_context *l_ctx; p =kzalloc (sizeof (*p),GFP_KERNEL );if (p ==NULL )return NULL ; + l_ctx =nfs_get_lock_context (ctx); +if (!IS_ERR (l_ctx)) { + p->l_ctx = l_ctx; + }else { +kfree (p); +return NULL ; + } p->arg.fh =NFS_FH (inode); p->arg.fl = &p->fl; p->arg.seqid = seqid;
@@ -6846,7 +6854,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, p->lsp = lsp;/* Ensure we don't close file until we're done freeing locks! */ p->ctx =get_nfs_open_context (ctx); - p->l_ctx =nfs_get_lock_context (ctx);locks_init_lock (&p->fl);locks_copy_lock (&p->fl, fl); p->server =NFS_SERVER (inode);
fs/nfs/pnfs.c +9 -0
@@ -729,6 +729,14 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,return remaining; } +static void pnfs_reset_return_info (struct pnfs_layout_hdr *lo) +{ +struct pnfs_layout_segment *lseg; + +list_for_each_entry (lseg, &lo->plh_return_segs, pls_list) +pnfs_set_plh_return_info (lo, lseg->pls_range.iomode,0 ); +} + static void pnfs_free_returned_lsegs(struct pnfs_layout_hdr *lo, struct list_head *free_me,
@@ -1177,6 +1185,7 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,pnfs_mark_matching_lsegs_invalid (lo, &freeme, range, seq);pnfs_free_returned_lsegs (lo, &freeme, range, seq);pnfs_set_layout_stateid (lo, stateid,NULL , true); +pnfs_reset_return_info (lo); }else pnfs_mark_layout_stateid_invalid (lo, &freeme); out_unlock:
include/linux/cpu.h +2 -0
@@ -76,6 +76,8 @@ extern ssize_t cpu_show_gds(struct device *dev, struct device_attribute *attr, char *buf);extern ssize_t cpu_show_reg_file_data_sampling (struct device *dev,struct device_attribute *attr,char *buf); +extern ssize_t cpu_show_indirect_target_selection (struct device *dev, +struct device_attribute *attr,char *buf); extern __printf(4, 5) struct device *cpu_device_create(struct device *parent, void *drvdata,
include/linux/module.h +5 -0
@@ -528,6 +528,11 @@ struct module {atomic_t refcnt;#endif +#ifdef CONFIG_MITIGATION_ITS +int its_num_pages; +void **its_page_array; +#endif +#ifdef CONFIG_CONSTRUCTORS /* Constructor functions. */ ctor_fn_t *ctors;
include/net/netfilter/nf_tables.h +1 -1
@@ -1088,7 +1088,7 @@ static inline bool nft_chain_is_bound(struct nft_chain *chain)int nft_chain_add (struct nft_table *table,struct nft_chain *chain);void nft_chain_del (struct nft_chain *chain); -void nf_tables_chain_destroy (struct nft_ctx *ctx); +void nf_tables_chain_destroy (struct nft_chain *chain);struct nft_stats {u64 bytes;
include/net/sch_generic.h +15 -0
@@ -1035,6 +1035,21 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct qdisc_skb_head *qh)return skb; } +static inline struct sk_buff *qdisc_dequeue_internal (struct Qdisc *sch,bool direct) +{ +struct sk_buff *skb; + + skb =__skb_dequeue (&sch->gso_skb); +if (skb) { + sch->q.qlen--; +return skb; + } +if (direct) +return __qdisc_dequeue_head (&sch->q); +else +return sch->dequeue (sch); +} +static inline struct sk_buff *qdisc_dequeue_head (struct Qdisc *sch) {struct sk_buff *skb =__qdisc_dequeue_head (&sch->q);
kernel/trace/trace_dynevent.c +15 -1
@@ -16,7 +16,7 @@#include "trace_output.h" /* for trace_event_sem */ #include "trace_dynevent.h" -static DEFINE_MUTEX (dyn_event_ops_mutex); +DEFINE_MUTEX (dyn_event_ops_mutex);static LIST_HEAD (dyn_event_ops_list);bool trace_event_dyn_try_get_ref (struct trace_event_call *dyn_call)
@@ -125,6 +125,20 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *typereturn ret; } +/* +* Locked version of event creation. The event creation must be protected by +* dyn_event_ops_mutex because of protecting trace_probe_log. +*/ +int dyn_event_create (const char *raw_command,struct dyn_event_operations *type) +{ +int ret; + +mutex_lock (&dyn_event_ops_mutex); + ret = type->create (raw_command); +mutex_unlock (&dyn_event_ops_mutex); +return ret; +} +static int create_dyn_event (const char *raw_command) {struct dyn_event_operations *ops;
kernel/trace/trace_dynevent.h +1 -0
@@ -100,6 +100,7 @@ void *dyn_event_seq_next(struct seq_file *m, void *v, loff_t *pos);void dyn_event_seq_stop (struct seq_file *m,void *v);int dyn_events_release_all (struct dyn_event_operations *type);int dyn_event_release (const char *raw_command,struct dyn_event_operations *type); +int dyn_event_create (const char *raw_command,struct dyn_event_operations *type);/* * for_each_dyn_event - iterate over the dyn_event list
kernel/trace/trace_events_trigger.c +1 -1
@@ -1244,7 +1244,7 @@ stacktrace_trigger(struct event_trigger_data *data,struct trace_event_file *file = data->private_data;if (file) -__trace_stack (file->tr,tracing_gen_ctx (),STACK_SKIP ); +__trace_stack (file->tr,tracing_gen_ctx_dec (),STACK_SKIP );else trace_dump_stack (STACK_SKIP ); }
kernel/trace/trace_functions.c +1 -5
@@ -568,11 +568,7 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, static __always_inline void trace_stack(struct trace_array *tr) { -unsigned int trace_ctx; - - trace_ctx =tracing_gen_ctx (); - -__trace_stack (tr, trace_ctx,FTRACE_STACK_SKIP ); +__trace_stack (tr,tracing_gen_ctx_dec (),FTRACE_STACK_SKIP ); } static void
kernel/trace/trace_kprobe.c +1 -1
@@ -971,7 +971,7 @@ static int create_or_delete_trace_kprobe(const char *raw_command)if (raw_command[0 ] =='-' )return dyn_event_release (raw_command, &trace_kprobe_ops); - ret =trace_kprobe_create (raw_command); + ret =dyn_event_create (raw_command, &trace_kprobe_ops);return ret == -ECANCELED ? -EINVAL : ret; }
kernel/trace/trace_probe.c +9 -0
@@ -143,9 +143,12 @@ static const struct fetch_type *find_fetch_type(const char *type) }static struct trace_probe_log trace_probe_log; +extern struct mutex dyn_event_ops_mutex;void trace_probe_log_init (const char *subsystem,int argc,const char **argv) { +lockdep_assert_held (&dyn_event_ops_mutex); + trace_probe_log.subsystem = subsystem; trace_probe_log.argc = argc; trace_probe_log.argv = argv;
@@ -154,11 +157,15 @@ void trace_probe_log_init(const char *subsystem, int argc, const char **argv)void trace_probe_log_clear (void ) { +lockdep_assert_held (&dyn_event_ops_mutex); +memset (&trace_probe_log,0 ,sizeof (trace_probe_log)); }void trace_probe_log_set_index (int index) { +lockdep_assert_held (&dyn_event_ops_mutex); + trace_probe_log.index = index; }
@@ -167,6 +174,8 @@ void __trace_probe_log_err(int offset, int err_type)char *command, *p;int i, len =0 , pos =0 ; +lockdep_assert_held (&dyn_event_ops_mutex); +if (!trace_probe_log.argv)return ;
kernel/trace/trace_uprobe.c +1 -1
@@ -729,7 +729,7 @@ static int create_or_delete_trace_uprobe(const char *raw_command)if (raw_command[0 ] =='-' )return dyn_event_release (raw_command, &trace_uprobe_ops); - ret =trace_uprobe_create (raw_command); + ret =dyn_event_create (raw_command, &trace_uprobe_ops);return ret == -ECANCELED ? -EINVAL : ret; }
net/netfilter/nf_tables_api.c +39 -15
123 lines not on this page · raw message
net/netfilter/nft_immediate.c +1 -1
@@ -221,7 +221,7 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx,list_del (&rule->list);nf_tables_rule_destroy (&chain_ctx, rule); } -nf_tables_chain_destroy (&chain_ctx); +nf_tables_chain_destroy (chain);break ;default :break ;
net/sched/sch_codel.c +1 -1
@@ -174,7 +174,7 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt, qlen = sch->q.qlen;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =__qdisc_dequeue_head (&sch->q); +struct sk_buff *skb =qdisc_dequeue_internal (sch, true); dropped +=qdisc_pkt_len (skb);qdisc_qstats_backlog_dec (sch, skb);
net/sched/sch_fq.c +1 -1
@@ -904,7 +904,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch); }while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =fq_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false);if (!skb)break ;
net/sched/sch_fq_codel.c +1 -1
@@ -429,7 +429,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,while (sch->q.qlen > sch->limit || q->memory_usage > q->memory_limit) { -struct sk_buff *skb =fq_codel_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false); q->cstats.drop_len +=qdisc_pkt_len (skb);rtnl_kfree_skbs (skb, skb);
net/sched/sch_fq_pie.c +1 -1
@@ -360,7 +360,7 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,/* Drop excess packets if new limit is lower */ while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =fq_pie_qdisc_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false); len_dropped +=qdisc_pkt_len (skb); num_dropped +=1 ;
net/sched/sch_hhf.c +1 -1
@@ -563,7 +563,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt, qlen = sch->q.qlen; prev_backlog = sch->qstats.backlog;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =hhf_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false);rtnl_kfree_skbs (skb, skb); }
net/sched/sch_pie.c +1 -1
@@ -193,7 +193,7 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt,/* Drop excess packets if new limit is lower */ qlen = sch->q.qlen;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =__qdisc_dequeue_head (&sch->q); +struct sk_buff *skb =qdisc_dequeue_internal (sch, true); dropped +=qdisc_pkt_len (skb);qdisc_qstats_backlog_dec (sch, skb);
net/sctp/sysctl.c +4 -0
@@ -518,6 +518,8 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,return ret; } +static DEFINE_MUTEX (sctp_sysctl_mutex); +static int proc_sctp_do_udp_port (struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -542,6 +544,7 @@ static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write,if (new_value > max || new_value < min)return -EINVAL ; +mutex_lock (&sctp_sysctl_mutex); net->sctp.udp_port = new_value;sctp_udp_sock_stop (net);if (new_value) {
@@ -554,6 +557,7 @@ static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write,lock_sock (sk);sctp_sk (sk)->udp_port =htons (net->sctp.udp_port);release_sock (sk); +mutex_unlock (&sctp_sysctl_mutex); }return ret;
samples/ftrace/sample-trace-array.c +1 -1
@@ -112,7 +112,7 @@ static int __init sample_trace_array_init(void)/* * If context specific per-cpu buffers havent already been allocated. */ -trace_printk_init_buffers (); +trace_array_init_printk (tr); simple_tsk =kthread_run (simple_thread,NULL ,"sample-instance" );if (IS_ERR (simple_tsk)) {
sound/pci/es1968.c +4 -2
@@ -1569,7 +1569,7 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream)struct snd_pcm_runtime *runtime = substream->runtime;struct es1968 *chip =snd_pcm_substream_chip (substream);struct esschan *es; -int apu1, apu2; +int err, apu1, apu2; apu1 =snd_es1968_alloc_apu_pair (chip,ESM_APU_PCM_CAPTURE );if (apu1 <0 )
@@ -1613,7 +1613,9 @@ static int snd_es1968_capture_open(struct snd_pcm_substream *substream) runtime->hw = snd_es1968_capture; runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =calc_available_memory_size (chip) -1024 ;/* keep MIXBUF size */ -snd_pcm_hw_constraint_pow2 (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_BYTES ); + err =snd_pcm_hw_constraint_pow2 (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_BYTES ); +if (err <0 ) +return err;spin_lock_irq (&chip->substream_lock);list_add (&es->list, &chip->substream_list);
sound/sh/Kconfig +1 -1
@@ -14,7 +14,7 @@ if SND_SUPERH config SND_AICA tristate "Dreamcast Yamaha AICA sound" - depends on SH_DREAMCAST + depends on SH_DREAMCAST && SH_DMA_API select SND_PCM select G2_DMA help
sound/usb/quirks.c +4 -0
@@ -1837,6 +1837,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x0c45 ,0x6340 ,/* Sonix HD USB Camera */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x0c45 ,0x636b ,/* Microdia JP001 USB Camera */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0d8c ,0x0014 ,/* USB Audio Device */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), DEVICE_FLG(0x0ecb, 0x205c, /* JBL Quantum610 Wireless */
@@ -1845,6 +1847,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_FIXED_RATE),DEVICE_FLG (0x0fd9 ,0x0008 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), +DEVICE_FLG (0x1101 ,0x0003 ,/* Audioengine D1 */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
tools/testing/selftests/vm/compaction_test.c +14 -5
@@ -89,6 +89,8 @@ int check_compaction(unsigned long mem_free, unsigned long hugepage_size)int compaction_index =0 ;char initial_nr_hugepages[20 ] = {0 };char nr_hugepages[20 ] = {0 }; +char target_nr_hugepages[24 ] = {0 }; +int slen;/* We want to test with 80% of available memory. Else, OOM killer comes in to play */
@@ -118,11 +120,18 @@ int check_compaction(unsigned long mem_free, unsigned long hugepage_size)lseek (fd,0 ,SEEK_SET ); -/* Request a large number of huge pages. The Kernel will allocate -as much as it can */ -if (write (fd,"100000" , (6 *sizeof (char ))) != (6 *sizeof (char ))) { -ksft_test_result_fail ("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n" , -strerror (errno)); +/* +* Request huge pages for about half of the free memory. The Kernel +* will allocate as much as it can, and we expect it will get at least 1/3 +*/ + nr_hugepages_ul = mem_free / hugepage_size /2 ; +snprintf (target_nr_hugepages,sizeof (target_nr_hugepages), +"%lu" , nr_hugepages_ul); + + slen =strlen (target_nr_hugepages); +if (write (fd, target_nr_hugepages, slen) != slen) { +ksft_test_result_fail ("Failed to write %lu to /proc/sys/vm/nr_hugepages: %s\n" , + nr_hugepages_ul,strerror (errno)); goto close_fd; }