Linux 6.1.119
Greg Kroah-Hartman
maintainerI'm announcing the release of the 6.1.119 kernel.
All users of the 6.1 kernel series must upgrade.
The updated 6.1.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-6.1.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
------------
Makefile | 2 arch/arm/kernel/head.S | 8 arch/arm/mm/mmu.c | 34 +- arch/arm64/include/asm/mman.h | 10 arch/parisc/Kconfig | 1 arch/parisc/include/asm/cache.h | 11 arch/x86/kvm/lapic.c | 29 + arch/x86/kvm/vmx/nested.c | 30 + arch/x86/kvm/vmx/vmx.c | 6 arch/x86/mm/ioremap.c | 6 drivers/block/null_blk/main.c | 45 +- drivers/char/xillybus/xillybus_class.c | 7 drivers/char/xillybus/xillyusb.c | 22 + drivers/cxl/core/pci.c | 2 drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c | 6 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 3 drivers/gpu/drm/bridge/tc358768.c | 21 + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 drivers/media/dvb-core/dvbdev.c | 15 drivers/mmc/host/dw_mmc.c | 4 drivers/mmc/host/sunxi-mmc.c | 6 drivers/net/bonding/bond_main.c | 16 drivers/net/bonding/bond_options.c | 82 ++++- drivers/net/ethernet/freescale/fec_main.c | 26 - drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 2 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 8 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 15 drivers/net/ethernet/vertexcom/mse102x.c | 4 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 25 - drivers/vdpa/mlx5/core/mr.c | 8 drivers/vdpa/virtio_pci/vp_vdpa.c | 10 fs/9p/vfs_inode.c | 23 - fs/nfsd/netns.h | 1 fs/nfsd/nfs4proc.c | 34 -- fs/nfsd/nfs4state.c | 1 fs/nfsd/xdr4.h | 1 fs/nilfs2/btnode.c | 2 fs/nilfs2/gcinode.c | 4 fs/nilfs2/mdt.c | 1 fs/nilfs2/page.c | 2 fs/ntfs3/file.c | 12 fs/ocfs2/resize.c | 2 fs/ocfs2/super.c | 13 fs/smb/server/smb2misc.c | 26 + fs/smb/server/smb2pdu.c | 48 +- include/linux/mman.h | 7 include/linux/sockptr.h | 27 + include/net/bond_options.h | 2 lib/buildid.c | 2 mm/internal.h | 19 + mm/mmap.c | 120 +++---- mm/nommu.c | 9 mm/page_alloc.c | 3 mm/shmem.c | 5 mm/util.c | 33 ++ net/bluetooth/hci_core.c | 2 net/bluetooth/hci_event.c | 163 ---------- net/bluetooth/iso.c | 32 - net/mptcp/pm_netlink.c | 15 net/mptcp/pm_userspace.c | 77 +++- net/mptcp/protocol.c | 16 net/netfilter/ipvs/ip_vs_ctl.c | 10 net/netlink/af_netlink.c | 31 - net/netlink/af_netlink.h | 2 net/nfc/llcp_sock.c | 12 net/sched/cls_u32.c | 54 +-- net/sched/sch_taprio.c | 10 net/vmw_vsock/virtio_transport_common.c | 8 samples/pktgen/pktgen_sample01_simple.sh | 2 security/integrity/ima/ima_template_lib.c | 14 sound/pci/hda/patch_realtek.c | 3 tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json | 22 + 72 files changed, 759 insertions(+), 583 deletions(-)
Alexandre Ferrieux (1):
net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes.
Andre Przywara (1):
mmc: sunxi-mmc: Fix A100 compatible description
Andrew Morton (1):
mm: revert "mm: shmem: fix data-race in shmem_getattr()"
Andy Yan (1):
drm/rockchip: vop: Fix a dereferenced before check warning
Aurelien Jarno (1):
Revert "mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K"
Baoquan He (1):
x86/mm: Fix a kdump kernel failure on SME system when CONFIG_IMA_KEXEC=y
Chen Hanxiao (1):
ipvs: properly dereference pe in ip_vs_add_service
Christophe JAILLET (1):
null_blk: Remove usage of the deprecated ida_simple_xx() API
Chuck Lever (4):
NFSD: Async COPY result needs to return a write verifier
NFSD: Limit the number of concurrent async COPY operations
NFSD: Initialize struct nfsd4_copy earlier
NFSD: Never decrement pending_async_copies on error
Dai Ngo (1):
NFSD: initialize copy->cp_clp early in nfsd4_copy for use by trace point
Damien Le Moal (1):
null_blk: Fix return value of nullb_device_power_store()
Dan Carpenter (1):
cxl/pci: fix error code in __cxl_hdm_decode_init()
Dmitry Antipov (2):
ocfs2: uncache inode which has failed entering the group
ocfs2: fix UBSAN warning in ocfs2_verify_volume()
Dragos Tatulea (1):
net/mlx5e: kTLS, Fix incorrect page refcounting
Eli Billauer (2):
char: xillybus: Prevent use-after-free due to race condition
char: xillybus: Fix trivial bug with mutex
Eric Dumazet (2):
net: add copy_safe_from_sockptr() helper
nfc: llcp: fix nfc_llcp_setsockopt() unsafe copies
Eric Van Hensbergen (1):
fs/9p: fix uninitialized values during inode evict
Francesco Dolcini (1):
drm/bridge: tc358768: Fix DSI command tx
Geliang Tang (5):
mptcp: define more local variables sk
mptcp: add userspace_pm_lookup_addr_by_id helper
mptcp: update local address flags when setting it
mptcp: hold pm lock when deleting entry
mptcp: drop lookup_by_id in lookup_addr
Greg Kroah-Hartman (1):
Linux 6.1.119
Hangbin Liu (1):
bonding: add ns target multicast address to slave device
Harith G (1):
ARM: 9419/1: mm: Fix kernel memory mapping for xip kernels
Jakub Kicinski (1):
netlink: terminate outstanding dump on socket close
Jinjiang Tu (1):
mm: fix NULL pointer dereference in alloc_pages_bulk_noprof
Jiri Olsa (1):
lib/buildid: Fix build ID parsing logic
Kailang Yang (1):
ALSA: hda/realtek - Fixed Clevo platform headset Mic issue
Konstantin Komarov (1):
fs/ntfs3: Additional check in ntfs_file_release
Lin.Cao (1):
drm/amd: check num of link levels when update pcie param
Lorenzo Stoakes (4):
mm: avoid unsafe VMA hook invocation when error arises on mmap hook
mm: unconditionally close VMAs on error
mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling
mm: resolve faulty mmap_region() error path behaviour
Luiz Augusto von Dentz (2):
Bluetooth: hci_core: Fix calling mgmt_device_connected
Bluetooth: ISO: Fix not validating setsockopt user input
Lukas Bulwahn (1):
Bluetooth: hci_event: Remove code to removed CONFIG_BT_HS
Maksym Glubokiy (1):
ALSA: hda/realtek: fix mute/micmute LEDs for a HP EliteBook 645 G10
Mark Bloch (1):
net/mlx5: fs, lock FTE when checking if active
Matthieu Baerts (NGI0) (1):
mptcp: pm: use _rcu variant under rcu_read_lock
Mauro Carvalho Chehab (1):
media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set
Michal Luczaj (2):
virtio/vsock: Fix accept_queue memory leak
net: Make copy_safe_from_sockptr() match documentation
Mikulas Patocka (1):
parisc: fix a possible DMA corruption
Moshe Shemesh (1):
net/mlx5e: CT: Fix null-ptr-deref in add rule err flow
Namjae Jeon (2):
ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()
ksmbd: fix potencial out-of-bounds when buffer offset is invalid
Paolo Abeni (2):
mptcp: error out earlier on disconnect
mptcp: cope racing subflow creation in mptcp_rcv_space_adjust
Pedro Tammela (1):
net/sched: cls_u32: replace int refcounts with proper refcounts
Ryusuke Konishi (2):
nilfs2: fix null-ptr-deref in block_touch_buffer tracepoint
nilfs2: fix null-ptr-deref in block_dirty_buffer tracepoint
Samasth Norway Ananda (1):
ima: fix buffer overrun in ima_eventdigest_init_common
Sean Christopherson (3):
KVM: nVMX: Treat vpid01 as current if L2 is active, but with VPID disabled
KVM: x86: Unconditionally set irr_pending when updating APICv state
KVM: VMX: Bury Intel PT virtualization (guest/host mode) behind CONFIG_BROKEN
Si-Wei Liu (1):
vdpa/mlx5: Fix PA offset with unaligned starting iotlb map
Stefan Wahren (2):
net: vertexcom: mse102x: Fix tx_bytes calculation
staging: vchiq_arm: Get the rid off struct vchiq_2835_state
Umang Jain (1):
staging: vchiq_arm: Use devm_kzalloc() for vchiq_arm_state allocation
Vijendar Mukunda (1):
drm/amd: Fix initialization mistake for NBIO 7.7.0
Vladimir Oltean (1):
net/sched: taprio: extend minimum interval restriction to entire cycle too
Wei Fang (2):
samples: pktgen: correct dev to DEV
net: fec: remove .ndo_poll_controller to avoid deadlocks
Xiaoguang Wang (1):
vp_vdpa: fix id_table array not null terminated error
Yu Kuai (1):
null_blk: fix null-ptr-dereference while configuring 'power' and 'submit_queues'
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 6 PATCHLEVEL = 1 -SUBLEVEL = 118 +SUBLEVEL = 119 EXTRAVERSION = NAME = Curry Ramen
arch/arm/kernel/head.S +6 -2
@@ -252,11 +252,15 @@ __create_page_tables: */ add r0, r4, #KERNEL_OFFSET >> (SECTION_SHIFT - PMD_ENTRY_ORDER) ldr r6, =(_end - 1) + + /* For XIP, kernel_sec_start/kernel_sec_end are currently in RO memory */ +#ifndef CONFIG_XIP_KERNEL adr_l r5, kernel_sec_start @ _pa(kernel_sec_start) #if defined CONFIG_CPU_ENDIAN_BE8 || defined CONFIG_CPU_ENDIAN_BE32 str r8, [r5, #4] @ Save physical start of kernel (BE) #else str r8, [r5] @ Save physical start of kernel (LE) +#endif #endif orr r3, r8, r7 @ Add the MMU flags add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ENTRY_ORDER)
@@ -264,6 +268,7 @@ __create_page_tables: add r3, r3, #1 << SECTION_SHIFT cmp r0, r6 bls 1b +#ifndef CONFIG_XIP_KERNEL eor r3, r3, r7 @ Remove the MMU flags adr_l r5, kernel_sec_end @ _pa(kernel_sec_end) #if defined CONFIG_CPU_ENDIAN_BE8 || defined CONFIG_CPU_ENDIAN_BE32
@@ -271,8 +276,7 @@ __create_page_tables: #else str r3, [r5] @ Save physical end of kernel (LE) #endif - -#ifdef CONFIG_XIP_KERNEL +#else /* * Map the kernel image separately as it is not located in RAM. */
arch/arm/mm/mmu.c +21 -13
@@ -1401,18 +1401,6 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)create_mapping (&map); } -/* -* Map the kernel if it is XIP. -* It is always first in the modulearea. -*/ -#ifdef CONFIG_XIP_KERNEL - map.pfn =__phys_to_pfn (CONFIG_XIP_PHYS_ADDR &SECTION_MASK ); - map.virtual =MODULES_VADDR ; - map.length = ((unsigned long )_exiprom - map.virtual + ~SECTION_MASK ) &SECTION_MASK ; - map.type =MT_ROM ; -create_mapping (&map); -#endif -/* * Map the cache flushing regions. */
@@ -1602,12 +1590,27 @@ static void __init map_kernel(void)* This will only persist until we turn on proper memory management later on * and we remap the whole kernel with page granularity. */ +#ifdef CONFIG_XIP_KERNEL +phys_addr_t kernel_nx_start = kernel_sec_start; +#else phys_addr_t kernel_x_start = kernel_sec_start;phys_addr_t kernel_x_end =round_up (__pa (__init_end),SECTION_SIZE );phys_addr_t kernel_nx_start = kernel_x_end; +#endif phys_addr_t kernel_nx_end = kernel_sec_end;struct map_desc map; +/* +* Map the kernel if it is XIP. +* It is always first in the modulearea. +*/ +#ifdef CONFIG_XIP_KERNEL + map.pfn =__phys_to_pfn (CONFIG_XIP_PHYS_ADDR &SECTION_MASK ); + map.virtual =MODULES_VADDR ; + map.length = ((unsigned long )_exiprom - map.virtual + ~SECTION_MASK ) &SECTION_MASK ; + map.type =MT_ROM ; +create_mapping (&map); +#else map.pfn =__phys_to_pfn (kernel_x_start); map.virtual =__phys_to_virt (kernel_x_start); map.length = kernel_x_end - kernel_x_start;
@@ -1617,7 +1620,7 @@ static void __init map_kernel(void)/* If the nx part is small it may end up covered by the tail of the RWX section */ if (kernel_x_end == kernel_nx_end)return ; - +#endif map.pfn =__phys_to_pfn (kernel_nx_start); map.virtual =__phys_to_virt (kernel_nx_start); map.length = kernel_nx_end - kernel_nx_start;
@@ -1762,6 +1765,11 @@ void __init paging_init(const struct machine_desc *mdesc) {void *zero_page; +#ifdef CONFIG_XIP_KERNEL +/* Store the kernel RW RAM region start/end in these variables */ + kernel_sec_start =CONFIG_PHYS_OFFSET &SECTION_MASK ; + kernel_sec_end =round_up (__pa (_end),SECTION_SIZE ); +#endif pr_debug ("physical kernel sections: 0x%08llx-0x%08llx\n" , kernel_sec_start, kernel_sec_end);
arch/arm64/include/asm/mman.h +7 -3
@@ -3,6 +3,8 @@#define __ASM_MMAN_H__#include <linux/compiler.h> +#include <linux/fs.h> +#include <linux/shmem_fs.h> #include <linux/types.h> #include <uapi/asm/mman.h>
@@ -21,19 +23,21 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, }#define arch_calc_vm_prot_bits (prot, pkey) arch_calc_vm_prot_bits(prot, pkey) -static inline unsigned long arch_calc_vm_flag_bits (unsigned long flags) +static inline unsigned long arch_calc_vm_flag_bits (struct file *file, +unsigned long flags) {/* * Only allow MTE on anonymous mappings as these are guaranteed to be * backed by tags-capable memory. The vm_flags may be overridden by a * filesystem supporting MTE (RAM-based). */ -if (system_supports_mte () && (flags &MAP_ANONYMOUS )) +if (system_supports_mte () && + ((flags &MAP_ANONYMOUS ) ||shmem_file (file)))return VM_MTE_ALLOWED ;return 0 ; } -#define arch_calc_vm_flag_bits (flags) arch_calc_vm_flag_bits(flags) +#define arch_calc_vm_flag_bits (file, flags) arch_calc_vm_flag_bits(file, flags)static inline bool arch_validate_prot (unsigned long prot,unsigned long addr__always_unused )
arch/parisc/Kconfig +1 -0
@@ -18,6 +18,7 @@ config PARISC select ARCH_SUPPORTS_HUGETLBFS if PA20 select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_STACKWALK + select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_DEBUG_VM_PGTABLE select HAVE_RELIABLE_STACKTRACE select DMA_OPS
arch/parisc/include/asm/cache.h +10 -1
@@ -20,7 +20,16 @@#define SMP_CACHE_BYTES L1_CACHE_BYTES -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES +#ifdef CONFIG_PA20 +#define ARCH_DMA_MINALIGN 128 +#else +#define ARCH_DMA_MINALIGN 32 +#endif +#define ARCH_KMALLOC_MINALIGN 16/* ldcw requires 16-byte alignment */ + +#define arch_slab_minalign () ((unsigned)dcache_stride) +#define cache_line_size () dcache_stride +#define dma_get_cache_alignment cache_line_size#define __read_mostly __section(".data..read_mostly")
arch/x86/kvm/lapic.c +18 -11
@@ -2453,19 +2453,26 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) {struct kvm_lapic *apic = vcpu->arch.apic; -if (apic->apicv_active) { -/* irr_pending is always true when apicv is activated. */ - apic->irr_pending = true; +/* +* When APICv is enabled, KVM must always search the IRR for a pending +* IRQ, as other vCPUs and devices can set IRR bits even if the vCPU +* isn't running. If APICv is disabled, KVM _should_ search the IRR +* for a pending IRQ. But KVM currently doesn't ensure *all* hardware, +* e.g. CPUs and IOMMUs, has seen the change in state, i.e. searching +* the IRR at this time could race with IRQ delivery from hardware that +* still sees APICv as being enabled. +* +* FIXME: Ensure other vCPUs and devices observe the change in APICv +* state prior to updating KVM's metadata caches, so that KVM +* can safely search the IRR and set irr_pending accordingly. +*/ + apic->irr_pending = true; + +if (apic->apicv_active) apic->isr_count =1 ; - }else { -/* -* Don't clear irr_pending, searching the IRR can race with -* updates from the CPU as APICv is still active from hardware's -* perspective. The flag will be cleared as appropriate when -* KVM injects the interrupt. -*/ +else apic->isr_count =count_vectors (apic->regs +APIC_ISR ); - } + apic->highest_isr_cache =-1 ; }EXPORT_SYMBOL_GPL (kvm_apic_update_apicv);
arch/x86/kvm/vmx/nested.c +25 -5
@@ -1126,11 +1126,14 @@ static void nested_vmx_transition_tlb_flush(struct kvm_vcpu *vcpu,struct vcpu_vmx *vmx =to_vmx (vcpu);/* -* If vmcs12 doesn't use VPID, L1 expects linear and combined mappings -* for *all* contexts to be flushed on VM-Enter/VM-Exit, i.e. it's a -* full TLB flush from the guest's perspective. This is required even -* if VPID is disabled in the host as KVM may need to synchronize the -* MMU in response to the guest TLB flush. +* If VPID is disabled, then guest TLB accesses use VPID=0, i.e. the +* same VPID as the host, and so architecturally, linear and combined +* mappings for VPID=0 must be flushed at VM-Enter and VM-Exit. KVM +* emulates L2 sharing L1's VPID=0 by using vpid01 while running L2, +* and so KVM must also emulate TLB flush of VPID=0, i.e. vpid01. This +* is required if VPID is disabled in KVM, as a TLB flush (there are no +* VPIDs) still occurs from L1's perspective, and KVM may need to +* synchronize the MMU in response to the guest TLB flush. * * Note, using TLB_FLUSH_GUEST is correct even if nested EPT is in use. * EPT is a special snowflake, as guest-physical mappings aren't
@@ -2196,6 +2199,17 @@ static void prepare_vmcs02_early_rare(struct vcpu_vmx *vmx,vmcs_write64 (VMCS_LINK_POINTER ,INVALID_GPA ); +/* +* If VPID is disabled, then guest TLB accesses use VPID=0, i.e. the +* same VPID as the host. Emulate this behavior by using vpid01 for L2 +* if VPID is disabled in vmcs12. Note, if VPID is disabled, VM-Enter +* and VM-Exit are architecturally required to flush VPID=0, but *only* +* VPID=0. I.e. using vpid02 would be ok (so long as KVM emulates the +* required flushes), but doing so would cause KVM to over-flush. E.g. +* if L1 runs L2 X with VPID12=1, then runs L2 Y with VPID12 disabled, +* and then runs L2 X again, then KVM can and should retain TLB entries +* for VPID12=1. +*/ if (enable_vpid) {if (nested_cpu_has_vpid (vmcs12) && vmx->nested.vpid02)vmcs_write16 (VIRTUAL_PROCESSOR_ID , vmx->nested.vpid02);
@@ -5758,6 +5772,12 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)return nested_vmx_fail (vcpu,VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID ); +/* +* Always flush the effective vpid02, i.e. never flush the current VPID +* and never explicitly flush vpid01. INVVPID targets a VPID, not a +* VMCS, and so whether or not the current vmcs12 has VPID enabled is +* irrelevant (and there may not be a loaded vmcs12). +*/ vpid02 =nested_get_vpid02 (vcpu);switch (type) {case VMX_VPID_EXTENT_INDIVIDUAL_ADDR :
arch/x86/kvm/vmx/vmx.c +4 -2
@@ -209,9 +209,11 @@ module_param(ple_window_shrink, uint, 0444);static unsigned int ple_window_max =KVM_VMX_DEFAULT_PLE_WINDOW_MAX ;module_param (ple_window_max, uint,0444 ); -/* Default is SYSTEM mode, 1 for host-guest mode */ +/* Default is SYSTEM mode, 1 for host-guest mode (which is BROKEN) */ int __read_mostly pt_mode =PT_MODE_SYSTEM ; +#ifdef CONFIG_BROKEN module_param (pt_mode, int,S_IRUGO ); +#endif static DEFINE_STATIC_KEY_FALSE (vmx_l1d_should_flush);static DEFINE_STATIC_KEY_FALSE (vmx_l1d_flush_cond);
@@ -3098,7 +3100,7 @@ static void vmx_flush_tlb_all(struct kvm_vcpu *vcpu)static inline int vmx_get_current_vpid (struct kvm_vcpu *vcpu) { -if (is_guest_mode (vcpu)) +if (is_guest_mode (vcpu) &&nested_cpu_has_vpid (get_vmcs12 (vcpu)))return nested_get_vpid02 (vcpu);return to_vmx (vcpu)->vpid; }
arch/x86/mm/ioremap.c +4 -2
@@ -650,7 +650,8 @@ static bool memremap_is_setup_data(resource_size_t phys_addr, paddr_next = data->next; len = data->len; -if ((phys_addr > paddr) && (phys_addr < (paddr + len))) { +if ((phys_addr > paddr) && + (phys_addr < (paddr +sizeof (struct setup_data ) + len))) {memunmap (data);return true; }
@@ -712,7 +713,8 @@ static bool __init early_memremap_is_setup_data(resource_size_t phys_addr, paddr_next = data->next; len = data->len; -if ((phys_addr > paddr) && (phys_addr < (paddr + len))) { +if ((phys_addr > paddr) && + (phys_addr < (paddr +sizeof (struct setup_data ) + len))) {early_memunmap (data,sizeof (*data));return true; }
drivers/block/null_blk/main.c +29 -16
108 lines not on this page · raw message
drivers/char/xillybus/xillybus_class.c +4 -3
@@ -227,14 +227,15 @@ int xillybus_find_inode(struct inode *inode,break ; } -mutex_unlock (&unit_mutex); - -if (!unit) +if (!unit) { +mutex_unlock (&unit_mutex);return -ENODEV ; + } *private_data = unit->private_data; *index = minor - unit->lowest_minor; +mutex_unlock (&unit_mutex);return 0 ; }EXPORT_SYMBOL (xillybus_find_inode);
drivers/char/xillybus/xillyusb.c +19 -3
@@ -185,6 +185,14 @@ struct xillyusb_dev {struct mutex process_in_mutex;/* synchronize wakeup_all() */ }; +/* +* kref_mutex is used in xillyusb_open() to prevent the xillyusb_dev +* struct from being freed during the gap between being found by +* xillybus_find_inode() and having its reference count incremented. +*/ + +static DEFINE_MUTEX (kref_mutex); +/* FPGA to host opcodes */ enum {OPCODE_DATA =0 ,
@@ -1234,9 +1242,16 @@ static int xillyusb_open(struct inode *inode, struct file *filp)int rc;int index; +mutex_lock (&kref_mutex); + rc =xillybus_find_inode (inode, (void **)&xdev, &index); -if (rc) +if (rc) { +mutex_unlock (&kref_mutex);return rc; + } + +kref_get (&xdev->kref); +mutex_unlock (&kref_mutex); chan = &xdev->channels[index]; filp->private_data = chan;
@@ -1272,8 +1287,6 @@ static int xillyusb_open(struct inode *inode, struct file *filp) ((filp->f_mode & FMODE_WRITE) && chan->open_for_write)) goto unmutex_fail; -kref_get (&xdev->kref); -if (filp->f_mode &FMODE_READ ) chan->open_for_read =1 ;
@@ -1410,6 +1423,7 @@ static int xillyusb_open(struct inode *inode, struct file *filp)return rc; unmutex_fail: +kref_put (&xdev->kref, cleanup_dev);mutex_unlock (&chan->lock);return rc; }
@@ -2244,7 +2258,9 @@ static void xillyusb_disconnect(struct usb_interface *interface) xdev->dev =NULL ; +mutex_lock (&kref_mutex);kref_put (&xdev->kref, cleanup_dev); +mutex_unlock (&kref_mutex); }static struct usb_driver xillyusb_driver = {
drivers/cxl/core/pci.c +1 -1
@@ -377,7 +377,7 @@ static bool __cxl_hdm_decode_init(struct cxl_dev_state *cxlds,if (!allowed && info->mem_enabled) {dev_err (dev,"Range register decodes outside platform defined CXL ranges.\n" ); -return -ENXIO ; +return false; }/*
drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c +6 -0
@@ -247,6 +247,12 @@ static void nbio_v7_7_init_registers(struct amdgpu_device *adev)if (def != data)WREG32_SOC15 (NBIO ,0 , regBIF0_PCIE_MST_CTRL_3, data); +switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +case IP_VERSION (7 ,7 ,0 ): + data =RREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF5_STRAP4) & ~BIT (23 ); +WREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF5_STRAP4, data); +break ; + } } static void nbio_v7_7_update_medium_grain_clock_gating(struct amdgpu_device *adev,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +3 -0
@@ -2498,6 +2498,9 @@ int smu_v13_0_update_pcie_parameters(struct smu_context *smu,uint32_t smu_pcie_arg;int ret, i; +if (!num_of_levels) +return 0 ; +if (!amdgpu_device_pcie_dynamic_switching_supported ()) {if (pcie_table->pcie_gen[num_of_levels -1 ] < pcie_gen_cap) pcie_gen_cap = pcie_table->pcie_gen[num_of_levels -1 ];
drivers/gpu/drm/bridge/tc358768.c +19 -2
@@ -126,6 +126,9 @@#define TC358768_DSI_CONFW_MODE_CLR (6 << 29)#define TC358768_DSI_CONFW_ADDR_DSI_CONTROL (0x3 << 24) +/* TC358768_DSICMD_TX (0x0600) register */ +#define TC358768_DSI_CMDTX_DC_START BIT(0) +static const char *const tc358768_supplies[] = {"vddc" ,"vddmipi" ,"vddio" };
@@ -230,6 +233,21 @@ static void tc358768_update_bits(struct tc358768_priv *priv, u32 reg, u32 mask,tc358768_write (priv, reg, tmp); } +static void tc358768_dsicmd_tx (struct tc358768_priv *priv) +{ +u32 val; + +/* start transfer */ +tc358768_write (priv,TC358768_DSICMD_TX ,TC358768_DSI_CMDTX_DC_START ); +if (priv->error) +return ; + +/* wait transfer completion */ + priv->error =regmap_read_poll_timeout (priv->regmap,TC358768_DSICMD_TX , val, + (val &TC358768_DSI_CMDTX_DC_START ) ==0 , +100 ,100000 ); +} +static int tc358768_sw_reset (struct tc358768_priv *priv) {/* Assert Reset */
@@ -517,8 +535,7 @@ static ssize_t tc358768_dsi_host_transfer(struct mipi_dsi_host *host, } } -/* start transfer */ -tc358768_write (priv,TC358768_DSICMD_TX ,1 ); +tc358768_dsicmd_tx (priv); ret =tc358768_clear_error (priv);if (ret)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4 -4
@@ -1080,10 +1080,10 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane,if (!plane->state->fb)return -EINVAL ; -if (state) - crtc_state =drm_atomic_get_existing_crtc_state (state, - new_plane_state->crtc); -else /* Special case for asynchronous cursor updates. */ + crtc_state =drm_atomic_get_existing_crtc_state (state, new_plane_state->crtc); + +/* Special case for asynchronous cursor updates. */ +if (!crtc_state) crtc_state = plane->crtc->state; return drm_atomic_helper_check_plane_state(plane->state, crtc_state,
drivers/media/dvb-core/dvbdev.c +4 -11
@@ -534,6 +534,9 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,for (minor =0 ; minor <MAX_DVB_MINORS ; minor++)if (dvb_minors[minor] ==NULL )break ; +#else + minor =nums2minor (adap->num, type, id); +#endif if (minor >=MAX_DVB_MINORS ) {if (new_node) {list_del (&new_node->list_head);
@@ -547,17 +550,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,mutex_unlock (&dvbdev_register_lock);return -EINVAL ; } -#else - minor =nums2minor (adap->num, type, id); -if (minor >=MAX_DVB_MINORS ) { -dvb_media_device_free (dvbdev); -list_del (&dvbdev->list_head); -kfree (dvbdev); - *pdvbdev =NULL ; -mutex_unlock (&dvbdev_register_lock); -return ret; - } -#endif + dvbdev->minor = minor; dvb_minors[minor] =dvb_device_get (dvbdev);up_write (&minor_rwsem);
drivers/mmc/host/dw_mmc.c +2 -2
@@ -2952,8 +2952,8 @@ static int dw_mci_init_slot(struct dw_mci *host)if (host->use_dma ==TRANS_MODE_IDMAC ) { mmc->max_segs = host->ring_size; mmc->max_blk_size =65535 ; - mmc->max_req_size =DW_MCI_DESC_DATA_LENGTH * host->ring_size; - mmc->max_seg_size = mmc->max_req_size; + mmc->max_seg_size =0x1000 ; + mmc->max_req_size = mmc->max_seg_size * host->ring_size; mmc->max_blk_count = mmc->max_req_size /512 ; }else if (host->use_dma ==TRANS_MODE_EDMAC ) { mmc->max_segs =64 ;
drivers/mmc/host/sunxi-mmc.c +3 -3
@@ -1191,10 +1191,9 @@ static const struct sunxi_mmc_cfg sun50i_a64_emmc_cfg = { .needs_new_timings = true, }; -static const struct sunxi_mmc_cfg sun50i_a100_cfg = { +static const struct sunxi_mmc_cfg sun50i_h616_cfg = { .idma_des_size_bits =16 , .idma_des_shift =2 , - .clk_delays =NULL , .can_calibrate = true, .mask_data0 = true, .needs_new_timings = true,
@@ -1217,8 +1216,9 @@ static const struct of_device_id sunxi_mmc_of_match[] = { { .compatible = "allwinner,sun20i-d1-mmc", .data = &sun20i_d1_cfg }, { .compatible = "allwinner,sun50i-a64-mmc", .data = &sun50i_a64_cfg }, { .compatible = "allwinner,sun50i-a64-emmc", .data = &sun50i_a64_emmc_cfg }, - { .compatible = "allwinner,sun50i-a100-mmc", .data = &sun50i_a100_cfg }, + { .compatible = "allwinner,sun50i-a100-mmc", .data = &sun20i_d1_cfg }, { .compatible = "allwinner,sun50i-a100-emmc", .data = &sun50i_a100_emmc_cfg }, + { .compatible = "allwinner,sun50i-h616-mmc", .data = &sun50i_h616_cfg }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, sunxi_mmc_of_match);
drivers/net/bonding/bond_main.c +15 -1
@@ -919,6 +919,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,if (bond->dev->flags &IFF_UP )bond_hw_addr_flush (bond->dev, old_active->dev); + +bond_slave_ns_maddrs_add (bond, old_active); }if (new_active) {
@@ -935,6 +937,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,dev_mc_sync (new_active->dev, bond->dev);netif_addr_unlock_bh (bond->dev); } + +bond_slave_ns_maddrs_del (bond, new_active); } }
@@ -2231,6 +2235,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,bond_compute_features (bond);bond_set_carrier (bond); +/* Needs to be called before bond_select_active_slave(), which will +* remove the maddrs if the slave is selected as active slave. +*/ +bond_slave_ns_maddrs_add (bond, new_slave); +if (bond_uses_primary (bond)) {block_netpoll_tx ();bond_select_active_slave (bond);
@@ -2240,7 +2249,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,if (bond_mode_can_use_xmit_hash (bond))bond_update_slave_arr (bond,NULL ); -if (!slave_dev->netdev_ops->ndo_bpf || !slave_dev->netdev_ops->ndo_xdp_xmit) {if (bond->xdp_prog) {
@@ -2436,6 +2444,12 @@ static int __bond_release_one(struct net_device *bond_dev,if (oldcurrent == slave)bond_change_active_slave (bond,NULL ); +/* Must be called after bond_change_active_slave () as the slave +* might change from an active slave to a backup slave. Then it is +* necessary to clear the maddrs on the backup slave. +*/ +bond_slave_ns_maddrs_del (bond, slave); +if (bond_is_lb (bond)) {/* Must be called only after the slave has been * detached from the list and the curr_active_slave
drivers/net/bonding/bond_options.c +81 -1
116 lines not on this page · raw message
drivers/net/ethernet/freescale/fec_main.c +0 -26
@@ -3508,29 +3508,6 @@ fec_set_mac_address(struct net_device *ndev, void *p)return 0 ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -/** -* fec_poll_controller - FEC Poll controller function -* @dev: The FEC network adapter -* -* Polled functionality used by netconsole and others in non interrupt mode -* -*/ -static void fec_poll_controller (struct net_device *dev) -{ -int i; -struct fec_enet_private *fep =netdev_priv (dev); - -for (i =0 ; i <FEC_IRQ_NUM ; i++) { -if (fep->irq[i] >0 ) { -disable_irq (fep->irq[i]); -fec_enet_interrupt (fep->irq[i], dev); -enable_irq (fep->irq[i]); - } - } -} -#endif -static inline void fec_enet_set_netdev_features (struct net_device *netdev,netdev_features_t features) {
@@ -3604,9 +3581,6 @@ static const struct net_device_ops fec_netdev_ops = { .ndo_tx_timeout = fec_timeout, .ndo_set_mac_address = fec_set_mac_address, .ndo_eth_ioctl = fec_enet_ioctl, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = fec_poll_controller, -#endif .ndo_set_features = fec_set_features, };
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +1 -1
@@ -862,7 +862,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,return 0 ; err_rule: -mlx5_tc_ct_entry_destroy_mod_hdr (ct_priv, zone_rule->attr, zone_rule->mh); +mlx5_tc_ct_entry_destroy_mod_hdr (ct_priv, attr, zone_rule->mh);mlx5_put_label_mapping (ct_priv, attr->ct_attr.ct_labels_id); err_mod_hdr:kfree (attr);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +4 -4
@@ -665,7 +665,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,while (remaining >0 ) {skb_frag_t *frag = &record->frags[i]; -get_page (skb_frag_page (frag)); +page_ref_inc (skb_frag_page (frag)); remaining -=skb_frag_size (frag); info->frags[i++] = *frag; }
@@ -768,7 +768,7 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, stats = sq->stats;mlx5e_tx_dma_unmap (sq->pdev, dma); -put_page (wi->resync_dump_frag_page); +page_ref_dec (wi->resync_dump_frag_page); stats->tls_dump_packets++; stats->tls_dump_bytes += wi->num_bytes; }
@@ -821,12 +821,12 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, err_out:for (; i < info.nr_frags; i++) -/* The put_page() here undoes the page ref obtained in tx_sync_info_get(). +/* The page_ref_dec() here undoes the page ref obtained in tx_sync_info_get(). * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be * released only upon their completions (or in mlx5e_free_txqsq_descs, * if channel closes). */ -put_page (skb_frag_page (&info.frags[i])); +page_ref_dec (skb_frag_page (&info.frags[i]));return MLX5E_KTLS_SYNC_FAIL ; }
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +12 -3
@@ -1880,13 +1880,22 @@ lookup_fte_locked(struct mlx5_flow_group *g, fte_tmp =NULL ; goto out; } + +nested_down_write_ref_node (&fte_tmp->node,FS_LOCK_CHILD ); +if (!fte_tmp->node.active) { +up_write_ref_node (&fte_tmp->node, false); + +if (take_write) +up_write_ref_node (&g->node, false); +else +up_read_ref_node (&g->node); +tree_put_node (&fte_tmp->node, false); - fte_tmp =NULL ; - goto out; + +return NULL ; } -nested_down_write_ref_node (&fte_tmp->node,FS_LOCK_CHILD ); out:if (take_write)up_write_ref_node (&g->node, false);
drivers/net/ethernet/vertexcom/mse102x.c +3 -1
@@ -437,13 +437,15 @@ static void mse102x_tx_work(struct work_struct *work) mse = &mses->mse102x;while ((txb =skb_dequeue (&mse->txq))) { + unsigned int len = max_t(unsigned int, txb->len, ETH_ZLEN); +mutex_lock (&mses->lock); ret =mse102x_tx_pkt_spi (mse, txb, work_timeout);mutex_unlock (&mses->lock);if (ret) { mse->ndev->stats.tx_dropped++; }else { - mse->ndev->stats.tx_bytes += txb->len; + mse->ndev->stats.tx_bytes += len; mse->ndev->stats.tx_packets++; }
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +6 -19
@@ -115,11 +115,6 @@ struct vchiq_arm_state {int first_connect; }; -struct vchiq_2835_state { -int inited; -struct vchiq_arm_state arm_state; -}; -struct vchiq_pagelist_info {struct pagelist *pagelist;size_t pagelist_buffer_size;
@@ -574,29 +569,21 @@ vchiq_arm_init_state(struct vchiq_state *state,int vchiq_platform_init_state (struct vchiq_state *state) { -struct vchiq_2835_state *platform_state; +struct vchiq_arm_state *platform_state; - state->platform_state =kzalloc (sizeof (*platform_state),GFP_KERNEL ); -if (!state->platform_state) + platform_state =devm_kzalloc (state->dev,sizeof (*platform_state),GFP_KERNEL ); +if (!platform_state)return -ENOMEM ; - platform_state = (struct vchiq_2835_state *)state->platform_state; - - platform_state->inited =1 ; -vchiq_arm_init_state (state, &platform_state->arm_state); +vchiq_arm_init_state (state, platform_state); + state->platform_state = (struct opaque_platform_state *)platform_state;return 0 ; }static struct vchiq_arm_state *vchiq_platform_get_arm_state (struct vchiq_state *state) { -struct vchiq_2835_state *platform_state; - - platform_state = (struct vchiq_2835_state *)state->platform_state; - -WARN_ON_ONCE (!platform_state->inited); - -return &platform_state->arm_state; +return (struct vchiq_arm_state *)state->platform_state; }void
drivers/vdpa/mlx5/core/mr.c +5 -3
@@ -232,7 +232,7 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mrstruct page *pg;unsigned int nsg;int sglen; -u64 pa; +u64 pa, offset;u64 paend;struct scatterlist *sg;struct device *dma = mvdev->vdev.dma_dev;
@@ -255,8 +255,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr sg = mr->sg_head.sgl;for (map =vhost_iotlb_itree_first (iotlb, mr->start, mr->end -1 ); map; map =vhost_iotlb_itree_next (map, mr->start, mr->end -1 )) { - paend = map->addr +maplen (map, mr); -for (pa = map->addr; pa < paend; pa += sglen) { + offset = mr->start > map->start ? mr->start - map->start :0 ; + pa = map->addr + offset; + paend = map->addr + offset +maplen (map, mr); +for (; pa < paend; pa += sglen) { pg =pfn_to_page (__phys_to_pfn (pa));if (!sg) { mlx5_vdpa_warn(mvdev, "sg null. start 0x%llx, end 0x%llx\n",
drivers/vdpa/virtio_pci/vp_vdpa.c +7 -3
@@ -591,7 +591,11 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto mdev_err; } - mdev_id =kzalloc (sizeof (struct virtio_device_id ),GFP_KERNEL ); +/* +* id_table should be a null terminated array, so allocate one additional +* entry here, see vdpa_mgmtdev_get_classes(). +*/ + mdev_id =kcalloc (2 ,sizeof (struct virtio_device_id ),GFP_KERNEL );if (!mdev_id) { err = -ENOMEM ; goto mdev_id_err;
@@ -611,8 +615,8 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto probe_err; } - mdev_id->device = mdev->id.device; - mdev_id->vendor = mdev->id.vendor; + mdev_id[0 ].device = mdev->id.device; + mdev_id[0 ].vendor = mdev->id.vendor; mgtdev->id_table = mdev_id; mgtdev->max_supported_vqs =vp_modern_get_num_queues (mdev); mgtdev->supported_features =vp_modern_get_features (mdev);
fs/9p/vfs_inode.c +13 -10
@@ -392,17 +392,20 @@ void v9fs_evict_inode(struct inode *inode)struct v9fs_inode *v9inode =V9FS_I (inode);__le32 version; -truncate_inode_pages_final (&inode->i_data); - version =cpu_to_le32 (v9inode->qid.version); -fscache_clear_inode_writeback (v9fs_inode_cookie (v9inode), inode, +if (!is_bad_inode (inode)) { +truncate_inode_pages_final (&inode->i_data); + version =cpu_to_le32 (v9inode->qid.version); +fscache_clear_inode_writeback (v9fs_inode_cookie (v9inode), inode, &version); -clear_inode (inode); -filemap_fdatawrite (&inode->i_data); - -fscache_relinquish_cookie (v9fs_inode_cookie (v9inode), false); -/* clunk the fid stashed in writeback_fid */ -p9_fid_put (v9inode->writeback_fid); - v9inode->writeback_fid =NULL ; +clear_inode (inode); +filemap_fdatawrite (&inode->i_data); +if (v9fs_inode_cookie (v9inode)) +fscache_relinquish_cookie (v9fs_inode_cookie (v9inode), false); +/* clunk the fid stashed in writeback_fid */ +p9_fid_put (v9inode->writeback_fid); + v9inode->writeback_fid =NULL ; + }else +clear_inode (inode); }static int v9fs_test_inode (struct inode *inode,void *data)
fs/nfsd/netns.h +1 -0
@@ -152,6 +152,7 @@ struct nfsd_net {u32 s2s_cp_cl_id;struct idr s2s_cp_stateids;spinlock_t s2s_cp_lock; +atomic_t pending_async_copies;/* * Version information
fs/nfsd/nfs4proc.c +16 -18
@@ -717,15 +717,6 @@ nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, &access->ac_supported); } -static void gen_boot_verifier (nfs4_verifier *verifier,struct net *net) -{ -__be32 *verf = (__be32 *)verifier->data; - -BUILD_BUG_ON (2 *sizeof (*verf) !=sizeof (verifier->data)); - -nfsd_copy_write_verifier (verf,net_generic (net, nfsd_net_id)); -} -static __be32 nfsd4_commit (struct svc_rqst *rqstp,struct nfsd4_compound_state *cstate,union nfsd4_op_u *u)
@@ -1252,6 +1243,7 @@ static void nfs4_put_copy(struct nfsd4_copy *copy) {if (!refcount_dec_and_test (©->refcount))return ; +atomic_dec (©->cp_nn->pending_async_copies);kfree (copy->cp_src);kfree (copy); }
@@ -1593,7 +1585,6 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)test_bit (NFSD4_COPY_F_COMMITTED , ©->cp_flags) ?NFS_FILE_SYNC :NFS_UNSTABLE ;nfsd4_copy_set_sync (copy, sync); -gen_boot_verifier (©->cp_res.wr_verifier, copy->cp_clp->net); } static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
@@ -1764,10 +1755,16 @@ static __be32 nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, union nfsd4_op_u *u) { + struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); +struct nfsd4_copy *async_copy =NULL ;struct nfsd4_copy *copy = &u->copy; +struct nfsd42_write_res *result;__be32 status; -struct nfsd4_copy *async_copy =NULL ; + result = ©->cp_res; +nfsd_copy_write_verifier ((__be32 *)&result->wr_verifier.data, nn); + + copy->cp_clp = cstate->clp;if (nfsd4_ssc_is_inter (copy)) {if (!inter_copy_offload_enable ||nfsd4_copy_is_sync (copy)) { status = nfserr_notsupp;
@@ -1782,25 +1779,26 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,return status; } - copy->cp_clp = cstate->clp;memcpy (©->fh, &cstate->current_fh.fh_handle,sizeof (struct knfsd_fh ));if (nfsd4_copy_is_async (copy)) { -struct nfsd_net *nn =net_generic (SVC_NET (rqstp), nfsd_net_id); - - status =nfserrno (-ENOMEM ); async_copy =kzalloc (sizeof (struct nfsd4_copy ),GFP_KERNEL );if (!async_copy) goto out_err; + async_copy->cp_nn = nn;INIT_LIST_HEAD (&async_copy->copies);refcount_set (&async_copy->refcount,1 ); +/* Arbitrary cap on number of pending async copy operations */ +if (atomic_inc_return (&nn->pending_async_copies) > + (int )rqstp->rq_pool->sp_nrthreads) + goto out_err; async_copy->cp_src =kmalloc (sizeof (*async_copy->cp_src),GFP_KERNEL );if (!async_copy->cp_src) goto out_err;if (!nfs4_init_copy_state (nn, copy)) goto out_err; -memcpy (©->cp_res.cb_stateid, ©->cp_stateid.cs_stid, -sizeof (copy->cp_res.cb_stateid)); +memcpy (&result->cb_stateid, ©->cp_stateid.cs_stid, +sizeof (result->cb_stateid));dup_copy_fields (copy, async_copy); async_copy->copy_task =kthread_create (nfsd4_do_async_copy, async_copy,"%s" ,"copy thread" );
@@ -1830,7 +1828,7 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, }if (async_copy)cleanup_async_copy (async_copy); - status =nfserrno (-ENOMEM ); + status = nfserr_jukebox; goto out; }
fs/nfsd/nfs4state.c +1 -0
@@ -8076,6 +8076,7 @@ static int nfs4_state_create_net(struct net *net)spin_lock_init (&nn->client_lock);spin_lock_init (&nn->s2s_cp_lock);idr_init (&nn->s2s_cp_stateids); +atomic_set (&nn->pending_async_copies,0 );spin_lock_init (&nn->blocked_locks_lock);INIT_LIST_HEAD (&nn->blocked_locks_lru);
fs/nfsd/xdr4.h +1 -0
@@ -574,6 +574,7 @@ struct nfsd4_copy {struct nfsd4_ssc_umount_item *ss_nsui;struct nfs_fh c_fh;nfs4_stateid stateid; +struct nfsd_net *cp_nn; };static inline void nfsd4_copy_set_sync (struct nfsd4_copy *copy,bool sync)
fs/nilfs2/btnode.c +0 -2
@@ -68,7 +68,6 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr) goto failed; }memset (bh->b_data,0 ,i_blocksize (inode)); - bh->b_bdev = inode->i_sb->s_bdev; bh->b_blocknr = blocknr;set_buffer_mapped (bh);set_buffer_uptodate (bh);
@@ -133,7 +132,6 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr, goto found; }set_buffer_mapped (bh); - bh->b_bdev = inode->i_sb->s_bdev; bh->b_blocknr = pblocknr;/* set block address for read */ bh->b_end_io = end_buffer_read_sync;get_bh (bh);
fs/nilfs2/gcinode.c +1 -3
@@ -83,10 +83,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff, goto out; } -if (!buffer_mapped (bh)) { - bh->b_bdev = inode->i_sb->s_bdev; +if (!buffer_mapped (bh))set_buffer_mapped (bh); - } bh->b_blocknr = pbn; bh->b_end_io = end_buffer_read_sync;get_bh (bh);
fs/nilfs2/mdt.c +0 -1
@@ -89,7 +89,6 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,if (buffer_uptodate (bh)) goto failed_bh; - bh->b_bdev = sb->s_bdev; err =nilfs_mdt_insert_new_block (inode, block, bh, init_block);if (likely (!err)) {get_bh (bh);
fs/nilfs2/page.c +1 -1
@@ -39,7 +39,6 @@ __nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index, first_block = (unsigned long )index << (PAGE_SHIFT - blkbits); bh =nilfs_page_get_nth_block (page, block - first_block); -touch_buffer (bh);wait_on_buffer (bh);return bh; }
@@ -64,6 +63,7 @@ struct buffer_head *nilfs_grab_buffer(struct inode *inode,put_page (page);return NULL ; } + bh->b_bdev = inode->i_sb->s_bdev;return bh; }
fs/ntfs3/file.c +10 -2
@@ -1214,8 +1214,16 @@ static int ntfs_file_release(struct inode *inode, struct file *file)int err =0 ;/* If we are last writer on the inode, drop the block reservation. */ -if (sbi->options->prealloc && ((file->f_mode &FMODE_WRITE ) && -atomic_read (&inode->i_writecount) ==1 )) { +if (sbi->options->prealloc && + ((file->f_mode &FMODE_WRITE ) && +atomic_read (&inode->i_writecount) ==1 ) +/* +* The only file when inode->i_fop = &ntfs_file_operations and +* init_rwsem(&ni->file.run_lock) is not called explicitly is MFT. +* +* Add additional check here. +*/ + && inode->i_ino !=MFT_REC_MFT ) {ni_lock (ni);down_write (&ni->file.run_lock);
fs/ocfs2/resize.c +2 -0
@@ -566,6 +566,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)ocfs2_commit_trans (osb, handle); out_free_group_bh: +if (ret <0 ) +ocfs2_remove_from_cache (INODE_CACHE (inode), group_bh);brelse (group_bh); out_unlock:
fs/ocfs2/super.c +9 -4
@@ -2321,6 +2321,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di, struct ocfs2_blockcheck_stats *stats) {int status = -EAGAIN ; +u32 blksz_bits;if (memcmp (di->i_signature,OCFS2_SUPER_BLOCK_SIGNATURE ,strlen (OCFS2_SUPER_BLOCK_SIGNATURE )) ==0 ) {
@@ -2335,11 +2336,15 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di, goto out; } status = -EINVAL ; -if ((1 <<le32_to_cpu (di->id2.i_super.s_blocksize_bits)) != blksz) { +/* Acceptable block sizes are 512 bytes, 1K, 2K and 4K. */ + blksz_bits =le32_to_cpu (di->id2.i_super.s_blocksize_bits); +if (blksz_bits <9 || blksz_bits >12 ) {mlog (ML_ERROR ,"found superblock with incorrect block " -"size: found %u, should be %u\n" , -1 <<le32_to_cpu (di->id2.i_super.s_blocksize_bits), - blksz); +"size bits: found %u, should be 9, 10, 11, or 12\n" , + blksz_bits); + }else if ((1 <<le32_to_cpu (blksz_bits)) != blksz) { +mlog (ML_ERROR ,"found superblock with incorrect block " +"size: found %u, should be %u\n" ,1 << blksz_bits, blksz); }else if (le16_to_cpu (di->id2.i_super.s_major_rev_level) !=OCFS2_MAJOR_REV_LEVEL || le16_to_cpu(di->id2.i_super.s_minor_rev_level) !=
fs/smb/server/smb2misc.c +19 -7
@@ -101,13 +101,17 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len, *len =le16_to_cpu (((struct smb2_sess_setup_req *)hdr)->SecurityBufferLength);break ;case SMB2_TREE_CONNECT : - *off =le16_to_cpu (((struct smb2_tree_connect_req *)hdr)->PathOffset); + *off = max_t(unsigned short int, +le16_to_cpu (((struct smb2_tree_connect_req *)hdr)->PathOffset), + offsetof(struct smb2_tree_connect_req , Buffer)); *len =le16_to_cpu (((struct smb2_tree_connect_req *)hdr)->PathLength);break ;case SMB2_CREATE : {unsigned short int name_off = -le16_to_cpu (((struct smb2_create_req *)hdr)->NameOffset); + max_t(unsigned short int, +le16_to_cpu (((struct smb2_create_req *)hdr)->NameOffset), + offsetof(struct smb2_create_req , Buffer));unsigned short int name_len =le16_to_cpu (((struct smb2_create_req *)hdr)->NameLength);
@@ -128,11 +132,15 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,break ; }case SMB2_QUERY_INFO : - *off =le16_to_cpu (((struct smb2_query_info_req *)hdr)->InputBufferOffset); + *off = max_t(unsigned int, +le16_to_cpu (((struct smb2_query_info_req *)hdr)->InputBufferOffset), + offsetof(struct smb2_query_info_req , Buffer)); *len =le32_to_cpu (((struct smb2_query_info_req *)hdr)->InputBufferLength);break ;case SMB2_SET_INFO : - *off =le16_to_cpu (((struct smb2_set_info_req *)hdr)->BufferOffset); + *off = max_t(unsigned int, +le16_to_cpu (((struct smb2_set_info_req *)hdr)->BufferOffset), + offsetof(struct smb2_set_info_req , Buffer)); *len =le32_to_cpu (((struct smb2_set_info_req *)hdr)->BufferLength);break ;case SMB2_READ :
@@ -142,7 +150,7 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,case SMB2_WRITE :if (((struct smb2_write_req *)hdr)->DataOffset || ((struct smb2_write_req *)hdr)->Length) { - *off = max_t(unsigned int, + *off = max_t(unsigned short int,le16_to_cpu (((struct smb2_write_req *)hdr)->DataOffset), offsetof(struct smb2_write_req , Buffer)); *len =le32_to_cpu (((struct smb2_write_req *)hdr)->Length);
@@ -153,7 +161,9 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len, *len =le16_to_cpu (((struct smb2_write_req *)hdr)->WriteChannelInfoLength);break ;case SMB2_QUERY_DIRECTORY : - *off =le16_to_cpu (((struct smb2_query_directory_req *)hdr)->FileNameOffset); + *off = max_t(unsigned short int, +le16_to_cpu (((struct smb2_query_directory_req *)hdr)->FileNameOffset), + offsetof(struct smb2_query_directory_req , Buffer)); *len =le16_to_cpu (((struct smb2_query_directory_req *)hdr)->FileNameLength);break ;case SMB2_LOCK :
@@ -168,7 +178,9 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,break ; }case SMB2_IOCTL : - *off =le32_to_cpu (((struct smb2_ioctl_req *)hdr)->InputOffset); + *off = max_t(unsigned int, +le32_to_cpu (((struct smb2_ioctl_req *)hdr)->InputOffset), + offsetof(struct smb2_ioctl_req , Buffer)); *len =le32_to_cpu (((struct smb2_ioctl_req *)hdr)->InputCount);break ;default :
fs/smb/server/smb2pdu.c +26 -22
192 lines not on this page · raw message
include/linux/mman.h +4 -3
@@ -2,6 +2,7 @@#ifndef _LINUX_MMAN_H#define _LINUX_MMAN_H +#include <linux/fs.h> #include <linux/mm.h> #include <linux/percpu_counter.h>
@@ -90,7 +91,7 @@ static inline void vm_unacct_memory(long pages)#endif #ifndef arch_calc_vm_flag_bits -#define arch_calc_vm_flag_bits (flags) 0 +#define arch_calc_vm_flag_bits (file, flags) 0#endif #ifndef arch_validate_prot
@@ -147,12 +148,12 @@ calc_vm_prot_bits(unsigned long prot, unsigned long pkey)* Combine the mmap "flags" argument into "vm_flags" used internally. */ static inline unsigned long -calc_vm_flag_bits (unsigned long flags) +calc_vm_flag_bits (struct file *file,unsigned long flags) {return _calc_vm_trans (flags,MAP_GROWSDOWN ,VM_GROWSDOWN ) |_calc_vm_trans (flags,MAP_LOCKED ,VM_LOCKED ) |_calc_vm_trans (flags,MAP_SYNC ,VM_SYNC ) | -arch_calc_vm_flag_bits (flags); +arch_calc_vm_flag_bits (file, flags); }unsigned long vm_commit_limit (void );
include/linux/sockptr.h +27 -0
@@ -50,11 +50,38 @@ static inline int copy_from_sockptr_offset(void *dst, sockptr_t src,return 0 ; } +/* Deprecated. +* This is unsafe, unless caller checked user provided optlen. +* Prefer copy_safe_from_sockptr() instead. +*/ static inline int copy_from_sockptr (void *dst,sockptr_t src,size_t size) {return copy_from_sockptr_offset (dst, src,0 , size); } +/** +* copy_safe_from_sockptr: copy a struct from sockptr +* @dst: Destination address, in kernel space. This buffer must be @ksize +* bytes long. +* @ksize: Size of @dst struct. +* @optval: Source address. (in user or kernel space) +* @optlen: Size of @optval data. +* +* Returns: +* * -EINVAL: @optlen < @ksize +* * -EFAULT: access to userspace failed. +* * 0 : @ksize bytes were copied +*/ +static inline int copy_safe_from_sockptr (void *dst,size_t ksize, +sockptr_t optval,unsigned int optlen) +{ +if (optlen < ksize) +return -EINVAL ; +if (copy_from_sockptr (dst, optval, ksize)) +return -EFAULT ; +return 0 ; +} +static inline int copy_to_sockptr_offset (sockptr_t dst,size_t offset,const void *src,size_t size) {
include/net/bond_options.h +2 -0
@@ -160,5 +160,7 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond);#if IS_ENABLED (CONFIG_IPV6 )void bond_option_ns_ip6_targets_clear (struct bonding *bond);#endif +void bond_slave_ns_maddrs_add (struct bonding *bond,struct slave *slave); +void bond_slave_ns_maddrs_del (struct bonding *bond,struct slave *slave);#endif /* _NET_BOND_OPTIONS_H */
lib/buildid.c +1 -1
@@ -40,7 +40,7 @@ static int parse_build_id_buf(unsigned char *build_id, name_sz == note_name_sz && memcmp(nhdr + 1, note_name, note_name_sz) == 0 && desc_sz > 0 && desc_sz <= BUILD_ID_SIZE_MAX) { - data = note_start + note_off +ALIGN (note_name_sz,4 ); + data = note_start + note_off +sizeof (Elf32_Nhdr) +ALIGN (note_name_sz,4 );memcpy (build_id, data, desc_sz);memset (build_id + desc_sz,0 ,BUILD_ID_SIZE_MAX - desc_sz);if (size)
mm/internal.h +19 -0
@@ -52,6 +52,25 @@ struct folio_batch;void page_writeback_init (void ); +/* +* This is a file-backed mapping, and is about to be memory mapped - invoke its +* mmap hook and safely handle error conditions. On error, VMA hooks will be +* mutated. +* +* @file: File which backs the mapping. +* @vma: VMA which we are mapping. +* +* Returns: 0 if success, error otherwise. +*/ +int mmap_file (struct file *file,struct vm_area_struct *vma); + +/* +* If the VMA has a close hook then close it, and since closing it might leave +* it in an inconsistent state which makes the use of any hooks suspect, clear +* them down by installing dummy empty hooks. +*/ +void vma_close (struct vm_area_struct *vma); +static inline void *folio_raw_mapping (struct folio *folio) {unsigned long mapping = (unsigned long )folio->mapping;
mm/mmap.c +63 -57
208 lines not on this page · raw message
mm/nommu.c +4 -5
@@ -650,8 +650,7 @@ static int delete_vma_from_mm(struct vm_area_struct *vma)*/ static void delete_vma (struct mm_struct *mm,struct vm_area_struct *vma) { -if (vma->vm_ops && vma->vm_ops->close) - vma->vm_ops->close (vma); +vma_close (vma);if (vma->vm_file)fput (vma->vm_file);put_nommu_region (vma->vm_region);
@@ -904,7 +903,7 @@ static unsigned long determine_vm_flags(struct file *file, {unsigned long vm_flags; - vm_flags =calc_vm_prot_bits (prot,0 ) |calc_vm_flag_bits (flags); + vm_flags =calc_vm_prot_bits (prot,0 ) |calc_vm_flag_bits (file, flags);/* vm_flags |= mm->def_flags; */ if (!(capabilities &NOMMU_MAP_DIRECT )) {
@@ -939,7 +938,7 @@ static int do_mmap_shared_file(struct vm_area_struct *vma) {int ret; - ret =call_mmap (vma->vm_file, vma); + ret =mmap_file (vma->vm_file, vma);if (ret ==0 ) { vma->vm_region->vm_top = vma->vm_region->vm_end;return 0 ;
@@ -970,7 +969,7 @@ static int do_mmap_private(struct vm_area_struct *vma,* - VM_MAYSHARE will be set if it may attempt to share */ if (capabilities &NOMMU_MAP_DIRECT ) { - ret =call_mmap (vma->vm_file, vma); + ret =mmap_file (vma->vm_file, vma);if (ret ==0 ) {/* shouldn't return success if we're not sharing */ BUG_ON (!(vma->vm_flags &VM_MAYSHARE ));
mm/page_alloc.c +2 -1
@@ -5457,7 +5457,8 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, gfp = alloc_gfp;/* Find an allowed local zone that meets the low watermark. */ -for_each_zone_zonelist_nodemask (zone, z, ac.zonelist, ac.highest_zoneidx, ac.nodemask) { + z = ac.preferred_zoneref; + for_next_zone_zonelist_nodemask(zone, z, ac.highest_zoneidx, ac.nodemask) {unsigned long mark; if (cpusets_enabled() && (alloc_flags & ALLOC_CPUSET) &&
mm/shmem.c +0 -5
@@ -1086,9 +1086,7 @@ static int shmem_getattr(struct user_namespace *mnt_userns, stat->attributes_mask |= (STATX_ATTR_APPEND |STATX_ATTR_IMMUTABLE |STATX_ATTR_NODUMP ); -inode_lock_shared (inode);generic_fillattr (&init_user_ns, inode, stat); -inode_unlock_shared (inode);if (shmem_is_huge (NULL , inode,0 , false)) stat->blksize =HPAGE_PMD_SIZE ;
@@ -2308,9 +2306,6 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma)if (ret)return ret; -/* arm64 - allow memory tagging on RAM-based files */ - vma->vm_flags |=VM_MTE_ALLOWED ; -file_accessed (file); vma->vm_ops = &shmem_vm_ops;return 0 ;
mm/util.c +33 -0
@@ -1103,6 +1103,39 @@ int __weak memcmp_pages(struct page *page1, struct page *page2)return ret; } +int mmap_file (struct file *file,struct vm_area_struct *vma) +{ +static const struct vm_operations_struct dummy_vm_ops = {}; +int err =call_mmap (file, vma); + +if (likely (!err)) +return 0 ; + +/* +* OK, we tried to call the file hook for mmap(), but an error +* arose. The mapping is in an inconsistent state and we most not invoke +* any further hooks on it. +*/ + vma->vm_ops = &dummy_vm_ops; + +return err; +} + +void vma_close (struct vm_area_struct *vma) +{ +static const struct vm_operations_struct dummy_vm_ops = {}; + +if (vma->vm_ops && vma->vm_ops->close) { + vma->vm_ops->close (vma); + +/* +* The mapping is in an inconsistent state, and no further hooks +* may be invoked upon it. +*/ + vma->vm_ops = &dummy_vm_ops; + } +} +#ifdef CONFIG_PRINTK /** * mem_dump_obj - Print available provenance information
net/bluetooth/hci_core.c +0 -2
@@ -3846,8 +3846,6 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)hci_dev_lock (hdev); conn =hci_conn_hash_lookup_handle (hdev, handle); -if (conn &&hci_dev_test_flag (hdev,HCI_MGMT )) -mgmt_device_connected (hdev, conn,NULL ,0 );hci_dev_unlock (hdev);if (conn) {
net/bluetooth/hci_event.c +0 -163
175 lines not on this page · raw message
net/bluetooth/iso.c +10 -22
@@ -1189,7 +1189,7 @@ static int iso_sock_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, unsigned int optlen) {struct sock *sk = sock->sk; -int len, err =0 ; +int err =0 ;struct bt_iso_qos qos;u32 opt;
@@ -1204,10 +1204,9 @@ static int iso_sock_setsockopt(struct socket *sock, int level, int optname,break ; } -if (copy_from_sockptr (&opt, optval,sizeof (u32))) { - err = -EFAULT ; + err =bt_copy_from_sockptr (&opt,sizeof (opt), optval, optlen); +if (err)break ; - }if (opt)set_bit (BT_SK_DEFER_SETUP , &bt_sk (sk)->flags);
@@ -1222,18 +1221,9 @@ static int iso_sock_setsockopt(struct socket *sock, int level, int optname,break ; } - len = min_t(unsigned int, sizeof(qos), optlen); -if (len !=sizeof (qos)) { - err = -EINVAL ; -break ; - } - -memset (&qos,0 ,sizeof (qos)); - -if (copy_from_sockptr (&qos, optval, len)) { - err = -EFAULT ; + err =bt_copy_from_sockptr (&qos,sizeof (qos), optval, optlen); +if (err)break ; - }if (!check_qos (&qos)) { err = -EINVAL ;
@@ -1252,18 +1242,16 @@ static int iso_sock_setsockopt(struct socket *sock, int level, int optname, }if (optlen >sizeof (iso_pi (sk)->base)) { - err = -EOVERFLOW ; + err = -EINVAL ;break ; } - len = min_t(unsigned int, sizeof(iso_pi(sk)->base), optlen); - -if (copy_from_sockptr (iso_pi (sk)->base, optval, len)) { - err = -EFAULT ; + err =bt_copy_from_sockptr (iso_pi (sk)->base, optlen, optval, + optlen); +if (err)break ; - } -iso_pi (sk)->base_len = len; +iso_pi (sk)->base_len = optlen;break ;
net/mptcp/pm_netlink.c +7 -8
@@ -525,15 +525,13 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) }static struct mptcp_pm_addr_entry * -__lookup_addr (struct pm_nl_pernet *pernet,const struct mptcp_addr_info *info, -bool lookup_by_id) +__lookup_addr (struct pm_nl_pernet *pernet,const struct mptcp_addr_info *info) {struct mptcp_pm_addr_entry *entry; -list_for_each_entry (entry, &pernet->local_addr_list, list) { -if ((!lookup_by_id && -mptcp_addresses_equal (&entry->addr, info, entry->addr.port)) || - (lookup_by_id && entry->addr.id == info->id)) +list_for_each_entry_rcu (entry, &pernet->local_addr_list, list, +lockdep_is_held (&pernet->lock)) { +if (mptcp_addresses_equal (&entry->addr, info, entry->addr.port))return entry; }return NULL ;
@@ -564,7 +562,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)mptcp_local_address ((struct sock_common *)msk->first, &mpc_addr);rcu_read_lock (); - entry =__lookup_addr (pernet, &mpc_addr, false); + entry =__lookup_addr (pernet, &mpc_addr);if (entry) {__clear_bit (entry->addr.id, msk->pm.id_avail_bitmap); msk->mpc_endpoint_id = entry->addr.id;
@@ -2081,7 +2079,8 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) token, &addr, &remote, bkup);spin_lock_bh (&pernet->lock); - entry =__lookup_addr (pernet, &addr.addr, lookup_by_id); + entry = lookup_by_id ?__lookup_addr_by_id (pernet, addr.addr.id) : +__lookup_addr (pernet, &addr.addr);if (!entry) {spin_unlock_bh (&pernet->lock);return -EINVAL ;
net/mptcp/pm_userspace.c +51 -26
179 lines not on this page · raw message
net/mptcp/protocol.c +11 -5
@@ -2057,7 +2057,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) slow =lock_sock_fast (ssk);WRITE_ONCE (ssk->sk_rcvbuf, rcvbuf);tcp_sk (ssk)->window_clamp = window_clamp; -tcp_cleanup_rbuf (ssk,1 ); +if (tcp_can_send_ack (ssk)) +tcp_cleanup_rbuf (ssk,1 );unlock_sock_fast (ssk, slow); } }
@@ -2180,7 +2181,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, cmsg_flags =MPTCP_CMSG_INQ ;while (copied < len) { -int bytes_read; +int err, bytes_read; bytes_read =__mptcp_recvmsg_mskq (msk, msg, len - copied, flags, &tss, &cmsg_flags);if (unlikely (bytes_read <0 )) {
@@ -2245,9 +2246,16 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, }pr_debug ("block timeout %ld\n" , timeo); -sk_wait_data (sk, &timeo,NULL ); +mptcp_rcv_space_adjust (msk, copied); + err =sk_wait_data (sk, &timeo,NULL ); +if (err <0 ) { + err = copied ? : err; + goto out_err; + } } +mptcp_rcv_space_adjust (msk, copied); + out_err:if (cmsg_flags && copied >=0 ) {if (cmsg_flags &MPTCP_CMSG_TS )
@@ -2263,8 +2271,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,pr_debug ("msk=%p rx queue empty=%d:%d copied=%d\n" , msk,skb_queue_empty_lockless (&sk->sk_receive_queue),skb_queue_empty (&msk->receive_queue), copied); -if (!(flags &MSG_PEEK )) -mptcp_rcv_space_adjust (msk, copied);release_sock (sk);return copied;
net/netfilter/ipvs/ip_vs_ctl.c +5 -5
@@ -1382,18 +1382,18 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, sched =NULL ; } -/* Bind the ct retriever */ -RCU_INIT_POINTER (svc->pe, pe); - pe =NULL ; -/* Update the virtual service counters */ if (svc->port ==FTPPORT )atomic_inc (&ipvs->ftpsvc_counter);else if (svc->port ==0 )atomic_inc (&ipvs->nullsvc_counter); -if (svc->pe && svc->pe->conn_out) +if (pe && pe->conn_out)atomic_inc (&ipvs->conn_out_counter); +/* Bind the ct retriever */ +RCU_INIT_POINTER (svc->pe, pe); + pe =NULL ; +ip_vs_start_estimator (ipvs, &svc->stats);/* Count only IPv4 services for old get/setsockopt interface */
net/netlink/af_netlink.c +8 -23
@@ -393,15 +393,6 @@ static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)static void netlink_sock_destruct (struct sock *sk) { -struct netlink_sock *nlk =nlk_sk (sk); - -if (nlk->cb_running) { -if (nlk->cb.done) - nlk->cb.done (&nlk->cb); -module_put (nlk->cb.module); -kfree_skb (nlk->cb.skb); - } -skb_queue_purge (&sk->sk_receive_queue);if (!sock_flag (sk,SOCK_DEAD )) {
@@ -414,14 +405,6 @@ static void netlink_sock_destruct(struct sock *sk)WARN_ON (nlk_sk (sk)->groups); } -static void netlink_sock_destruct_work (struct work_struct *work) -{ - struct netlink_sock *nlk = container_of(work, struct netlink_sock, - work); - -sk_free (&nlk->sk); -} -/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on * SMP. Look, when several writers sleep and reader wakes them up, all but one * immediately hit write lock and grab all the cpus. Exclusive sleep solves
@@ -736,12 +719,6 @@ static void deferred_put_nlk_sk(struct rcu_head *head)if (!refcount_dec_and_test (&sk->sk_refcnt))return ; -if (nlk->cb_running && nlk->cb.done) { -INIT_WORK (&nlk->work, netlink_sock_destruct_work); -schedule_work (&nlk->work); -return ; - } -sk_free (sk); }
@@ -791,6 +768,14 @@ static int netlink_release(struct socket *sock) NETLINK_URELEASE, &n); } +/* Terminate any outstanding dump */ +if (nlk->cb_running) { +if (nlk->cb.done) + nlk->cb.done (&nlk->cb); +module_put (nlk->cb.module); +kfree_skb (nlk->cb.skb); + } +module_put (nlk->module);if (netlink_is_kernel (sk)) {
net/netlink/af_netlink.h +0 -2
@@ -4,7 +4,6 @@#include <linux/rhashtable.h> #include <linux/atomic.h> -#include <linux/workqueue.h> #include <net/sock.h> /* flags */
@@ -48,7 +47,6 @@ struct netlink_sock {struct rhash_head node;struct rcu_head rcu; -struct work_struct work; };static inline struct netlink_sock *nlk_sk (struct sock *sk)
net/nfc/llcp_sock.c +6 -6
@@ -252,10 +252,10 @@ static int nfc_llcp_setsockopt(struct socket *sock, int level, int optname,break ; } -if (copy_from_sockptr (&opt, optval,sizeof (u32))) { - err = -EFAULT ; + err =copy_safe_from_sockptr (&opt,sizeof (opt), + optval, optlen); +if (err)break ; - }if (opt >LLCP_MAX_RW ) { err = -EINVAL ;
@@ -274,10 +274,10 @@ static int nfc_llcp_setsockopt(struct socket *sock, int level, int optname,break ; } -if (copy_from_sockptr (&opt, optval,sizeof (u32))) { - err = -EFAULT ; + err =copy_safe_from_sockptr (&opt,sizeof (opt), + optval, optlen); +if (err)break ; - }if (opt >LLCP_MAX_MIUX ) { err = -EINVAL ;
net/sched/cls_u32.c +32 -22
179 lines not on this page · raw message
net/sched/sch_taprio.c +5 -5
@@ -915,11 +915,6 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,list_for_each_entry (entry, &new->entries, list) cycle =ktime_add_ns (cycle, entry->interval); -if (!cycle) { -NL_SET_ERR_MSG (extack,"'cycle_time' can never be 0" ); -return -EINVAL ; - } -if (cycle <0 || cycle >INT_MAX ) {NL_SET_ERR_MSG (extack,"'cycle_time' is too big" );return -EINVAL ;
@@ -928,6 +923,11 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, new->cycle_time = cycle; } +if (new->cycle_time < new->num_entries *length_to_duration (q,ETH_ZLEN )) { +NL_SET_ERR_MSG (extack,"'cycle_time' is too small" ); +return -EINVAL ; + } +return 0 ; }
net/vmw_vsock/virtio_transport_common.c +8 -0
@@ -1220,6 +1220,14 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,return -ENOMEM ; } +/* __vsock_release() might have already flushed accept_queue. +* Subsequent enqueues would lead to a memory leak. +*/ +if (sk->sk_shutdown ==SHUTDOWN_MASK ) { +virtio_transport_reset_no_sock (t, skb); +return -ESHUTDOWN ; + } + child =vsock_create_connected (sk);if (!child) {virtio_transport_reset_no_sock (t, skb);
samples/pktgen/pktgen_sample01_simple.sh +1 -1
@@ -72,7 +72,7 @@ if [ -n "$DST_PORT" ]; then pg_set $DEV "udp_dst_max $UDP_DST_MAX" fi -[ ! -z "$UDP_CSUM" ] && pg_set $dev "flag UDPCSUM" +[ ! -z "$UDP_CSUM" ] && pg_set $DEV "flag UDPCSUM" # Setup random UDP port src range pg_set $DEV "flag UDPSRC_RND"
security/integrity/ima/ima_template_lib.c +10 -4
@@ -318,15 +318,21 @@ static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, hash_algo_name[hash_algo]); } -if (digest) +if (digest) {memcpy (buffer + offset, digest, digestsize); -else + }else {/* * If digest is NULL, the event being recorded is a violation. * Make room for the digest by increasing the offset by the -* hash algorithm digest size. +* hash algorithm digest size. If the hash algorithm is not +* specified increase the offset by IMA_DIGEST_SIZE which +* fits SHA1 or MD5 */ - offset += hash_digest_size[hash_algo]; +if (hash_algo <HASH_ALGO__LAST ) + offset += hash_digest_size[hash_algo]; +else + offset +=IMA_DIGEST_SIZE ; + }return ima_write_template_field_data (buffer, offset + digestsize, fmt, field_data);
sound/pci/hda/patch_realtek.c +3 -0
@@ -9840,6 +9840,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8b59 ,"HP Elite mt645 G7 Mobile Thin Client U89" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8b5d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8b5e ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x8b5f ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8b63 ,"HP Elite Dragonfly 13.5 inch G4" ,ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8b65 ,"HP ProBook 455 15.6 inch G10 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
@@ -10872,6 +10873,8 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = { {0x1a, 0x40000000}),SND_HDA_PIN_QUIRK (0x10ec0256 ,0x1043 ,"ASUS" ,ALC2XX_FIXUP_HEADSET_MIC , {0x19, 0x40000000}), +SND_HDA_PIN_QUIRK (0x10ec0255 ,0x1558 ,"Clevo" ,ALC2XX_FIXUP_HEADSET_MIC , + {0x19, 0x40000000}), {} };
tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json +22 -0
@@ -132,6 +132,28 @@ "echo \"1\" > /sys/bus/netdevsim/del_device" ] }, + { + "id": "831f", + "name": "Add taprio Qdisc with too short cycle-time", + "category": [ + "qdisc", + "taprio" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device" + ], + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 200000 sched-entry S 02 200000 cycle-time 100 clockid CLOCK_TAI", + "expExitCode": "2", + "verifyCmd": "$TC qdisc show dev $ETH", + "matchPattern": "qdisc taprio 1: root refcnt", + "matchCount": "0", + "teardown": [ + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] + }, { "id": "3e1e", "name": "Add taprio Qdisc with an invalid cycle-time",