Merge 5.15.103 into android13-5.15-lts
Changes in 5.15.103
fs: prevent out-of-bounds array speculation when closing a file descriptor
btrfs: fix percent calculation for bg reclaim message
perf inject: Fix --buildid-all not to eat up MMAP2
fork: allow CLONE_NEWTIME in clone3 flags
x86/CPU/AMD: Disable XSAVES on AMD family 0x17
drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15
drm/connector: print max_requested_bpc in state debugfs
staging: rtl8723bs: Pass correct parameters to cfg80211_get_bss()
ext4: fix cgroup writeback accounting with fs-layer encryption
ext4: fix RENAME_WHITEOUT handling for inline directories
ext4: fix another off-by-one fsmap error on 1k block filesystems
ext4: move where set the MAY_INLINE_DATA flag is set
ext4: fix WARNING in ext4_update_inline_data
ext4: zero i_disksize when initializing the bootloader inode
nfc: change order inside nfc_se_io error path
KVM: Optimize kvm_make_vcpus_request_mask() a bit
KVM: Pre-allocate cpumasks for kvm_make_all_cpus_request_except()
KVM: Register /dev/kvm as the _very_ last thing during initialization
KVM: SVM: Don't rewrite guest ICR on AVIC IPI virtualization failure
KVM: SVM: Process ICR on AVIC IPI delivery failure due to invalid target
fs: dlm: fix log of lowcomms vs midcomms
fs: dlm: add midcomms init/start functions
fs: dlm: start midcomms before scand
udf: Fix off-by-one error when discarding preallocation
f2fs: avoid down_write on nat_tree_lock during checkpoint
f2fs: do not bother checkpoint by f2fs_get_node_info
f2fs: retry to update the inode page given data corruption
ipmi:ssif: Increase the message retry time
ipmi:ssif: Add a timer between request retries
irqdomain: Refactor __irq_domain_alloc_irqs()
iommu/vt-d: Fix PASID directory pointer coherency
block/brd: add error handling support for add_disk()
brd: mark as nowait compatible
arm64: efi: Make efi_rt_lock a raw_spinlock
RISC-V: Avoid dereferening NULL regs in die()
riscv: Avoid enabling interrupts in die()
riscv: Add header include guards to insn.h
scsi: core: Remove the /proc/scsi/${proc_name} directory earlier
regulator: Flag uncontrollable regulators as always_on
regulator: core: Fix off-on-delay-us for always-on/boot-on regulators
regulator: core: Use ktime_get_boottime() to determine how long a regulator was off
ext4: Fix possible corruption when moving a directory
drm/nouveau/kms/nv50-: remove unused functions
drm/nouveau/kms/nv50: fix nv50_wndw_new_ prototype
drm/msm: Fix potential invalid ptr free
drm/msm/a5xx: fix setting of the CP_PREEMPT_ENABLE_LOCAL register
drm/msm/a5xx: fix highest bank bit for a530
drm/msm/a5xx: fix the emptyness check in the preempt code
drm/msm/a5xx: fix context faults during ring switch
bgmac: fix *initial* chip reset to support BCM5358
nfc: fdp: add null check of devm_kmalloc_array in fdp_nci_i2c_read_device_properties
powerpc: dts: t1040rdb: fix compatible string for Rev A boards
ila: do not generate empty messages in ila_xlat_nl_cmd_get_mapping()
selftests: nft_nat: ensuring the listening side is up before starting the client
perf stat: Fix counting when initial delay configured
net: lan78xx: fix accessing the LAN7800's internal phy specific registers from the MAC driver
net: caif: Fix use-after-free in cfusbl_device_notify()
ice: copy last block omitted in ice_get_module_eeprom()
bpf, sockmap: Fix an infinite loop error when len is 0 in tcp_bpf_recvmsg_parser()
drm/msm/dpu: fix len of sc7180 ctl blocks
net: stmmac: add to set device wake up flag when stmmac init phy
net: phylib: get rid of unnecessary locking
bnxt_en: Avoid order-5 memory allocation for TPA data
netfilter: ctnetlink: revert to dumping mark regardless of event type
netfilter: tproxy: fix deadlock due to missing BH disable
btf: fix resolving BTF_KIND_VAR after ARRAY, STRUCT, UNION, PTR
net: phy: smsc: Cache interrupt mask
net: phy: smsc: fix link up detection in forced irq mode
net: ethernet: mtk_eth_soc: fix RX data corruption issue
scsi: megaraid_sas: Update max supported LD IDs to 240
netfilter: conntrack: adopt safer max chain length
platform: x86: MLX_PLATFORM: select REGMAP instead of depending on it
net/smc: fix fallback failed while sendmsg with fastopen
octeontx2-af: Unlock contexts in the queue context cache in case of fault detection
SUNRPC: Fix a server shutdown leak
net: dsa: mt7530: permit port 5 to work without port 6 on MT7621 SoC
af_unix: Remove unnecessary brackets around CONFIG_AF_UNIX_OOB.
af_unix: fix struct pid leaks in OOB support
riscv: Use READ_ONCE_NOCHECK in imprecise unwinding stack mode
s390/ftrace: remove dead code
RISC-V: Don't check text_mutex during stop_machine
ext4: Fix deadlock during directory rename
irqdomain: Fix mapping-creation race
nbd: use the correct block_device in nbd_bdev_reset
iommu/amd: Add PCI segment support for ivrs_[ioapic/hpet/acpihid] commands
iommu/amd: Fix ill-formed ivrs_ioapic, ivrs_hpet and ivrs_acpihid options
iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter
staging: rtl8723bs: clean up comparsions to NULL
Staging: rtl8723bs: Placing opening { braces in previous line
staging: rtl8723bs: fix placement of braces
staging: rtl8723bs: Fix key-store index handling
watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
tpm/eventlog: Don't abort tpm_read_log on faulty ACPI address
xfs: use setattr_copy to set vfs inode attributes
xfs: remove XFS_PREALLOC_SYNC
xfs: fallocate() should call file_modified()
xfs: set prealloc flag in xfs_alloc_file_space()
fs: add mode_strip_sgid() helper
fs: move S_ISGID stripping into the vfs_*() helpers
attr: add in_group_or_capable()
fs: move should_remove_suid()
attr: add setattr_should_drop_sgid()
attr: use consistent sgid stripping checks
fs: use consistent setgid checks in is_sxid()
MIPS: Fix a compilation issue
powerpc/iommu: fix memory leak with using debugfs_lookup()
powerpc/kcsan: Exclude udelay to prevent recursive instrumentation
alpha: fix R_ALPHA_LITERAL reloc for large modules
macintosh: windfarm: Use unsigned type for 1-bit bitfields
PCI: Add SolidRun vendor ID
scripts: handle BrokenPipeError for python scripts
media: ov5640: Fix analogue gain control
media: rc: gpio-ir-recv: add remove function
filelocks: use mount idmapping for setlease permission check
ext4: refactor ext4_free_blocks() to pull out ext4_mb_clear_bb()
ext4: add ext4_sb_block_valid() refactored out of ext4_inode_block_valid()
ext4: add strict range checks while freeing blocks
ext4: block range must be validated before use in ext4_mb_clear_bb()
arch: fix broken BuildID for arm64 and riscv
powerpc/vmlinux.lds: Define RUNTIME_DISCARD_EXIT
powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds
s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36
sh: define RUNTIME_DISCARD_EXIT
tools build: Add feature test for init_disassemble_info API changes
tools include: add dis-asm-compat.h to handle version differences
tools perf: Fix compilation error with new binutils
tools bpf_jit_disasm: Fix compilation error with new binutils
tools bpftool: Fix compilation error with new binutils
KVM: fix memoryleak in kvm_init()
xfs: remove xfs_setattr_time() declaration
UML: define RUNTIME_DISCARD_EXIT
fs: hold writers when changing mount's idmapping
KVM: nVMX: Don't use Enlightened MSR Bitmap for L3
KVM: VMX: Introduce vmx_msr_bitmap_l01_changed() helper
KVM: VMX: Fix crash due to uninitialized current_vmcs
Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}
Linux 5.15.103
Change-Id: I49891cfa5e5316733be06874b36bb276d004e360
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -2227,24 +2227,57 @@
|
||||
|
||||
ivrs_ioapic [HW,X86-64]
|
||||
Provide an override to the IOAPIC-ID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map IOAPIC-ID decimal 10 to
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
|
||||
For example, to map IOAPIC-ID decimal 10 to
|
||||
PCI segment 0x1 and PCI device 00:14.0,
|
||||
write the parameter as:
|
||||
ivrs_ioapic=10@0001:00:14.0
|
||||
|
||||
Deprecated formats:
|
||||
* To map IOAPIC-ID decimal 10 to PCI device 00:14.0
|
||||
write the parameter as:
|
||||
ivrs_ioapic[10]=00:14.0
|
||||
* To map IOAPIC-ID decimal 10 to PCI segment 0x1 and
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
ivrs_ioapic[10]=0001:00:14.0
|
||||
|
||||
ivrs_hpet [HW,X86-64]
|
||||
Provide an override to the HPET-ID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map HPET-ID decimal 0 to
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
|
||||
For example, to map HPET-ID decimal 10 to
|
||||
PCI segment 0x1 and PCI device 00:14.0,
|
||||
write the parameter as:
|
||||
ivrs_hpet=10@0001:00:14.0
|
||||
|
||||
Deprecated formats:
|
||||
* To map HPET-ID decimal 0 to PCI device 00:14.0
|
||||
write the parameter as:
|
||||
ivrs_hpet[0]=00:14.0
|
||||
* To map HPET-ID decimal 10 to PCI segment 0x1 and
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
ivrs_ioapic[10]=0001:00:14.0
|
||||
|
||||
ivrs_acpihid [HW,X86-64]
|
||||
Provide an override to the ACPI-HID:UID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map UART-HID:UID AMD0020:0 to
|
||||
PCI device 00:14.5 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
|
||||
For example, to map UART-HID:UID AMD0020:0 to
|
||||
PCI segment 0x1 and PCI device ID 00:14.5,
|
||||
write the parameter as:
|
||||
ivrs_acpihid=AMD0020:0@0001:00:14.5
|
||||
|
||||
Deprecated formats:
|
||||
* To map UART-HID:UID AMD0020:0 to PCI segment is 0,
|
||||
PCI device ID 00:14.5, write the parameter as:
|
||||
ivrs_acpihid[00:14.5]=AMD0020:0
|
||||
* To map UART-HID:UID AMD0020:0 to PCI segment 0x1 and
|
||||
PCI device ID 00:14.5, write the parameter as:
|
||||
ivrs_acpihid[0001:00:14.5]=AMD0020:0
|
||||
|
||||
js= [HW,JOY] Analog joystick
|
||||
See Documentation/input/joydev/joystick.rst.
|
||||
|
||||
@@ -2929,7 +2929,7 @@ Produces::
|
||||
bash-1994 [000] .... 4342.324898: ima_get_action <-process_measurement
|
||||
bash-1994 [000] .... 4342.324898: ima_match_policy <-ima_get_action
|
||||
bash-1994 [000] .... 4342.324899: do_truncate <-do_last
|
||||
bash-1994 [000] .... 4342.324899: should_remove_suid <-do_truncate
|
||||
bash-1994 [000] .... 4342.324899: setattr_should_drop_suidgid <-do_truncate
|
||||
bash-1994 [000] .... 4342.324899: notify_change <-do_truncate
|
||||
bash-1994 [000] .... 4342.324900: current_fs_time <-notify_change
|
||||
bash-1994 [000] .... 4342.324900: current_kernel_time <-current_fs_time
|
||||
|
||||
3
Makefile
3
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 5
|
||||
PATCHLEVEL = 15
|
||||
SUBLEVEL = 102
|
||||
SUBLEVEL = 103
|
||||
EXTRAVERSION =
|
||||
NAME = Trick or Treat
|
||||
|
||||
@@ -910,6 +910,7 @@ ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
|
||||
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
|
||||
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
|
||||
DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
|
||||
KBUILD_AFLAGS += -gdwarf-$(dwarf-version-y)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DEBUG_INFO_REDUCED
|
||||
|
||||
@@ -146,10 +146,8 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
|
||||
base = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr;
|
||||
symtab = (Elf64_Sym *)sechdrs[symindex].sh_addr;
|
||||
|
||||
/* The small sections were sorted to the end of the segment.
|
||||
The following should definitely cover them. */
|
||||
gp = (u64)me->core_layout.base + me->core_layout.size - 0x8000;
|
||||
got = sechdrs[me->arch.gotsecindex].sh_addr;
|
||||
gp = got + 0x8000;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
unsigned long r_sym = ELF64_R_SYM (rela[i].r_info);
|
||||
|
||||
@@ -374,7 +374,7 @@ struct pci_msu {
|
||||
PCI_CFG04_STAT_SSE | \
|
||||
PCI_CFG04_STAT_PE)
|
||||
|
||||
#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)
|
||||
#define KORINA_CNFG1 (KORINA_STAT | KORINA_CMD)
|
||||
|
||||
#define KORINA_REVID 0
|
||||
#define KORINA_CLASS_CODE 0
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
/ {
|
||||
model = "fsl,T1040RDB-REV-A";
|
||||
compatible = "fsl,T1040RDB-REV-A";
|
||||
};
|
||||
|
||||
&seville_port0 {
|
||||
|
||||
@@ -68,11 +68,9 @@ static void iommu_debugfs_add(struct iommu_table *tbl)
|
||||
static void iommu_debugfs_del(struct iommu_table *tbl)
|
||||
{
|
||||
char name[10];
|
||||
struct dentry *liobn_entry;
|
||||
|
||||
sprintf(name, "%08lx", tbl->it_index);
|
||||
liobn_entry = debugfs_lookup(name, iommu_debugfs_dir);
|
||||
debugfs_remove(liobn_entry);
|
||||
debugfs_lookup_and_remove(name, iommu_debugfs_dir);
|
||||
}
|
||||
#else
|
||||
static void iommu_debugfs_add(struct iommu_table *tbl){}
|
||||
|
||||
@@ -450,7 +450,7 @@ void vtime_flush(struct task_struct *tsk)
|
||||
#define calc_cputime_factors()
|
||||
#endif
|
||||
|
||||
void __delay(unsigned long loops)
|
||||
void __no_kcsan __delay(unsigned long loops)
|
||||
{
|
||||
unsigned long start;
|
||||
|
||||
@@ -471,7 +471,7 @@ void __delay(unsigned long loops)
|
||||
}
|
||||
EXPORT_SYMBOL(__delay);
|
||||
|
||||
void udelay(unsigned long usecs)
|
||||
void __no_kcsan udelay(unsigned long usecs)
|
||||
{
|
||||
__delay(tb_ticks_per_usec * usecs);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define BSS_FIRST_SECTIONS *(.bss.prominit)
|
||||
#define EMITS_PT_NOTE
|
||||
#define RO_EXCEPTION_TABLE_ALIGN 0
|
||||
#define RUNTIME_DISCARD_EXIT
|
||||
|
||||
#define SOFT_MASK_TABLE(align) \
|
||||
. = ALIGN(align); \
|
||||
@@ -407,9 +408,12 @@ SECTIONS
|
||||
DISCARDS
|
||||
/DISCARD/ : {
|
||||
*(*.EMB.apuinfo)
|
||||
*(.glink .iplt .plt .rela* .comment)
|
||||
*(.glink .iplt .plt .comment)
|
||||
*(.gnu.version*)
|
||||
*(.gnu.attributes)
|
||||
*(.eh_frame)
|
||||
#ifndef CONFIG_RELOCATABLE
|
||||
*(.rela*)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,6 @@ int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
|
||||
#define ftrace_init_nop ftrace_init_nop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* CONFIG_DYNAMIC_FTRACE */
|
||||
|
||||
#endif /* _ASM_RISCV_FTRACE_H */
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
* Copyright (C) 2020 SiFive
|
||||
*/
|
||||
|
||||
#ifndef _ASM_RISCV_INSN_H
|
||||
#define _ASM_RISCV_INSN_H
|
||||
|
||||
#include <linux/bits.h>
|
||||
|
||||
/* The bit field of immediate value in I-type instruction */
|
||||
@@ -217,3 +220,5 @@ static inline bool is_ ## INSN_NAME ## _insn(long insn) \
|
||||
(RVC_X(x_, RVC_B_IMM_5_OPOFF, RVC_B_IMM_5_MASK) << RVC_B_IMM_5_OFF) | \
|
||||
(RVC_X(x_, RVC_B_IMM_7_6_OPOFF, RVC_B_IMM_7_6_MASK) << RVC_B_IMM_7_6_OFF) | \
|
||||
(RVC_IMM_SIGN(x_) << RVC_B_IMM_SIGN_OFF); })
|
||||
|
||||
#endif /* _ASM_RISCV_INSN_H */
|
||||
|
||||
@@ -9,4 +9,6 @@
|
||||
int patch_text_nosync(void *addr, const void *insns, size_t len);
|
||||
int patch_text(void *addr, u32 insn);
|
||||
|
||||
extern int riscv_patch_in_stop_machine;
|
||||
|
||||
#endif /* _ASM_RISCV_PATCH_H */
|
||||
|
||||
@@ -15,11 +15,21 @@
|
||||
int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
|
||||
{
|
||||
mutex_lock(&text_mutex);
|
||||
|
||||
/*
|
||||
* The code sequences we use for ftrace can't be patched while the
|
||||
* kernel is running, so we need to use stop_machine() to modify them
|
||||
* for now. This doesn't play nice with text_mutex, we use this flag
|
||||
* to elide the check.
|
||||
*/
|
||||
riscv_patch_in_stop_machine = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
|
||||
{
|
||||
riscv_patch_in_stop_machine = false;
|
||||
mutex_unlock(&text_mutex);
|
||||
return 0;
|
||||
}
|
||||
@@ -109,9 +119,9 @@ int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
|
||||
{
|
||||
int out;
|
||||
|
||||
ftrace_arch_code_modify_prepare();
|
||||
mutex_lock(&text_mutex);
|
||||
out = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
|
||||
ftrace_arch_code_modify_post_process();
|
||||
mutex_unlock(&text_mutex);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <asm/kprobes.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/fixmap.h>
|
||||
#include <asm/ftrace.h>
|
||||
#include <asm/patch.h>
|
||||
|
||||
struct patch_insn {
|
||||
@@ -19,6 +20,8 @@ struct patch_insn {
|
||||
atomic_t cpu_count;
|
||||
};
|
||||
|
||||
int riscv_patch_in_stop_machine = false;
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
/*
|
||||
* The fix_to_virt(, idx) needs a const value (not a dynamic variable of
|
||||
@@ -59,8 +62,15 @@ static int patch_insn_write(void *addr, const void *insn, size_t len)
|
||||
* Before reaching here, it was expected to lock the text_mutex
|
||||
* already, so we don't need to give another lock here and could
|
||||
* ensure that it was safe between each cores.
|
||||
*
|
||||
* We're currently using stop_machine() for ftrace & kprobes, and while
|
||||
* that ensures text_mutex is held before installing the mappings it
|
||||
* does not ensure text_mutex is held by the calling thread. That's
|
||||
* safe but triggers a lockdep failure, so just elide it for that
|
||||
* specific case.
|
||||
*/
|
||||
lockdep_assert_held(&text_mutex);
|
||||
if (!riscv_patch_in_stop_machine)
|
||||
lockdep_assert_held(&text_mutex);
|
||||
|
||||
if (across_pages)
|
||||
patch_map(addr + len, FIX_TEXT_POKE1);
|
||||
@@ -121,13 +131,25 @@ NOKPROBE_SYMBOL(patch_text_cb);
|
||||
|
||||
int patch_text(void *addr, u32 insn)
|
||||
{
|
||||
int ret;
|
||||
struct patch_insn patch = {
|
||||
.addr = addr,
|
||||
.insn = insn,
|
||||
.cpu_count = ATOMIC_INIT(0),
|
||||
};
|
||||
|
||||
return stop_machine_cpuslocked(patch_text_cb,
|
||||
&patch, cpu_online_mask);
|
||||
/*
|
||||
* kprobes takes text_mutex, before calling patch_text(), but as we call
|
||||
* calls stop_machine(), the lockdep assertion in patch_insn_write()
|
||||
* gets confused by the context in which the lock is taken.
|
||||
* Instead, ensure the lock is held before calling stop_machine(), and
|
||||
* set riscv_patch_in_stop_machine to skip the check in
|
||||
* patch_insn_write().
|
||||
*/
|
||||
lockdep_assert_held(&text_mutex);
|
||||
riscv_patch_in_stop_machine = true;
|
||||
ret = stop_machine_cpuslocked(patch_text_cb, &patch, cpu_online_mask);
|
||||
riscv_patch_in_stop_machine = false;
|
||||
return ret;
|
||||
}
|
||||
NOKPROBE_SYMBOL(patch_text);
|
||||
|
||||
@@ -94,7 +94,7 @@ void notrace walk_stackframe(struct task_struct *task,
|
||||
while (!kstack_end(ksp)) {
|
||||
if (__kernel_text_address(pc) && unlikely(!fn(arg, pc)))
|
||||
break;
|
||||
pc = (*ksp++) - 0x4;
|
||||
pc = READ_ONCE_NOCHECK(*ksp++) - 0x4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,25 +33,29 @@ void die(struct pt_regs *regs, const char *str)
|
||||
{
|
||||
static int die_counter;
|
||||
int ret;
|
||||
long cause;
|
||||
unsigned long flags;
|
||||
|
||||
oops_enter();
|
||||
|
||||
spin_lock_irq(&die_lock);
|
||||
spin_lock_irqsave(&die_lock, flags);
|
||||
console_verbose();
|
||||
bust_spinlocks(1);
|
||||
|
||||
pr_emerg("%s [#%d]\n", str, ++die_counter);
|
||||
print_modules();
|
||||
show_regs(regs);
|
||||
if (regs)
|
||||
show_regs(regs);
|
||||
|
||||
ret = notify_die(DIE_OOPS, str, regs, 0, regs->cause, SIGSEGV);
|
||||
cause = regs ? regs->cause : -1;
|
||||
ret = notify_die(DIE_OOPS, str, regs, 0, cause, SIGSEGV);
|
||||
|
||||
if (regs && kexec_should_crash(current))
|
||||
if (kexec_should_crash(current))
|
||||
crash_kexec(regs);
|
||||
|
||||
bust_spinlocks(0);
|
||||
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
|
||||
spin_unlock_irq(&die_lock);
|
||||
spin_unlock_irqrestore(&die_lock, flags);
|
||||
oops_exit();
|
||||
|
||||
if (in_interrupt())
|
||||
|
||||
@@ -80,17 +80,6 @@ asm(
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
static char *ftrace_plt;
|
||||
|
||||
asm(
|
||||
" .data\n"
|
||||
"ftrace_plt_template:\n"
|
||||
" basr %r1,%r0\n"
|
||||
" lg %r1,0f-.(%r1)\n"
|
||||
" br %r1\n"
|
||||
"0: .quad ftrace_caller\n"
|
||||
"ftrace_plt_template_end:\n"
|
||||
" .previous\n"
|
||||
);
|
||||
#endif /* CONFIG_MODULES */
|
||||
|
||||
static const char *ftrace_shared_hotpatch_trampoline(const char **end)
|
||||
@@ -116,7 +105,7 @@ static const char *ftrace_shared_hotpatch_trampoline(const char **end)
|
||||
|
||||
bool ftrace_need_init_nop(void)
|
||||
{
|
||||
return ftrace_shared_hotpatch_trampoline(NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
|
||||
@@ -175,28 +164,6 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ftrace_generate_nop_insn(struct ftrace_insn *insn)
|
||||
{
|
||||
/* brcl 0,0 */
|
||||
insn->opc = 0xc004;
|
||||
insn->disp = 0;
|
||||
}
|
||||
|
||||
static void ftrace_generate_call_insn(struct ftrace_insn *insn,
|
||||
unsigned long ip)
|
||||
{
|
||||
unsigned long target;
|
||||
|
||||
/* brasl r0,ftrace_caller */
|
||||
target = FTRACE_ADDR;
|
||||
#ifdef CONFIG_MODULES
|
||||
if (is_module_addr((void *)ip))
|
||||
target = (unsigned long)ftrace_plt;
|
||||
#endif /* CONFIG_MODULES */
|
||||
insn->opc = 0xc005;
|
||||
insn->disp = (target - ip) / 2;
|
||||
}
|
||||
|
||||
static void brcl_disable(void *brcl)
|
||||
{
|
||||
u8 op = 0x04; /* set mask field to zero */
|
||||
@@ -207,23 +174,7 @@ static void brcl_disable(void *brcl)
|
||||
int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
|
||||
unsigned long addr)
|
||||
{
|
||||
struct ftrace_insn orig, new, old;
|
||||
|
||||
if (ftrace_shared_hotpatch_trampoline(NULL)) {
|
||||
brcl_disable((void *)rec->ip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (copy_from_kernel_nofault(&old, (void *) rec->ip, sizeof(old)))
|
||||
return -EFAULT;
|
||||
/* Replace ftrace call with a nop. */
|
||||
ftrace_generate_call_insn(&orig, rec->ip);
|
||||
ftrace_generate_nop_insn(&new);
|
||||
|
||||
/* Verify that the to be replaced code matches what we expect. */
|
||||
if (memcmp(&orig, &old, sizeof(old)))
|
||||
return -EINVAL;
|
||||
s390_kernel_write((void *) rec->ip, &new, sizeof(new));
|
||||
brcl_disable((void *)rec->ip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,23 +187,7 @@ static void brcl_enable(void *brcl)
|
||||
|
||||
int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
|
||||
{
|
||||
struct ftrace_insn orig, new, old;
|
||||
|
||||
if (ftrace_shared_hotpatch_trampoline(NULL)) {
|
||||
brcl_enable((void *)rec->ip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (copy_from_kernel_nofault(&old, (void *) rec->ip, sizeof(old)))
|
||||
return -EFAULT;
|
||||
/* Replace nop with an ftrace call. */
|
||||
ftrace_generate_nop_insn(&orig);
|
||||
ftrace_generate_call_insn(&new, rec->ip);
|
||||
|
||||
/* Verify that the to be replaced code matches what we expect. */
|
||||
if (memcmp(&orig, &old, sizeof(old)))
|
||||
return -EINVAL;
|
||||
s390_kernel_write((void *) rec->ip, &new, sizeof(new));
|
||||
brcl_enable((void *)rec->ip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -269,10 +204,7 @@ int __init ftrace_dyn_arch_init(void)
|
||||
|
||||
void arch_ftrace_update_code(int command)
|
||||
{
|
||||
if (ftrace_shared_hotpatch_trampoline(NULL))
|
||||
ftrace_modify_all_code(command);
|
||||
else
|
||||
ftrace_run_stop_machine(command);
|
||||
ftrace_modify_all_code(command);
|
||||
}
|
||||
|
||||
static void __ftrace_sync(void *dummy)
|
||||
@@ -281,10 +213,8 @@ static void __ftrace_sync(void *dummy)
|
||||
|
||||
int ftrace_arch_code_modify_post_process(void)
|
||||
{
|
||||
if (ftrace_shared_hotpatch_trampoline(NULL)) {
|
||||
/* Send SIGP to the other CPUs, so they see the new code. */
|
||||
smp_call_function(__ftrace_sync, NULL, 1);
|
||||
}
|
||||
/* Send SIGP to the other CPUs, so they see the new code. */
|
||||
smp_call_function(__ftrace_sync, NULL, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -299,10 +229,6 @@ static int __init ftrace_plt_init(void)
|
||||
panic("cannot allocate ftrace plt\n");
|
||||
|
||||
start = ftrace_shared_hotpatch_trampoline(&end);
|
||||
if (!start) {
|
||||
start = ftrace_plt_template;
|
||||
end = ftrace_plt_template_end;
|
||||
}
|
||||
memcpy(ftrace_plt, start, end - start);
|
||||
set_memory_ro((unsigned long)ftrace_plt, 1);
|
||||
return 0;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
/* Handle ro_after_init data on our own. */
|
||||
#define RO_AFTER_INIT_DATA
|
||||
|
||||
#define RUNTIME_DISCARD_EXIT
|
||||
|
||||
#define EMITS_PT_NOTE
|
||||
|
||||
#include <asm-generic/vmlinux.lds.h>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Written by Niibe Yutaka and Paul Mundt
|
||||
*/
|
||||
OUTPUT_ARCH(sh)
|
||||
#define RUNTIME_DISCARD_EXIT
|
||||
#include <asm/thread_info.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/vmlinux.lds.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
#define RUNTIME_DISCARD_EXIT
|
||||
KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
|
||||
|
||||
#ifdef CONFIG_LD_SCRIPT_STATIC
|
||||
|
||||
@@ -904,6 +904,15 @@ void init_spectral_chicken(struct cpuinfo_x86 *c)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Work around Erratum 1386. The XSAVES instruction malfunctions in
|
||||
* certain circumstances on Zen1/2 uarch, and not all parts have had
|
||||
* updated microcode at the time of writing (March 2023).
|
||||
*
|
||||
* Affected parts all have no supervisor XSAVE states, meaning that
|
||||
* the XSAVEC instruction (which works fine) is equivalent.
|
||||
*/
|
||||
clear_cpu_cap(c, X86_FEATURE_XSAVES);
|
||||
}
|
||||
|
||||
static void init_amd_zn(struct cpuinfo_x86 *c)
|
||||
|
||||
@@ -1295,6 +1295,7 @@ void kvm_apic_send_ipi(struct kvm_lapic *apic, u32 icr_low, u32 icr_high)
|
||||
|
||||
kvm_irq_delivery_to_apic(apic->vcpu->kvm, apic, &irq, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_apic_send_ipi);
|
||||
|
||||
static u32 apic_get_tmcct(struct kvm_lapic *apic)
|
||||
{
|
||||
|
||||
@@ -318,20 +318,24 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu)
|
||||
trace_kvm_avic_incomplete_ipi(vcpu->vcpu_id, icrh, icrl, id, index);
|
||||
|
||||
switch (id) {
|
||||
case AVIC_IPI_FAILURE_INVALID_TARGET:
|
||||
case AVIC_IPI_FAILURE_INVALID_INT_TYPE:
|
||||
/*
|
||||
* AVIC hardware handles the generation of
|
||||
* IPIs when the specified Message Type is Fixed
|
||||
* (also known as fixed delivery mode) and
|
||||
* the Trigger Mode is edge-triggered. The hardware
|
||||
* also supports self and broadcast delivery modes
|
||||
* specified via the Destination Shorthand(DSH)
|
||||
* field of the ICRL. Logical and physical APIC ID
|
||||
* formats are supported. All other IPI types cause
|
||||
* a #VMEXIT, which needs to emulated.
|
||||
* Emulate IPIs that are not handled by AVIC hardware, which
|
||||
* only virtualizes Fixed, Edge-Triggered INTRs, and falls over
|
||||
* if _any_ targets are invalid, e.g. if the logical mode mask
|
||||
* is a superset of running vCPUs.
|
||||
*
|
||||
* The exit is a trap, e.g. ICR holds the correct value and RIP
|
||||
* has been advanced, KVM is responsible only for emulating the
|
||||
* IPI. Sadly, hardware may sometimes leave the BUSY flag set,
|
||||
* in which case KVM needs to emulate the ICR write as well in
|
||||
* order to clear the BUSY flag.
|
||||
*/
|
||||
kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
|
||||
kvm_lapic_reg_write(apic, APIC_ICR, icrl);
|
||||
if (icrl & APIC_ICR_BUSY)
|
||||
kvm_apic_write_nodecode(vcpu, APIC_ICR);
|
||||
else
|
||||
kvm_apic_send_ipi(apic, icrl, icrh);
|
||||
break;
|
||||
case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING:
|
||||
/*
|
||||
@@ -341,8 +345,6 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu)
|
||||
*/
|
||||
avic_kick_target_vcpus(vcpu->kvm, apic, icrl, icrh);
|
||||
break;
|
||||
case AVIC_IPI_FAILURE_INVALID_TARGET:
|
||||
break;
|
||||
case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE:
|
||||
WARN_ONCE(1, "Invalid backing page\n");
|
||||
break;
|
||||
|
||||
@@ -162,16 +162,6 @@ static inline u16 evmcs_read16(unsigned long field)
|
||||
return *(u16 *)((char *)current_evmcs + offset);
|
||||
}
|
||||
|
||||
static inline void evmcs_touch_msr_bitmap(void)
|
||||
{
|
||||
if (unlikely(!current_evmcs))
|
||||
return;
|
||||
|
||||
if (current_evmcs->hv_enlightenments_control.msr_bitmap)
|
||||
current_evmcs->hv_clean_fields &=
|
||||
~HV_VMX_ENLIGHTENED_CLEAN_FIELD_MSR_BITMAP;
|
||||
}
|
||||
|
||||
static inline void evmcs_load(u64 phys_addr)
|
||||
{
|
||||
struct hv_vp_assist_page *vp_ap =
|
||||
@@ -192,7 +182,6 @@ static inline u64 evmcs_read64(unsigned long field) { return 0; }
|
||||
static inline u32 evmcs_read32(unsigned long field) { return 0; }
|
||||
static inline u16 evmcs_read16(unsigned long field) { return 0; }
|
||||
static inline void evmcs_load(u64 phys_addr) {}
|
||||
static inline void evmcs_touch_msr_bitmap(void) {}
|
||||
#endif /* IS_ENABLED(CONFIG_HYPERV) */
|
||||
|
||||
#define EVMPTR_INVALID (-1ULL)
|
||||
|
||||
@@ -2739,15 +2739,6 @@ int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
|
||||
if (!loaded_vmcs->msr_bitmap)
|
||||
goto out_vmcs;
|
||||
memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE);
|
||||
|
||||
if (IS_ENABLED(CONFIG_HYPERV) &&
|
||||
static_branch_unlikely(&enable_evmcs) &&
|
||||
(ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
|
||||
struct hv_enlightened_vmcs *evmcs =
|
||||
(struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;
|
||||
|
||||
evmcs->hv_enlightenments_control.msr_bitmap = 1;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&loaded_vmcs->host_state, 0, sizeof(struct vmcs_host_state));
|
||||
@@ -3781,6 +3772,22 @@ void free_vpid(int vpid)
|
||||
spin_unlock(&vmx_vpid_lock);
|
||||
}
|
||||
|
||||
static void vmx_msr_bitmap_l01_changed(struct vcpu_vmx *vmx)
|
||||
{
|
||||
/*
|
||||
* When KVM is a nested hypervisor on top of Hyper-V and uses
|
||||
* 'Enlightened MSR Bitmap' feature L0 needs to know that MSR
|
||||
* bitmap has changed.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_HYPERV) && static_branch_unlikely(&enable_evmcs)) {
|
||||
struct hv_enlightened_vmcs *evmcs = (void *)vmx->vmcs01.vmcs;
|
||||
|
||||
if (evmcs->hv_enlightenments_control.msr_bitmap)
|
||||
evmcs->hv_clean_fields &=
|
||||
~HV_VMX_ENLIGHTENED_CLEAN_FIELD_MSR_BITMAP;
|
||||
}
|
||||
}
|
||||
|
||||
void vmx_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
@@ -3789,8 +3796,7 @@ void vmx_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
||||
if (!cpu_has_vmx_msr_bitmap())
|
||||
return;
|
||||
|
||||
if (static_branch_unlikely(&enable_evmcs))
|
||||
evmcs_touch_msr_bitmap();
|
||||
vmx_msr_bitmap_l01_changed(vmx);
|
||||
|
||||
/*
|
||||
* Mark the desired intercept state in shadow bitmap, this is needed
|
||||
@@ -3834,8 +3840,7 @@ void vmx_enable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
|
||||
if (!cpu_has_vmx_msr_bitmap())
|
||||
return;
|
||||
|
||||
if (static_branch_unlikely(&enable_evmcs))
|
||||
evmcs_touch_msr_bitmap();
|
||||
vmx_msr_bitmap_l01_changed(vmx);
|
||||
|
||||
/*
|
||||
* Mark the desired intercept state in shadow bitmap, this is needed
|
||||
@@ -6969,6 +6974,19 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
|
||||
if (err < 0)
|
||||
goto free_pml;
|
||||
|
||||
/*
|
||||
* Use Hyper-V 'Enlightened MSR Bitmap' feature when KVM runs as a
|
||||
* nested (L1) hypervisor and Hyper-V in L0 supports it. Enable the
|
||||
* feature only for vmcs01, KVM currently isn't equipped to realize any
|
||||
* performance benefits from enabling it for vmcs02.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_HYPERV) && static_branch_unlikely(&enable_evmcs) &&
|
||||
(ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
|
||||
struct hv_enlightened_vmcs *evmcs = (void *)vmx->vmcs01.vmcs;
|
||||
|
||||
evmcs->hv_enlightenments_control.msr_bitmap = 1;
|
||||
}
|
||||
|
||||
/* The MSR bitmap starts with all ones */
|
||||
bitmap_fill(vmx->shadow_msr_intercept.read, MAX_POSSIBLE_PASSTHROUGH_MSRS);
|
||||
bitmap_fill(vmx->shadow_msr_intercept.write, MAX_POSSIBLE_PASSTHROUGH_MSRS);
|
||||
|
||||
@@ -370,6 +370,7 @@ static int brd_alloc(int i)
|
||||
struct brd_device *brd;
|
||||
struct gendisk *disk;
|
||||
char buf[DISK_NAME_LEN];
|
||||
int err = -ENOMEM;
|
||||
|
||||
mutex_lock(&brd_devices_mutex);
|
||||
list_for_each_entry(brd, &brd_devices, brd_list) {
|
||||
@@ -420,16 +421,21 @@ static int brd_alloc(int i)
|
||||
/* Tell the block layer that this is not a rotational device */
|
||||
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
|
||||
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
|
||||
add_disk(disk);
|
||||
blk_queue_flag_set(QUEUE_FLAG_NOWAIT, disk->queue);
|
||||
err = add_disk(disk);
|
||||
if (err)
|
||||
goto out_cleanup_disk;
|
||||
|
||||
return 0;
|
||||
|
||||
out_cleanup_disk:
|
||||
blk_cleanup_disk(disk);
|
||||
out_free_dev:
|
||||
mutex_lock(&brd_devices_mutex);
|
||||
list_del(&brd->brd_list);
|
||||
mutex_unlock(&brd_devices_mutex);
|
||||
kfree(brd);
|
||||
return -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void brd_probe(dev_t dev)
|
||||
|
||||
@@ -1167,11 +1167,11 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
static void nbd_bdev_reset(struct block_device *bdev)
|
||||
static void nbd_bdev_reset(struct nbd_device *nbd)
|
||||
{
|
||||
if (bdev->bd_openers > 1)
|
||||
if (nbd->disk->part0->bd_openers > 1)
|
||||
return;
|
||||
set_capacity(bdev->bd_disk, 0);
|
||||
set_capacity(nbd->disk, 0);
|
||||
}
|
||||
|
||||
static void nbd_parse_flags(struct nbd_device *nbd)
|
||||
@@ -1337,7 +1337,7 @@ static int nbd_start_device(struct nbd_device *nbd)
|
||||
return nbd_set_size(nbd, config->bytesize, nbd_blksize(config));
|
||||
}
|
||||
|
||||
static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *bdev)
|
||||
static int nbd_start_device_ioctl(struct nbd_device *nbd)
|
||||
{
|
||||
struct nbd_config *config = nbd->config;
|
||||
int ret;
|
||||
@@ -1358,7 +1358,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
|
||||
|
||||
flush_workqueue(nbd->recv_workq);
|
||||
mutex_lock(&nbd->config_lock);
|
||||
nbd_bdev_reset(bdev);
|
||||
nbd_bdev_reset(nbd);
|
||||
/* user requested, ignore socket errors */
|
||||
if (test_bit(NBD_RT_DISCONNECT_REQUESTED, &config->runtime_flags))
|
||||
ret = 0;
|
||||
@@ -1372,7 +1372,7 @@ static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
|
||||
{
|
||||
nbd_clear_sock(nbd);
|
||||
__invalidate_device(bdev, true);
|
||||
nbd_bdev_reset(bdev);
|
||||
nbd_bdev_reset(nbd);
|
||||
if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
|
||||
&nbd->config->runtime_flags))
|
||||
nbd_config_put(nbd);
|
||||
@@ -1418,7 +1418,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
|
||||
config->flags = arg;
|
||||
return 0;
|
||||
case NBD_DO_IT:
|
||||
return nbd_start_device_ioctl(nbd, bdev);
|
||||
return nbd_start_device_ioctl(nbd);
|
||||
case NBD_CLEAR_QUE:
|
||||
/*
|
||||
* This is for compatibility only. The queue is always cleared
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
/*
|
||||
* Timer values
|
||||
*/
|
||||
#define SSIF_MSG_USEC 20000 /* 20ms between message tries. */
|
||||
#define SSIF_MSG_USEC 60000 /* 60ms between message tries (T3). */
|
||||
#define SSIF_REQ_RETRY_USEC 60000 /* 60ms between send retries (T6). */
|
||||
#define SSIF_MSG_PART_USEC 5000 /* 5ms for a message part */
|
||||
|
||||
/* How many times to we retry sending/receiving the message. */
|
||||
@@ -82,7 +83,9 @@
|
||||
#define SSIF_RECV_RETRIES 250
|
||||
|
||||
#define SSIF_MSG_MSEC (SSIF_MSG_USEC / 1000)
|
||||
#define SSIF_REQ_RETRY_MSEC (SSIF_REQ_RETRY_USEC / 1000)
|
||||
#define SSIF_MSG_JIFFIES ((SSIF_MSG_USEC * 1000) / TICK_NSEC)
|
||||
#define SSIF_REQ_RETRY_JIFFIES ((SSIF_REQ_RETRY_USEC * 1000) / TICK_NSEC)
|
||||
#define SSIF_MSG_PART_JIFFIES ((SSIF_MSG_PART_USEC * 1000) / TICK_NSEC)
|
||||
|
||||
/*
|
||||
@@ -229,6 +232,9 @@ struct ssif_info {
|
||||
bool got_alert;
|
||||
bool waiting_alert;
|
||||
|
||||
/* Used to inform the timeout that it should do a resend. */
|
||||
bool do_resend;
|
||||
|
||||
/*
|
||||
* If set to true, this will request events the next time the
|
||||
* state machine is idle.
|
||||
@@ -538,22 +544,28 @@ static void start_get(struct ssif_info *ssif_info)
|
||||
ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
|
||||
}
|
||||
|
||||
static void start_resend(struct ssif_info *ssif_info);
|
||||
|
||||
static void retry_timeout(struct timer_list *t)
|
||||
{
|
||||
struct ssif_info *ssif_info = from_timer(ssif_info, t, retry_timer);
|
||||
unsigned long oflags, *flags;
|
||||
bool waiting;
|
||||
bool waiting, resend;
|
||||
|
||||
if (ssif_info->stopping)
|
||||
return;
|
||||
|
||||
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
||||
resend = ssif_info->do_resend;
|
||||
ssif_info->do_resend = false;
|
||||
waiting = ssif_info->waiting_alert;
|
||||
ssif_info->waiting_alert = false;
|
||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||
|
||||
if (waiting)
|
||||
start_get(ssif_info);
|
||||
if (resend)
|
||||
start_resend(ssif_info);
|
||||
}
|
||||
|
||||
static void watch_timeout(struct timer_list *t)
|
||||
@@ -602,8 +614,6 @@ static void ssif_alert(struct i2c_client *client, enum i2c_alert_protocol type,
|
||||
start_get(ssif_info);
|
||||
}
|
||||
|
||||
static void start_resend(struct ssif_info *ssif_info);
|
||||
|
||||
static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -909,7 +919,13 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result,
|
||||
if (result < 0) {
|
||||
ssif_info->retries_left--;
|
||||
if (ssif_info->retries_left > 0) {
|
||||
start_resend(ssif_info);
|
||||
/*
|
||||
* Wait the retry timeout time per the spec,
|
||||
* then redo the send.
|
||||
*/
|
||||
ssif_info->do_resend = true;
|
||||
mod_timer(&ssif_info->retry_timer,
|
||||
jiffies + SSIF_REQ_RETRY_JIFFIES);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1322,8 +1338,10 @@ static int do_cmd(struct i2c_client *client, int len, unsigned char *msg,
|
||||
ret = i2c_smbus_write_block_data(client, SSIF_IPMI_REQUEST, len, msg);
|
||||
if (ret) {
|
||||
retry_cnt--;
|
||||
if (retry_cnt > 0)
|
||||
if (retry_cnt > 0) {
|
||||
msleep(SSIF_REQ_RETRY_MSEC);
|
||||
goto retry1;
|
||||
}
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1464,8 +1482,10 @@ retry_write:
|
||||
32, msg);
|
||||
if (ret) {
|
||||
retry_cnt--;
|
||||
if (retry_cnt > 0)
|
||||
if (retry_cnt > 0) {
|
||||
msleep(SSIF_REQ_RETRY_MSEC);
|
||||
goto retry_write;
|
||||
}
|
||||
dev_err(&client->dev, "Could not write multi-part start, though the BMC said it could handle it. Just limit sends to one part.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -143,8 +143,12 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
|
||||
|
||||
ret = -EIO;
|
||||
virt = acpi_os_map_iomem(start, len);
|
||||
if (!virt)
|
||||
if (!virt) {
|
||||
dev_warn(&chip->dev, "%s: Failed to map ACPI memory\n", __func__);
|
||||
/* try EFI log next */
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
memcpy_fromio(log->bios_event_log, virt, len);
|
||||
|
||||
|
||||
@@ -461,8 +461,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
|
||||
*value = 0;
|
||||
for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {
|
||||
en = &soc15_allowed_read_registers[i];
|
||||
if (adev->reg_offset[en->hwip][en->inst] &&
|
||||
reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
|
||||
if (!adev->reg_offset[en->hwip][en->inst])
|
||||
continue;
|
||||
else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
|
||||
+ en->reg_offset))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1052,6 +1052,7 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
|
||||
drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
|
||||
drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
|
||||
drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware);
|
||||
drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc);
|
||||
|
||||
if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
|
||||
if (state->writeback_job && state->writeback_job->fb)
|
||||
|
||||
@@ -153,8 +153,8 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
|
||||
OUT_RING(ring, 1);
|
||||
|
||||
/* Enable local preemption for finegrain preemption */
|
||||
OUT_PKT7(ring, CP_PREEMPT_ENABLE_GLOBAL, 1);
|
||||
OUT_RING(ring, 0x02);
|
||||
OUT_PKT7(ring, CP_PREEMPT_ENABLE_LOCAL, 1);
|
||||
OUT_RING(ring, 0x1);
|
||||
|
||||
/* Allow CP_CONTEXT_SWITCH_YIELD packets in the IB2 */
|
||||
OUT_PKT7(ring, CP_YIELD_ENABLE, 1);
|
||||
@@ -801,7 +801,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
|
||||
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
|
||||
|
||||
/* Set the highest bank bit */
|
||||
if (adreno_is_a540(adreno_gpu))
|
||||
if (adreno_is_a540(adreno_gpu) || adreno_is_a530(adreno_gpu))
|
||||
regbit = 2;
|
||||
else
|
||||
regbit = 1;
|
||||
|
||||
@@ -63,7 +63,7 @@ static struct msm_ringbuffer *get_next_ring(struct msm_gpu *gpu)
|
||||
struct msm_ringbuffer *ring = gpu->rb[i];
|
||||
|
||||
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||
empty = (get_wptr(ring) == ring->memptrs->rptr);
|
||||
empty = (get_wptr(ring) == gpu->funcs->get_rptr(gpu, ring));
|
||||
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||
|
||||
if (!empty)
|
||||
@@ -208,6 +208,7 @@ void a5xx_preempt_hw_init(struct msm_gpu *gpu)
|
||||
a5xx_gpu->preempt[i]->wptr = 0;
|
||||
a5xx_gpu->preempt[i]->rptr = 0;
|
||||
a5xx_gpu->preempt[i]->rbase = gpu->rb[i]->iova;
|
||||
a5xx_gpu->preempt[i]->rptr_addr = shadowptr(a5xx_gpu, gpu->rb[i]);
|
||||
}
|
||||
|
||||
/* Write a 0 to signal that we aren't switching pagetables */
|
||||
@@ -259,7 +260,6 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu,
|
||||
ptr->data = 0;
|
||||
ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE;
|
||||
|
||||
ptr->rptr_addr = shadowptr(a5xx_gpu, ring);
|
||||
ptr->counter = counters_iova;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -375,19 +375,19 @@ static const struct dpu_ctl_cfg sdm845_ctl[] = {
|
||||
static const struct dpu_ctl_cfg sc7180_ctl[] = {
|
||||
{
|
||||
.name = "ctl_0", .id = CTL_0,
|
||||
.base = 0x1000, .len = 0xE4,
|
||||
.base = 0x1000, .len = 0x1dc,
|
||||
.features = BIT(DPU_CTL_ACTIVE_CFG),
|
||||
.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
|
||||
},
|
||||
{
|
||||
.name = "ctl_1", .id = CTL_1,
|
||||
.base = 0x1200, .len = 0xE4,
|
||||
.base = 0x1200, .len = 0x1dc,
|
||||
.features = BIT(DPU_CTL_ACTIVE_CFG),
|
||||
.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
|
||||
},
|
||||
{
|
||||
.name = "ctl_2", .id = CTL_2,
|
||||
.base = 0x1400, .len = 0xE4,
|
||||
.base = 0x1400, .len = 0x1dc,
|
||||
.features = BIT(DPU_CTL_ACTIVE_CFG),
|
||||
.intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
|
||||
},
|
||||
|
||||
@@ -640,8 +640,8 @@ static struct msm_submit_post_dep *msm_parse_post_deps(struct drm_device *dev,
|
||||
int ret = 0;
|
||||
uint32_t i, j;
|
||||
|
||||
post_deps = kmalloc_array(nr_syncobjs, sizeof(*post_deps),
|
||||
GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
|
||||
post_deps = kcalloc(nr_syncobjs, sizeof(*post_deps),
|
||||
GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
|
||||
if (!post_deps)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -656,7 +656,6 @@ static struct msm_submit_post_dep *msm_parse_post_deps(struct drm_device *dev,
|
||||
}
|
||||
|
||||
post_deps[i].point = syncobj_desc.point;
|
||||
post_deps[i].chain = NULL;
|
||||
|
||||
if (syncobj_desc.flags) {
|
||||
ret = -EINVAL;
|
||||
|
||||
@@ -2622,14 +2622,6 @@ nv50_display_fini(struct drm_device *dev, bool runtime, bool suspend)
|
||||
{
|
||||
struct nouveau_drm *drm = nouveau_drm(dev);
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_plane *plane;
|
||||
|
||||
drm_for_each_plane(plane, dev) {
|
||||
struct nv50_wndw *wndw = nv50_wndw(plane);
|
||||
if (plane->funcs != &nv50_wndw)
|
||||
continue;
|
||||
nv50_wndw_fini(wndw);
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||
if (encoder->encoder_type != DRM_MODE_ENCODER_DPMST)
|
||||
@@ -2645,7 +2637,6 @@ nv50_display_init(struct drm_device *dev, bool resume, bool runtime)
|
||||
{
|
||||
struct nv50_core *core = nv50_disp(dev)->core;
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_plane *plane;
|
||||
|
||||
if (resume || runtime)
|
||||
core->func->init(core);
|
||||
@@ -2658,13 +2649,6 @@ nv50_display_init(struct drm_device *dev, bool resume, bool runtime)
|
||||
}
|
||||
}
|
||||
|
||||
drm_for_each_plane(plane, dev) {
|
||||
struct nv50_wndw *wndw = nv50_wndw(plane);
|
||||
if (plane->funcs != &nv50_wndw)
|
||||
continue;
|
||||
nv50_wndw_init(wndw);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -694,18 +694,6 @@ nv50_wndw_notify(struct nvif_notify *notify)
|
||||
return NVIF_NOTIFY_KEEP;
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_fini(struct nv50_wndw *wndw)
|
||||
{
|
||||
nvif_notify_put(&wndw->notify);
|
||||
}
|
||||
|
||||
void
|
||||
nv50_wndw_init(struct nv50_wndw *wndw)
|
||||
{
|
||||
nvif_notify_get(&wndw->notify);
|
||||
}
|
||||
|
||||
static const u64 nv50_cursor_format_modifiers[] = {
|
||||
DRM_FORMAT_MOD_LINEAR,
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
|
||||
@@ -38,10 +38,9 @@ struct nv50_wndw {
|
||||
|
||||
int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
|
||||
enum drm_plane_type, const char *name, int index,
|
||||
const u32 *format, enum nv50_disp_interlock_type,
|
||||
u32 interlock_data, u32 heads, struct nv50_wndw **);
|
||||
void nv50_wndw_init(struct nv50_wndw *);
|
||||
void nv50_wndw_fini(struct nv50_wndw *);
|
||||
const u32 *format, u32 heads,
|
||||
enum nv50_disp_interlock_type, u32 interlock_data,
|
||||
struct nv50_wndw **);
|
||||
void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
|
||||
struct nv50_wndw_atom *);
|
||||
void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
|
||||
|
||||
@@ -85,6 +85,10 @@
|
||||
#define ACPI_DEVFLAG_ATSDIS 0x10000000
|
||||
|
||||
#define LOOP_TIMEOUT 2000000
|
||||
|
||||
#define IVRS_GET_SBDF_ID(seg, bus, dev, fd) (((seg & 0xffff) << 16) | ((bus & 0xff) << 8) \
|
||||
| ((dev & 0x1f) << 3) | (fn & 0x7))
|
||||
|
||||
/*
|
||||
* ACPI table definitions
|
||||
*
|
||||
@@ -3146,24 +3150,32 @@ static int __init parse_amd_iommu_options(char *str)
|
||||
|
||||
static int __init parse_ivrs_ioapic(char *str)
|
||||
{
|
||||
unsigned int bus, dev, fn;
|
||||
int ret, id, i;
|
||||
u16 devid;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
int id, i;
|
||||
u32 devid;
|
||||
|
||||
ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
|
||||
if (sscanf(str, "=%d@%x:%x.%x", &id, &bus, &dev, &fn) == 4 ||
|
||||
sscanf(str, "=%d@%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn) == 5)
|
||||
goto found;
|
||||
|
||||
if (ret != 4) {
|
||||
pr_err("Invalid command line: ivrs_ioapic%s\n", str);
|
||||
return 1;
|
||||
if (sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn) == 4 ||
|
||||
sscanf(str, "[%d]=%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn) == 5) {
|
||||
pr_warn("ivrs_ioapic%s option format deprecated; use ivrs_ioapic=%d@%04x:%02x:%02x.%d instead\n",
|
||||
str, id, seg, bus, dev, fn);
|
||||
goto found;
|
||||
}
|
||||
|
||||
pr_err("Invalid command line: ivrs_ioapic%s\n", str);
|
||||
return 1;
|
||||
|
||||
found:
|
||||
if (early_ioapic_map_size == EARLY_MAP_SIZE) {
|
||||
pr_err("Early IOAPIC map overflow - ignoring ivrs_ioapic%s\n",
|
||||
str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
|
||||
cmdline_maps = true;
|
||||
i = early_ioapic_map_size++;
|
||||
@@ -3176,24 +3188,32 @@ static int __init parse_ivrs_ioapic(char *str)
|
||||
|
||||
static int __init parse_ivrs_hpet(char *str)
|
||||
{
|
||||
unsigned int bus, dev, fn;
|
||||
int ret, id, i;
|
||||
u16 devid;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
int id, i;
|
||||
u32 devid;
|
||||
|
||||
ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
|
||||
if (sscanf(str, "=%d@%x:%x.%x", &id, &bus, &dev, &fn) == 4 ||
|
||||
sscanf(str, "=%d@%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn) == 5)
|
||||
goto found;
|
||||
|
||||
if (ret != 4) {
|
||||
pr_err("Invalid command line: ivrs_hpet%s\n", str);
|
||||
return 1;
|
||||
if (sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn) == 4 ||
|
||||
sscanf(str, "[%d]=%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn) == 5) {
|
||||
pr_warn("ivrs_hpet%s option format deprecated; use ivrs_hpet=%d@%04x:%02x:%02x.%d instead\n",
|
||||
str, id, seg, bus, dev, fn);
|
||||
goto found;
|
||||
}
|
||||
|
||||
pr_err("Invalid command line: ivrs_hpet%s\n", str);
|
||||
return 1;
|
||||
|
||||
found:
|
||||
if (early_hpet_map_size == EARLY_MAP_SIZE) {
|
||||
pr_err("Early HPET map overflow - ignoring ivrs_hpet%s\n",
|
||||
str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
|
||||
cmdline_maps = true;
|
||||
i = early_hpet_map_size++;
|
||||
@@ -3204,19 +3224,53 @@ static int __init parse_ivrs_hpet(char *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define ACPIID_LEN (ACPIHID_UID_LEN + ACPIHID_HID_LEN)
|
||||
|
||||
static int __init parse_ivrs_acpihid(char *str)
|
||||
{
|
||||
u32 bus, dev, fn;
|
||||
char *hid, *uid, *p;
|
||||
char acpiid[ACPIHID_UID_LEN + ACPIHID_HID_LEN] = {0};
|
||||
int ret, i;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
char *hid, *uid, *p, *addr;
|
||||
char acpiid[ACPIID_LEN] = {0};
|
||||
int i;
|
||||
|
||||
ret = sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid);
|
||||
if (ret != 4) {
|
||||
pr_err("Invalid command line: ivrs_acpihid(%s)\n", str);
|
||||
return 1;
|
||||
addr = strchr(str, '@');
|
||||
if (!addr) {
|
||||
addr = strchr(str, '=');
|
||||
if (!addr)
|
||||
goto not_found;
|
||||
|
||||
++addr;
|
||||
|
||||
if (strlen(addr) > ACPIID_LEN)
|
||||
goto not_found;
|
||||
|
||||
if (sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid) == 4 ||
|
||||
sscanf(str, "[%x:%x:%x.%x]=%s", &seg, &bus, &dev, &fn, acpiid) == 5) {
|
||||
pr_warn("ivrs_acpihid%s option format deprecated; use ivrs_acpihid=%s@%04x:%02x:%02x.%d instead\n",
|
||||
str, acpiid, seg, bus, dev, fn);
|
||||
goto found;
|
||||
}
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
/* We have the '@', make it the terminator to get just the acpiid */
|
||||
*addr++ = 0;
|
||||
|
||||
if (strlen(str) > ACPIID_LEN + 1)
|
||||
goto not_found;
|
||||
|
||||
if (sscanf(str, "=%s", acpiid) != 1)
|
||||
goto not_found;
|
||||
|
||||
if (sscanf(addr, "%x:%x.%x", &bus, &dev, &fn) == 3 ||
|
||||
sscanf(addr, "%x:%x:%x.%x", &seg, &bus, &dev, &fn) == 4)
|
||||
goto found;
|
||||
|
||||
not_found:
|
||||
pr_err("Invalid command line: ivrs_acpihid%s\n", str);
|
||||
return 1;
|
||||
|
||||
found:
|
||||
p = acpiid;
|
||||
hid = strsep(&p, ":");
|
||||
uid = p;
|
||||
@@ -3236,8 +3290,7 @@ static int __init parse_ivrs_acpihid(char *str)
|
||||
i = early_acpihid_map_size++;
|
||||
memcpy(early_acpihid_map[i].hid, hid, strlen(hid));
|
||||
memcpy(early_acpihid_map[i].uid, uid, strlen(uid));
|
||||
early_acpihid_map[i].devid =
|
||||
((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
early_acpihid_map[i].devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
early_acpihid_map[i].cmd_line = true;
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -186,6 +186,9 @@ int intel_pasid_alloc_table(struct device *dev)
|
||||
attach_out:
|
||||
device_attach_pasid_table(info, pasid_table);
|
||||
|
||||
if (!ecap_coherent(info->iommu->ecap))
|
||||
clflush_cache_range(pasid_table->table, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -276,6 +279,10 @@ retry:
|
||||
free_pgtable_page(entries);
|
||||
goto retry;
|
||||
}
|
||||
if (!ecap_coherent(info->iommu->ecap)) {
|
||||
clflush_cache_range(entries, VTD_PAGE_SIZE);
|
||||
clflush_cache_range(&dir[dir_index].val, sizeof(*dir));
|
||||
}
|
||||
}
|
||||
|
||||
return &entries[index];
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#endif
|
||||
|
||||
struct wf_lm75_sensor {
|
||||
int ds1775 : 1;
|
||||
int inited : 1;
|
||||
unsigned int ds1775 : 1;
|
||||
unsigned int inited : 1;
|
||||
struct i2c_client *i2c;
|
||||
struct wf_sensor sens;
|
||||
};
|
||||
|
||||
@@ -273,8 +273,8 @@ struct smu_cpu_power_sensor {
|
||||
struct list_head link;
|
||||
struct wf_sensor *volts;
|
||||
struct wf_sensor *amps;
|
||||
int fake_volts : 1;
|
||||
int quadratic : 1;
|
||||
unsigned int fake_volts : 1;
|
||||
unsigned int quadratic : 1;
|
||||
struct wf_sensor sens;
|
||||
};
|
||||
#define to_smu_cpu_power(c) container_of(c, struct smu_cpu_power_sensor, sens)
|
||||
|
||||
@@ -2776,7 +2776,7 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
|
||||
/* Auto/manual gain */
|
||||
ctrls->auto_gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_AUTOGAIN,
|
||||
0, 1, 1, 1);
|
||||
ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN,
|
||||
ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_ANALOGUE_GAIN,
|
||||
0, 1023, 1, 0);
|
||||
|
||||
ctrls->saturation = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SATURATION,
|
||||
|
||||
@@ -130,6 +130,23 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
|
||||
"gpio-ir-recv-irq", gpio_dev);
|
||||
}
|
||||
|
||||
static int gpio_ir_recv_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev);
|
||||
struct device *pmdev = gpio_dev->pmdev;
|
||||
|
||||
if (pmdev) {
|
||||
pm_runtime_get_sync(pmdev);
|
||||
cpu_latency_qos_remove_request(&gpio_dev->qos);
|
||||
|
||||
pm_runtime_disable(pmdev);
|
||||
pm_runtime_put_noidle(pmdev);
|
||||
pm_runtime_set_suspended(pmdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int gpio_ir_recv_suspend(struct device *dev)
|
||||
{
|
||||
@@ -189,6 +206,7 @@ MODULE_DEVICE_TABLE(of, gpio_ir_recv_of_match);
|
||||
|
||||
static struct platform_driver gpio_ir_recv_driver = {
|
||||
.probe = gpio_ir_recv_probe,
|
||||
.remove = gpio_ir_recv_remove,
|
||||
.driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = of_match_ptr(gpio_ir_recv_of_match),
|
||||
|
||||
@@ -388,6 +388,24 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid,
|
||||
mt7530_write(priv, MT7530_ATA1 + (i * 4), reg[i]);
|
||||
}
|
||||
|
||||
/* Set up switch core clock for MT7530 */
|
||||
static void mt7530_pll_setup(struct mt7530_priv *priv)
|
||||
{
|
||||
/* Disable PLL */
|
||||
core_write(priv, CORE_GSWPLL_GRP1, 0);
|
||||
|
||||
/* Set core clock into 500Mhz */
|
||||
core_write(priv, CORE_GSWPLL_GRP2,
|
||||
RG_GSWPLL_POSDIV_500M(1) |
|
||||
RG_GSWPLL_FBKDIV_500M(25));
|
||||
|
||||
/* Enable PLL */
|
||||
core_write(priv, CORE_GSWPLL_GRP1,
|
||||
RG_GSWPLL_EN_PRE |
|
||||
RG_GSWPLL_POSDIV_200M(2) |
|
||||
RG_GSWPLL_FBKDIV_200M(32));
|
||||
}
|
||||
|
||||
/* Setup TX circuit including relevant PAD and driving */
|
||||
static int
|
||||
mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
|
||||
@@ -448,21 +466,6 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
|
||||
core_clear(priv, CORE_TRGMII_GSW_CLK_CG,
|
||||
REG_GSWCK_EN | REG_TRGMIICK_EN);
|
||||
|
||||
/* Setup core clock for MT7530 */
|
||||
/* Disable PLL */
|
||||
core_write(priv, CORE_GSWPLL_GRP1, 0);
|
||||
|
||||
/* Set core clock into 500Mhz */
|
||||
core_write(priv, CORE_GSWPLL_GRP2,
|
||||
RG_GSWPLL_POSDIV_500M(1) |
|
||||
RG_GSWPLL_FBKDIV_500M(25));
|
||||
|
||||
/* Enable PLL */
|
||||
core_write(priv, CORE_GSWPLL_GRP1,
|
||||
RG_GSWPLL_EN_PRE |
|
||||
RG_GSWPLL_POSDIV_200M(2) |
|
||||
RG_GSWPLL_FBKDIV_200M(32));
|
||||
|
||||
/* Setup the MT7530 TRGMII Tx Clock */
|
||||
core_write(priv, CORE_PLL_GROUP5, RG_LCDDS_PCW_NCPO1(ncpo1));
|
||||
core_write(priv, CORE_PLL_GROUP6, RG_LCDDS_PCW_NCPO0(0));
|
||||
@@ -2163,6 +2166,8 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
|
||||
SYS_CTRL_REG_RST);
|
||||
|
||||
mt7530_pll_setup(priv);
|
||||
|
||||
/* Enable Port 6 only; P5 as GMAC5 which currently is not supported */
|
||||
val = mt7530_read(priv, MT7530_MHWTRAP);
|
||||
val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
|
||||
|
||||
@@ -890,13 +890,13 @@ static void bgmac_chip_reset_idm_config(struct bgmac *bgmac)
|
||||
|
||||
if (iost & BGMAC_BCMA_IOST_ATTACHED) {
|
||||
flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
|
||||
if (!bgmac->has_robosw)
|
||||
if (bgmac->in_init || !bgmac->has_robosw)
|
||||
flags |= BGMAC_BCMA_IOCTL_SW_RESET;
|
||||
}
|
||||
bgmac_clk_enable(bgmac, flags);
|
||||
}
|
||||
|
||||
if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
|
||||
if (iost & BGMAC_BCMA_IOST_ATTACHED && (bgmac->in_init || !bgmac->has_robosw))
|
||||
bgmac_idm_write(bgmac, BCMA_IOCTL,
|
||||
bgmac_idm_read(bgmac, BCMA_IOCTL) &
|
||||
~BGMAC_BCMA_IOCTL_SW_RESET);
|
||||
@@ -1490,6 +1490,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
|
||||
struct net_device *net_dev = bgmac->net_dev;
|
||||
int err;
|
||||
|
||||
bgmac->in_init = true;
|
||||
|
||||
bgmac_chip_intrs_off(bgmac);
|
||||
|
||||
net_dev->irq = bgmac->irq;
|
||||
@@ -1542,6 +1544,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
|
||||
/* Omit FCS from max MTU size */
|
||||
net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN;
|
||||
|
||||
bgmac->in_init = false;
|
||||
|
||||
err = register_netdev(bgmac->net_dev);
|
||||
if (err) {
|
||||
dev_err(bgmac->dev, "Cannot register net device\n");
|
||||
|
||||
@@ -474,6 +474,8 @@ struct bgmac {
|
||||
int irq;
|
||||
u32 int_mask;
|
||||
|
||||
bool in_init;
|
||||
|
||||
/* Current MAC state */
|
||||
int mac_speed;
|
||||
int mac_duplex;
|
||||
|
||||
@@ -2999,7 +2999,7 @@ static int bnxt_alloc_ring(struct bnxt *bp, struct bnxt_ring_mem_info *rmem)
|
||||
|
||||
static void bnxt_free_tpa_info(struct bnxt *bp)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < bp->rx_nr_rings; i++) {
|
||||
struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i];
|
||||
@@ -3007,8 +3007,10 @@ static void bnxt_free_tpa_info(struct bnxt *bp)
|
||||
kfree(rxr->rx_tpa_idx_map);
|
||||
rxr->rx_tpa_idx_map = NULL;
|
||||
if (rxr->rx_tpa) {
|
||||
kfree(rxr->rx_tpa[0].agg_arr);
|
||||
rxr->rx_tpa[0].agg_arr = NULL;
|
||||
for (j = 0; j < bp->max_tpa; j++) {
|
||||
kfree(rxr->rx_tpa[j].agg_arr);
|
||||
rxr->rx_tpa[j].agg_arr = NULL;
|
||||
}
|
||||
}
|
||||
kfree(rxr->rx_tpa);
|
||||
rxr->rx_tpa = NULL;
|
||||
@@ -3017,14 +3019,13 @@ static void bnxt_free_tpa_info(struct bnxt *bp)
|
||||
|
||||
static int bnxt_alloc_tpa_info(struct bnxt *bp)
|
||||
{
|
||||
int i, j, total_aggs = 0;
|
||||
int i, j;
|
||||
|
||||
bp->max_tpa = MAX_TPA;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
if (!bp->max_tpa_v2)
|
||||
return 0;
|
||||
bp->max_tpa = max_t(u16, bp->max_tpa_v2, MAX_TPA_P5);
|
||||
total_aggs = bp->max_tpa * MAX_SKB_FRAGS;
|
||||
}
|
||||
|
||||
for (i = 0; i < bp->rx_nr_rings; i++) {
|
||||
@@ -3038,12 +3039,12 @@ static int bnxt_alloc_tpa_info(struct bnxt *bp)
|
||||
|
||||
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
|
||||
continue;
|
||||
agg = kcalloc(total_aggs, sizeof(*agg), GFP_KERNEL);
|
||||
rxr->rx_tpa[0].agg_arr = agg;
|
||||
if (!agg)
|
||||
return -ENOMEM;
|
||||
for (j = 1; j < bp->max_tpa; j++)
|
||||
rxr->rx_tpa[j].agg_arr = agg + j * MAX_SKB_FRAGS;
|
||||
for (j = 0; j < bp->max_tpa; j++) {
|
||||
agg = kcalloc(MAX_SKB_FRAGS, sizeof(*agg), GFP_KERNEL);
|
||||
if (!agg)
|
||||
return -ENOMEM;
|
||||
rxr->rx_tpa[j].agg_arr = agg;
|
||||
}
|
||||
rxr->rx_tpa_idx_map = kzalloc(sizeof(*rxr->rx_tpa_idx_map),
|
||||
GFP_KERNEL);
|
||||
if (!rxr->rx_tpa_idx_map)
|
||||
|
||||
@@ -3998,6 +3998,8 @@ ice_get_module_eeprom(struct net_device *netdev,
|
||||
* SFP modules only ever use page 0.
|
||||
*/
|
||||
if (page == 0 || !(data[0x2] & 0x4)) {
|
||||
u32 copy_len;
|
||||
|
||||
/* If i2c bus is busy due to slow page change or
|
||||
* link management access, call can fail. This is normal.
|
||||
* So we retry this a few times.
|
||||
@@ -4021,8 +4023,8 @@ ice_get_module_eeprom(struct net_device *netdev,
|
||||
}
|
||||
|
||||
/* Make sure we have enough room for the new block */
|
||||
if ((i + SFF_READ_BLOCK_SIZE) < ee->len)
|
||||
memcpy(data + i, value, SFF_READ_BLOCK_SIZE);
|
||||
copy_len = min_t(u32, SFF_READ_BLOCK_SIZE, ee->len - i);
|
||||
memcpy(data + i, value, copy_len);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -811,6 +811,9 @@ bool is_mcam_entry_enabled(struct rvu *rvu, struct npc_mcam *mcam, int blkaddr,
|
||||
/* CPT APIs */
|
||||
int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot);
|
||||
|
||||
#define NDC_AF_BANK_MASK GENMASK_ULL(7, 0)
|
||||
#define NDC_AF_BANK_LINE_MASK GENMASK_ULL(31, 16)
|
||||
|
||||
/* CN10K RVU */
|
||||
int rvu_set_channels_base(struct rvu *rvu);
|
||||
void rvu_program_channels(struct rvu *rvu);
|
||||
@@ -826,6 +829,8 @@ static inline void rvu_dbg_init(struct rvu *rvu) {}
|
||||
static inline void rvu_dbg_exit(struct rvu *rvu) {}
|
||||
#endif
|
||||
|
||||
int rvu_ndc_fix_locked_cacheline(struct rvu *rvu, int blkaddr);
|
||||
|
||||
/* RVU Switch */
|
||||
void rvu_switch_enable(struct rvu *rvu);
|
||||
void rvu_switch_disable(struct rvu *rvu);
|
||||
|
||||
@@ -196,9 +196,6 @@ enum cpt_eng_type {
|
||||
CPT_IE_TYPE = 3,
|
||||
};
|
||||
|
||||
#define NDC_MAX_BANK(rvu, blk_addr) (rvu_read64(rvu, \
|
||||
blk_addr, NDC_AF_CONST) & 0xFF)
|
||||
|
||||
#define rvu_dbg_NULL NULL
|
||||
#define rvu_dbg_open_NULL NULL
|
||||
|
||||
@@ -1009,6 +1006,7 @@ static int ndc_blk_hits_miss_stats(struct seq_file *s, int idx, int blk_addr)
|
||||
struct nix_hw *nix_hw;
|
||||
struct rvu *rvu;
|
||||
int bank, max_bank;
|
||||
u64 ndc_af_const;
|
||||
|
||||
if (blk_addr == BLKADDR_NDC_NPA0) {
|
||||
rvu = s->private;
|
||||
@@ -1017,7 +1015,8 @@ static int ndc_blk_hits_miss_stats(struct seq_file *s, int idx, int blk_addr)
|
||||
rvu = nix_hw->rvu;
|
||||
}
|
||||
|
||||
max_bank = NDC_MAX_BANK(rvu, blk_addr);
|
||||
ndc_af_const = rvu_read64(rvu, blk_addr, NDC_AF_CONST);
|
||||
max_bank = FIELD_GET(NDC_AF_BANK_MASK, ndc_af_const);
|
||||
for (bank = 0; bank < max_bank; bank++) {
|
||||
seq_printf(s, "BANK:%d\n", bank);
|
||||
seq_printf(s, "\tHits:\t%lld\n",
|
||||
|
||||
@@ -797,6 +797,7 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,
|
||||
struct nix_aq_res_s *result;
|
||||
int timeout = 1000;
|
||||
u64 reg, head;
|
||||
int ret;
|
||||
|
||||
result = (struct nix_aq_res_s *)aq->res->base;
|
||||
|
||||
@@ -820,9 +821,22 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (result->compcode != NIX_AQ_COMP_GOOD)
|
||||
if (result->compcode != NIX_AQ_COMP_GOOD) {
|
||||
/* TODO: Replace this with some error code */
|
||||
if (result->compcode == NIX_AQ_COMP_CTX_FAULT ||
|
||||
result->compcode == NIX_AQ_COMP_LOCKERR ||
|
||||
result->compcode == NIX_AQ_COMP_CTX_POISON) {
|
||||
ret = rvu_ndc_fix_locked_cacheline(rvu, BLKADDR_NDC_NIX0_RX);
|
||||
ret |= rvu_ndc_fix_locked_cacheline(rvu, BLKADDR_NDC_NIX0_TX);
|
||||
ret |= rvu_ndc_fix_locked_cacheline(rvu, BLKADDR_NDC_NIX1_RX);
|
||||
ret |= rvu_ndc_fix_locked_cacheline(rvu, BLKADDR_NDC_NIX1_TX);
|
||||
if (ret)
|
||||
dev_err(rvu->dev,
|
||||
"%s: Not able to unlock cachelines\n", __func__);
|
||||
}
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2018 Marvell.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
@@ -42,9 +42,18 @@ static int npa_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (result->compcode != NPA_AQ_COMP_GOOD)
|
||||
if (result->compcode != NPA_AQ_COMP_GOOD) {
|
||||
/* TODO: Replace this with some error code */
|
||||
if (result->compcode == NPA_AQ_COMP_CTX_FAULT ||
|
||||
result->compcode == NPA_AQ_COMP_LOCKERR ||
|
||||
result->compcode == NPA_AQ_COMP_CTX_POISON) {
|
||||
if (rvu_ndc_fix_locked_cacheline(rvu, BLKADDR_NDC_NPA0))
|
||||
dev_err(rvu->dev,
|
||||
"%s: Not able to unlock cachelines\n", __func__);
|
||||
}
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -545,3 +554,48 @@ void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf)
|
||||
|
||||
npa_ctx_free(rvu, pfvf);
|
||||
}
|
||||
|
||||
/* Due to an Hardware errata, in some corner cases, AQ context lock
|
||||
* operations can result in a NDC way getting into an illegal state
|
||||
* of not valid but locked.
|
||||
*
|
||||
* This API solves the problem by clearing the lock bit of the NDC block.
|
||||
* The operation needs to be done for each line of all the NDC banks.
|
||||
*/
|
||||
int rvu_ndc_fix_locked_cacheline(struct rvu *rvu, int blkaddr)
|
||||
{
|
||||
int bank, max_bank, line, max_line, err;
|
||||
u64 reg, ndc_af_const;
|
||||
|
||||
/* Set the ENABLE bit(63) to '0' */
|
||||
reg = rvu_read64(rvu, blkaddr, NDC_AF_CAMS_RD_INTERVAL);
|
||||
rvu_write64(rvu, blkaddr, NDC_AF_CAMS_RD_INTERVAL, reg & GENMASK_ULL(62, 0));
|
||||
|
||||
/* Poll until the BUSY bits(47:32) are set to '0' */
|
||||
err = rvu_poll_reg(rvu, blkaddr, NDC_AF_CAMS_RD_INTERVAL, GENMASK_ULL(47, 32), true);
|
||||
if (err) {
|
||||
dev_err(rvu->dev, "Timed out while polling for NDC CAM busy bits.\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
ndc_af_const = rvu_read64(rvu, blkaddr, NDC_AF_CONST);
|
||||
max_bank = FIELD_GET(NDC_AF_BANK_MASK, ndc_af_const);
|
||||
max_line = FIELD_GET(NDC_AF_BANK_LINE_MASK, ndc_af_const);
|
||||
for (bank = 0; bank < max_bank; bank++) {
|
||||
for (line = 0; line < max_line; line++) {
|
||||
/* Check if 'cache line valid bit(63)' is not set
|
||||
* but 'cache line lock bit(60)' is set and on
|
||||
* success, reset the lock bit(60).
|
||||
*/
|
||||
reg = rvu_read64(rvu, blkaddr,
|
||||
NDC_AF_BANKX_LINEX_METADATA(bank, line));
|
||||
if (!(reg & BIT_ULL(63)) && (reg & BIT_ULL(60))) {
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NDC_AF_BANKX_LINEX_METADATA(bank, line),
|
||||
reg & ~BIT_ULL(60));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -670,6 +670,7 @@
|
||||
#define NDC_AF_INTR_ENA_W1S (0x00068)
|
||||
#define NDC_AF_INTR_ENA_W1C (0x00070)
|
||||
#define NDC_AF_ACTIVE_PC (0x00078)
|
||||
#define NDC_AF_CAMS_RD_INTERVAL (0x00080)
|
||||
#define NDC_AF_BP_TEST_ENABLE (0x001F8)
|
||||
#define NDC_AF_BP_TEST(a) (0x00200 | (a) << 3)
|
||||
#define NDC_AF_BLK_RST (0x002F0)
|
||||
@@ -685,6 +686,8 @@
|
||||
(0x00F00 | (a) << 5 | (b) << 4)
|
||||
#define NDC_AF_BANKX_HIT_PC(a) (0x01000 | (a) << 3)
|
||||
#define NDC_AF_BANKX_MISS_PC(a) (0x01100 | (a) << 3)
|
||||
#define NDC_AF_BANKX_LINEX_METADATA(a, b) \
|
||||
(0x10000 | (a) << 12 | (b) << 3)
|
||||
|
||||
/* LBK */
|
||||
#define LBK_CONST (0x10ull)
|
||||
|
||||
@@ -363,7 +363,8 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
|
||||
mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||
mcr_new = mcr_cur;
|
||||
mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE |
|
||||
MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK;
|
||||
MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK |
|
||||
MAC_MCR_RX_FIFO_CLR_DIS;
|
||||
|
||||
/* Only update control register when needed! */
|
||||
if (mcr_new != mcr_cur)
|
||||
|
||||
@@ -369,6 +369,7 @@
|
||||
#define MAC_MCR_FORCE_MODE BIT(15)
|
||||
#define MAC_MCR_TX_EN BIT(14)
|
||||
#define MAC_MCR_RX_EN BIT(13)
|
||||
#define MAC_MCR_RX_FIFO_CLR_DIS BIT(12)
|
||||
#define MAC_MCR_BACKOFF_EN BIT(9)
|
||||
#define MAC_MCR_BACKPR_EN BIT(8)
|
||||
#define MAC_MCR_FORCE_RX_FC BIT(5)
|
||||
|
||||
@@ -1262,6 +1262,7 @@ static int stmmac_init_phy(struct net_device *dev)
|
||||
|
||||
phylink_ethtool_get_wol(priv->phylink, &wol);
|
||||
device_set_wakeup_capable(priv->device, !!wol.supported);
|
||||
device_set_wakeup_enable(priv->device, !!wol.wolopts);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -342,6 +342,37 @@ static int lan88xx_config_aneg(struct phy_device *phydev)
|
||||
return genphy_config_aneg(phydev);
|
||||
}
|
||||
|
||||
static void lan88xx_link_change_notify(struct phy_device *phydev)
|
||||
{
|
||||
int temp;
|
||||
|
||||
/* At forced 100 F/H mode, chip may fail to set mode correctly
|
||||
* when cable is switched between long(~50+m) and short one.
|
||||
* As workaround, set to 10 before setting to 100
|
||||
* at forced 100 F/H mode.
|
||||
*/
|
||||
if (!phydev->autoneg && phydev->speed == 100) {
|
||||
/* disable phy interrupt */
|
||||
temp = phy_read(phydev, LAN88XX_INT_MASK);
|
||||
temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
|
||||
phy_write(phydev, LAN88XX_INT_MASK, temp);
|
||||
|
||||
temp = phy_read(phydev, MII_BMCR);
|
||||
temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
|
||||
phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
|
||||
temp |= BMCR_SPEED100;
|
||||
phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
|
||||
|
||||
/* clear pending interrupt generated while workaround */
|
||||
temp = phy_read(phydev, LAN88XX_INT_STS);
|
||||
|
||||
/* enable phy interrupt back */
|
||||
temp = phy_read(phydev, LAN88XX_INT_MASK);
|
||||
temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
|
||||
phy_write(phydev, LAN88XX_INT_MASK, temp);
|
||||
}
|
||||
}
|
||||
|
||||
static struct phy_driver microchip_phy_driver[] = {
|
||||
{
|
||||
.phy_id = 0x0007c130,
|
||||
@@ -355,6 +386,7 @@ static struct phy_driver microchip_phy_driver[] = {
|
||||
|
||||
.config_init = lan88xx_config_init,
|
||||
.config_aneg = lan88xx_config_aneg,
|
||||
.link_change_notify = lan88xx_link_change_notify,
|
||||
|
||||
.config_intr = lan88xx_phy_config_intr,
|
||||
.handle_interrupt = lan88xx_handle_interrupt,
|
||||
|
||||
@@ -3029,8 +3029,6 @@ static int phy_probe(struct device *dev)
|
||||
if (phydrv->flags & PHY_IS_INTERNAL)
|
||||
phydev->is_internal = true;
|
||||
|
||||
mutex_lock(&phydev->lock);
|
||||
|
||||
/* Deassert the reset signal */
|
||||
phy_device_reset(phydev, 0);
|
||||
|
||||
@@ -3098,12 +3096,10 @@ static int phy_probe(struct device *dev)
|
||||
phydev->state = PHY_READY;
|
||||
|
||||
out:
|
||||
/* Assert the reset signal */
|
||||
/* Re-assert the reset signal on error */
|
||||
if (err)
|
||||
phy_device_reset(phydev, 1);
|
||||
|
||||
mutex_unlock(&phydev->lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -3113,9 +3109,7 @@ static int phy_remove(struct device *dev)
|
||||
|
||||
cancel_delayed_work_sync(&phydev->state_queue);
|
||||
|
||||
mutex_lock(&phydev->lock);
|
||||
phydev->state = PHY_DOWN;
|
||||
mutex_unlock(&phydev->lock);
|
||||
|
||||
sfp_bus_del_upstream(phydev->sfp_bus);
|
||||
phydev->sfp_bus = NULL;
|
||||
|
||||
@@ -57,8 +57,6 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
|
||||
|
||||
static int smsc_phy_config_intr(struct phy_device *phydev)
|
||||
{
|
||||
struct smsc_phy_priv *priv = phydev->priv;
|
||||
u16 intmask = 0;
|
||||
int rc;
|
||||
|
||||
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
|
||||
@@ -66,12 +64,10 @@ static int smsc_phy_config_intr(struct phy_device *phydev)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6;
|
||||
if (priv->energy_enable)
|
||||
intmask |= MII_LAN83C185_ISF_INT7;
|
||||
rc = phy_write(phydev, MII_LAN83C185_IM, intmask);
|
||||
rc = phy_write(phydev, MII_LAN83C185_IM,
|
||||
MII_LAN83C185_ISF_INT_PHYLIB_EVENTS);
|
||||
} else {
|
||||
rc = phy_write(phydev, MII_LAN83C185_IM, intmask);
|
||||
rc = phy_write(phydev, MII_LAN83C185_IM, 0);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@@ -83,13 +79,7 @@ static int smsc_phy_config_intr(struct phy_device *phydev)
|
||||
|
||||
static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
|
||||
{
|
||||
int irq_status, irq_enabled;
|
||||
|
||||
irq_enabled = phy_read(phydev, MII_LAN83C185_IM);
|
||||
if (irq_enabled < 0) {
|
||||
phy_error(phydev);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
int irq_status;
|
||||
|
||||
irq_status = phy_read(phydev, MII_LAN83C185_ISF);
|
||||
if (irq_status < 0) {
|
||||
@@ -97,7 +87,7 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
if (!(irq_status & irq_enabled))
|
||||
if (!(irq_status & MII_LAN83C185_ISF_INT_PHYLIB_EVENTS))
|
||||
return IRQ_NONE;
|
||||
|
||||
phy_trigger_machine(phydev);
|
||||
|
||||
@@ -1950,33 +1950,8 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev)
|
||||
static void lan78xx_link_status_change(struct net_device *net)
|
||||
{
|
||||
struct phy_device *phydev = net->phydev;
|
||||
int temp;
|
||||
|
||||
/* At forced 100 F/H mode, chip may fail to set mode correctly
|
||||
* when cable is switched between long(~50+m) and short one.
|
||||
* As workaround, set to 10 before setting to 100
|
||||
* at forced 100 F/H mode.
|
||||
*/
|
||||
if (!phydev->autoneg && (phydev->speed == 100)) {
|
||||
/* disable phy interrupt */
|
||||
temp = phy_read(phydev, LAN88XX_INT_MASK);
|
||||
temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
|
||||
phy_write(phydev, LAN88XX_INT_MASK, temp);
|
||||
|
||||
temp = phy_read(phydev, MII_BMCR);
|
||||
temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
|
||||
phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
|
||||
temp |= BMCR_SPEED100;
|
||||
phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
|
||||
|
||||
/* clear pending interrupt generated while workaround */
|
||||
temp = phy_read(phydev, LAN88XX_INT_STS);
|
||||
|
||||
/* enable phy interrupt back */
|
||||
temp = phy_read(phydev, LAN88XX_INT_MASK);
|
||||
temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
|
||||
phy_write(phydev, LAN88XX_INT_MASK, temp);
|
||||
}
|
||||
phy_print_status(phydev);
|
||||
}
|
||||
|
||||
static int irq_map(struct irq_domain *d, unsigned int irq,
|
||||
|
||||
@@ -249,6 +249,9 @@ static void fdp_nci_i2c_read_device_properties(struct device *dev,
|
||||
len, sizeof(**fw_vsc_cfg),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!*fw_vsc_cfg)
|
||||
goto alloc_err;
|
||||
|
||||
r = device_property_read_u8_array(dev, FDP_DP_FW_VSC_CFG_NAME,
|
||||
*fw_vsc_cfg, len);
|
||||
|
||||
@@ -262,6 +265,7 @@ vsc_read_err:
|
||||
*fw_vsc_cfg = NULL;
|
||||
}
|
||||
|
||||
alloc_err:
|
||||
dev_dbg(dev, "Clock type: %d, clock frequency: %d, VSC: %s",
|
||||
*clock_type, *clock_freq, *fw_vsc_cfg != NULL ? "yes" : "no");
|
||||
}
|
||||
|
||||
@@ -943,7 +943,8 @@ config I2C_MULTI_INSTANTIATE
|
||||
|
||||
config MLX_PLATFORM
|
||||
tristate "Mellanox Technologies platform support"
|
||||
depends on I2C && REGMAP
|
||||
depends on I2C
|
||||
select REGMAP
|
||||
help
|
||||
This option enables system support for the Mellanox Technologies
|
||||
platform. The Mellanox systems provide data center networking
|
||||
|
||||
@@ -1521,6 +1521,27 @@ static int set_machine_constraints(struct regulator_dev *rdev)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no mechanism for controlling the regulator then
|
||||
* flag it as always_on so we don't end up duplicating checks
|
||||
* for this so much. Note that we could control the state of
|
||||
* a supply to control the output on a regulator that has no
|
||||
* direct control.
|
||||
*/
|
||||
if (!rdev->ena_pin && !ops->enable) {
|
||||
if (rdev->supply_name && !rdev->supply)
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
if (rdev->supply)
|
||||
rdev->constraints->always_on =
|
||||
rdev->supply->rdev->constraints->always_on;
|
||||
else
|
||||
rdev->constraints->always_on = true;
|
||||
}
|
||||
|
||||
if (rdev->desc->off_on_delay)
|
||||
rdev->last_off = ktime_get_boottime();
|
||||
|
||||
/* If the constraints say the regulator should be on at this point
|
||||
* and we have control then make sure it is enabled.
|
||||
*/
|
||||
@@ -1554,8 +1575,6 @@ static int set_machine_constraints(struct regulator_dev *rdev)
|
||||
|
||||
if (rdev->constraints->always_on)
|
||||
rdev->use_count++;
|
||||
} else if (rdev->desc->off_on_delay) {
|
||||
rdev->last_off = ktime_get();
|
||||
}
|
||||
|
||||
print_constraints(rdev);
|
||||
@@ -2610,7 +2629,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
|
||||
* this regulator was disabled.
|
||||
*/
|
||||
ktime_t end = ktime_add_us(rdev->last_off, rdev->desc->off_on_delay);
|
||||
s64 remaining = ktime_us_delta(end, ktime_get());
|
||||
s64 remaining = ktime_us_delta(end, ktime_get_boottime());
|
||||
|
||||
if (remaining > 0)
|
||||
_regulator_enable_delay(remaining);
|
||||
@@ -2849,7 +2868,7 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
|
||||
}
|
||||
|
||||
if (rdev->desc->off_on_delay)
|
||||
rdev->last_off = ktime_get();
|
||||
rdev->last_off = ktime_get_boottime();
|
||||
|
||||
trace_regulator_disable_complete(rdev_get_name(rdev));
|
||||
|
||||
|
||||
@@ -180,6 +180,7 @@ void scsi_remove_host(struct Scsi_Host *shost)
|
||||
scsi_forget_host(shost);
|
||||
mutex_unlock(&shost->scan_mutex);
|
||||
scsi_proc_host_rm(shost);
|
||||
scsi_proc_hostdir_rm(shost->hostt);
|
||||
|
||||
spin_lock_irqsave(shost->host_lock, flags);
|
||||
if (scsi_host_set_state(shost, SHOST_DEL))
|
||||
@@ -321,6 +322,7 @@ static void scsi_host_dev_release(struct device *dev)
|
||||
struct Scsi_Host *shost = dev_to_shost(dev);
|
||||
struct device *parent = dev->parent;
|
||||
|
||||
/* In case scsi_remove_host() has not been called. */
|
||||
scsi_proc_hostdir_rm(shost->hostt);
|
||||
|
||||
/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
|
||||
|
||||
@@ -1517,6 +1517,8 @@ struct megasas_ctrl_info {
|
||||
#define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
|
||||
MEGASAS_MAX_DEV_PER_CHANNEL)
|
||||
|
||||
#define MEGASAS_MAX_SUPPORTED_LD_IDS 240
|
||||
|
||||
#define MEGASAS_MAX_SECTORS (2*1024)
|
||||
#define MEGASAS_MAX_SECTORS_IEEE (2*128)
|
||||
#define MEGASAS_DBG_LVL 1
|
||||
|
||||
@@ -358,7 +358,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
|
||||
ld = MR_TargetIdToLdGet(i, drv_map);
|
||||
|
||||
/* For non existing VDs, iterate to next VD*/
|
||||
if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
|
||||
if (ld >= MEGASAS_MAX_SUPPORTED_LD_IDS)
|
||||
continue;
|
||||
|
||||
raid = MR_LdRaidGet(ld, drv_map);
|
||||
|
||||
@@ -891,7 +891,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
||||
&ie_len,
|
||||
(pbss_network->ie_length - _BEACON_IE_OFFSET_)
|
||||
);
|
||||
if (p != NULL) {
|
||||
if (p) {
|
||||
memcpy(supportRate, p + 2, ie_len);
|
||||
supportRateNum = ie_len;
|
||||
}
|
||||
@@ -903,7 +903,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
||||
&ie_len,
|
||||
pbss_network->ie_length - _BEACON_IE_OFFSET_
|
||||
);
|
||||
if (p != NULL) {
|
||||
if (p) {
|
||||
memcpy(supportRate + supportRateNum, p + 2, ie_len);
|
||||
supportRateNum += ie_len;
|
||||
}
|
||||
@@ -991,7 +991,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p == NULL) || (ie_len == 0))
|
||||
if (!p || ie_len == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p == NULL) || (ie_len == 0))
|
||||
if (!p || ie_len == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
|
||||
psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->mac_address);
|
||||
if (!psta) {
|
||||
psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->mac_address);
|
||||
if (psta == NULL)
|
||||
if (!psta)
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
@@ -1275,7 +1275,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
|
||||
}
|
||||
|
||||
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
|
||||
if (psetstakey_para == NULL) {
|
||||
if (!psetstakey_para) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1311,12 +1311,12 @@ static int rtw_ap_set_key(
|
||||
int res = _SUCCESS;
|
||||
|
||||
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd == NULL) {
|
||||
if (!pcmd) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
|
||||
if (psetkeyparm == NULL) {
|
||||
if (!psetkeyparm) {
|
||||
kfree(pcmd);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1474,11 +1474,11 @@ static void update_bcn_wps_ie(struct adapter *padapter)
|
||||
&wps_ielen
|
||||
);
|
||||
|
||||
if (pwps_ie == NULL || wps_ielen == 0)
|
||||
if (!pwps_ie || wps_ielen == 0)
|
||||
return;
|
||||
|
||||
pwps_ie_src = pmlmepriv->wps_beacon_ie;
|
||||
if (pwps_ie_src == NULL)
|
||||
if (!pwps_ie_src)
|
||||
return;
|
||||
|
||||
wps_offset = (uint)(pwps_ie - ie);
|
||||
|
||||
@@ -251,7 +251,7 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
|
||||
{
|
||||
unsigned long irqL;
|
||||
|
||||
if (obj == NULL)
|
||||
if (!obj)
|
||||
goto exit;
|
||||
|
||||
/* spin_lock_bh(&queue->lock); */
|
||||
@@ -319,7 +319,7 @@ int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
|
||||
int res = _FAIL;
|
||||
struct adapter *padapter = pcmdpriv->padapter;
|
||||
|
||||
if (cmd_obj == NULL)
|
||||
if (!cmd_obj)
|
||||
goto exit;
|
||||
|
||||
cmd_obj->padapter = padapter;
|
||||
@@ -484,7 +484,7 @@ post_process:
|
||||
/* call callback function for post-processed */
|
||||
if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) {
|
||||
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
|
||||
if (pcmd_callback == NULL) {
|
||||
if (!pcmd_callback) {
|
||||
rtw_free_cmd_obj(pcmd);
|
||||
} else {
|
||||
/* todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!= NULL) */
|
||||
@@ -503,7 +503,7 @@ post_process:
|
||||
/* free all cmd_obj resources */
|
||||
do {
|
||||
pcmd = rtw_dequeue_cmd(pcmdpriv);
|
||||
if (pcmd == NULL) {
|
||||
if (!pcmd) {
|
||||
rtw_unregister_cmd_alive(padapter);
|
||||
break;
|
||||
}
|
||||
@@ -542,11 +542,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
|
||||
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL)
|
||||
if (!ph2c)
|
||||
return _FAIL;
|
||||
|
||||
psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm));
|
||||
if (psurveyPara == NULL) {
|
||||
if (!psurveyPara) {
|
||||
kfree(ph2c);
|
||||
return _FAIL;
|
||||
}
|
||||
@@ -604,13 +604,13 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm));
|
||||
if (pbsetdataratepara == NULL) {
|
||||
if (!pbsetdataratepara) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -640,7 +640,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd == NULL) {
|
||||
if (!pcmd) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -673,7 +673,7 @@ int rtw_startbss_cmd(struct adapter *padapter, int flags)
|
||||
} else {
|
||||
/* need enqueue, prepare cmd_obj and enqueue */
|
||||
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd == NULL) {
|
||||
if (!pcmd) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -725,7 +725,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
|
||||
u8 *ptmp = NULL;
|
||||
|
||||
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd == NULL) {
|
||||
if (!pcmd) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -837,7 +837,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
|
||||
|
||||
/* prepare cmd parameter */
|
||||
param = rtw_zmalloc(sizeof(*param));
|
||||
if (param == NULL) {
|
||||
if (!param) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -846,7 +846,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
|
||||
if (enqueue) {
|
||||
/* need enqueue, prepare cmd_obj and enqueue */
|
||||
cmdobj = rtw_zmalloc(sizeof(*cmdobj));
|
||||
if (cmdobj == NULL) {
|
||||
if (!cmdobj) {
|
||||
res = _FAIL;
|
||||
kfree(param);
|
||||
goto exit;
|
||||
@@ -874,7 +874,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrast
|
||||
|
||||
psetop = rtw_zmalloc(sizeof(struct setopmode_parm));
|
||||
|
||||
if (psetop == NULL) {
|
||||
if (!psetop) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -882,7 +882,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrast
|
||||
|
||||
if (enqueue) {
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
kfree(psetop);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -910,7 +910,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
|
||||
if (psetstakey_para == NULL) {
|
||||
if (!psetstakey_para) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -932,14 +932,14 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
|
||||
|
||||
if (enqueue) {
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
kfree(psetstakey_para);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp));
|
||||
if (psetstakey_rsp == NULL) {
|
||||
if (!psetstakey_rsp) {
|
||||
kfree(ph2c);
|
||||
kfree(psetstakey_para);
|
||||
res = _FAIL;
|
||||
@@ -977,20 +977,20 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu
|
||||
}
|
||||
} else {
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
|
||||
if (psetstakey_para == NULL) {
|
||||
if (!psetstakey_para) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp));
|
||||
if (psetstakey_rsp == NULL) {
|
||||
if (!psetstakey_rsp) {
|
||||
kfree(ph2c);
|
||||
kfree(psetstakey_para);
|
||||
res = _FAIL;
|
||||
@@ -1022,13 +1022,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
paddbareq_parm = rtw_zmalloc(sizeof(struct addBaReq_parm));
|
||||
if (paddbareq_parm == NULL) {
|
||||
if (!paddbareq_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1054,13 +1054,13 @@ u8 rtw_reset_securitypriv_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1089,13 +1089,13 @@ u8 rtw_free_assoc_resources_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1125,13 +1125,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
|
||||
|
||||
/* only primary padapter does this cmd */
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1173,7 +1173,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue, u8 swconf
|
||||
|
||||
/* prepare cmd parameter */
|
||||
setChannelPlan_param = rtw_zmalloc(sizeof(struct SetChannelPlan_param));
|
||||
if (setChannelPlan_param == NULL) {
|
||||
if (!setChannelPlan_param) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -1182,7 +1182,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue, u8 swconf
|
||||
if (enqueue) {
|
||||
/* need enqueue, prepare cmd_obj and enqueue */
|
||||
pcmdobj = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmdobj == NULL) {
|
||||
if (!pcmdobj) {
|
||||
kfree(setChannelPlan_param);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1432,13 +1432,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)
|
||||
|
||||
if (enqueue) {
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1474,13 +1474,13 @@ u8 rtw_dm_in_lps_wk_cmd(struct adapter *padapter)
|
||||
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1540,13 +1540,13 @@ u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 *psta)
|
||||
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1575,13 +1575,13 @@ u8 rtw_ps_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ppscmd = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ppscmd == NULL) {
|
||||
if (!ppscmd) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ppscmd);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1647,13 +1647,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1741,13 +1741,13 @@ u8 rtw_c2h_packet_wk_cmd(struct adapter *padapter, u8 *pbuf, u16 length)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1776,13 +1776,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
if (!pdrvextra_cmd_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -1957,7 +1957,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
|
||||
struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf;
|
||||
struct wlan_network *tgt_network = &(pmlmepriv->cur_network);
|
||||
|
||||
if (pcmd->parmbuf == NULL)
|
||||
if (!pcmd->parmbuf)
|
||||
goto exit;
|
||||
|
||||
if (pcmd->res != H2C_SUCCESS)
|
||||
@@ -1980,9 +1980,9 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
|
||||
} else {
|
||||
pwlan = rtw_alloc_network(pmlmepriv);
|
||||
spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
|
||||
if (pwlan == NULL) {
|
||||
if (!pwlan) {
|
||||
pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue);
|
||||
if (pwlan == NULL) {
|
||||
if (!pwlan) {
|
||||
spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
|
||||
goto createbss_cmd_fail;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
u8 res = true;
|
||||
|
||||
if (padapter == NULL) {
|
||||
if (!padapter) {
|
||||
res = false;
|
||||
goto exit;
|
||||
}
|
||||
@@ -481,7 +481,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
|
||||
return 0;
|
||||
|
||||
psta = rtw_get_stainfo(&adapter->stapriv, get_bssid(pmlmepriv));
|
||||
if (psta == NULL)
|
||||
if (!psta)
|
||||
return 0;
|
||||
|
||||
short_GI = query_ra_short_GI(psta);
|
||||
|
||||
@@ -439,7 +439,7 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue)
|
||||
pwlan = list_entry(plist, struct wlan_network, list);
|
||||
|
||||
if (!pwlan->fixed) {
|
||||
if (oldest == NULL || time_after(oldest->last_scanned, pwlan->last_scanned))
|
||||
if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned))
|
||||
oldest = pwlan;
|
||||
}
|
||||
}
|
||||
@@ -542,7 +542,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t
|
||||
/* TODO: don't select network in the same ess as oldest if it's new enough*/
|
||||
}
|
||||
|
||||
if (oldest == NULL || time_after(oldest->last_scanned, pnetwork->last_scanned))
|
||||
if (!oldest || time_after(oldest->last_scanned, pnetwork->last_scanned))
|
||||
oldest = pnetwork;
|
||||
|
||||
}
|
||||
@@ -1816,7 +1816,7 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (*candidate == NULL || (*candidate)->network.rssi < competitor->network.rssi) {
|
||||
if (!*candidate || (*candidate)->network.rssi < competitor->network.rssi) {
|
||||
*candidate = competitor;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
@@ -742,11 +742,11 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
}
|
||||
|
||||
pstat = rtw_get_stainfo(pstapriv, sa);
|
||||
if (pstat == NULL) {
|
||||
if (!pstat) {
|
||||
|
||||
/* allocate a new one */
|
||||
pstat = rtw_alloc_stainfo(pstapriv, sa);
|
||||
if (pstat == NULL) {
|
||||
if (!pstat) {
|
||||
status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
|
||||
goto auth_fail;
|
||||
}
|
||||
@@ -814,7 +814,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, WLAN_EID_CHALLENGE, (int *)&ie_len,
|
||||
len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4);
|
||||
|
||||
if ((p == NULL) || (ie_len <= 0)) {
|
||||
if (!p || ie_len <= 0) {
|
||||
status = WLAN_STATUS_CHALLENGE_FAIL;
|
||||
goto auth_fail;
|
||||
}
|
||||
@@ -1034,7 +1034,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
|
||||
/* check if the supported rate is ok */
|
||||
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_SUPP_RATES, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset);
|
||||
if (p == NULL) {
|
||||
if (!p) {
|
||||
/* use our own rate set as statoin used */
|
||||
/* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */
|
||||
/* supportRateNum = AP_BSSRATE_LEN; */
|
||||
@@ -1047,7 +1047,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
|
||||
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_EXT_SUPP_RATES, &ie_len,
|
||||
pkt_len - WLAN_HDR_A3_LEN - ie_offset);
|
||||
if (p != NULL) {
|
||||
if (p) {
|
||||
|
||||
if (supportRateNum <= sizeof(supportRate)) {
|
||||
memcpy(supportRate+supportRateNum, p+2, ie_len);
|
||||
@@ -1294,7 +1294,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
/* get a unique AID */
|
||||
if (pstat->aid == 0) {
|
||||
for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++)
|
||||
if (pstapriv->sta_aid[pstat->aid - 1] == NULL)
|
||||
if (!pstapriv->sta_aid[pstat->aid - 1])
|
||||
break;
|
||||
|
||||
/* if (pstat->aid > NUM_STA) { */
|
||||
@@ -1940,7 +1940,7 @@ static struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool
|
||||
goto exit;
|
||||
|
||||
pxmitbuf = rtw_alloc_xmitbuf_ext(pxmitpriv);
|
||||
if (pxmitbuf == NULL) {
|
||||
if (!pxmitbuf) {
|
||||
rtw_free_xmitframe(pxmitpriv, pmgntframe);
|
||||
pmgntframe = NULL;
|
||||
goto exit;
|
||||
@@ -2293,7 +2293,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
|
||||
struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network);
|
||||
unsigned int rate_len;
|
||||
|
||||
if (da == NULL)
|
||||
if (!da)
|
||||
return;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
@@ -2617,7 +2617,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short
|
||||
__le16 le_tmp;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
if (!pmgntframe)
|
||||
return;
|
||||
|
||||
/* update attribute */
|
||||
@@ -2748,7 +2748,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
|
||||
__le16 lestatus, le_tmp;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
if (!pmgntframe)
|
||||
return;
|
||||
|
||||
/* update attribute */
|
||||
@@ -2836,7 +2836,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
|
||||
break;
|
||||
}
|
||||
|
||||
if ((pbuf == NULL) || (ie_len == 0)) {
|
||||
if (!pbuf || ie_len == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2880,7 +2880,7 @@ void issue_assocreq(struct adapter *padapter)
|
||||
u8 vs_ie_length = 0;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
if (!pmgntframe)
|
||||
goto exit;
|
||||
|
||||
/* update attribute */
|
||||
@@ -3057,7 +3057,7 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da,
|
||||
pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
if (!pmgntframe)
|
||||
goto exit;
|
||||
|
||||
/* update attribute */
|
||||
@@ -3196,7 +3196,7 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da,
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL)
|
||||
if (!pmgntframe)
|
||||
goto exit;
|
||||
|
||||
/* update attribute */
|
||||
@@ -3309,7 +3309,7 @@ static int _issue_deauth(struct adapter *padapter, unsigned char *da,
|
||||
__le16 le_tmp;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL) {
|
||||
if (!pmgntframe) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -3635,7 +3635,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
|
||||
action = ACT_PUBLIC_BSSCOEXIST;
|
||||
|
||||
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (pmgntframe == NULL) {
|
||||
if (!pmgntframe) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3702,7 +3702,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
|
||||
pbss_network = (struct wlan_bssid_ex *)&pnetwork->network;
|
||||
|
||||
p = rtw_get_ie(pbss_network->ies + _FIXED_IE_LENGTH_, WLAN_EID_HT_CAPABILITY, &len, pbss_network->ie_length - _FIXED_IE_LENGTH_);
|
||||
if ((p == NULL) || (len == 0)) {/* non-HT */
|
||||
if (!p || len == 0) {/* non-HT */
|
||||
|
||||
if (pbss_network->configuration.ds_config <= 0)
|
||||
continue;
|
||||
@@ -3765,7 +3765,7 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr)
|
||||
return _SUCCESS;
|
||||
|
||||
psta = rtw_get_stainfo(pstapriv, addr);
|
||||
if (psta == NULL)
|
||||
if (!psta)
|
||||
return _SUCCESS;
|
||||
|
||||
if (initiator == 0) {/* recipient */
|
||||
@@ -4637,13 +4637,13 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi
|
||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||
|
||||
pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd_obj == NULL) {
|
||||
if (!pcmd_obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header));
|
||||
pevtcmd = rtw_zmalloc(cmdsz);
|
||||
if (pevtcmd == NULL) {
|
||||
if (!pevtcmd) {
|
||||
kfree(pcmd_obj);
|
||||
return;
|
||||
}
|
||||
@@ -4689,12 +4689,12 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int
|
||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||
|
||||
pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd_obj == NULL)
|
||||
if (!pcmd_obj)
|
||||
return;
|
||||
|
||||
cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header));
|
||||
pevtcmd = rtw_zmalloc(cmdsz);
|
||||
if (pevtcmd == NULL) {
|
||||
if (!pevtcmd) {
|
||||
kfree(pcmd_obj);
|
||||
return;
|
||||
}
|
||||
@@ -5143,12 +5143,12 @@ void survey_timer_hdl(struct timer_list *t)
|
||||
}
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
goto exit_survey_timer_hdl;
|
||||
}
|
||||
|
||||
psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm));
|
||||
if (psurveyPara == NULL) {
|
||||
if (!psurveyPara) {
|
||||
kfree(ph2c);
|
||||
goto exit_survey_timer_hdl;
|
||||
}
|
||||
@@ -5777,7 +5777,7 @@ u8 chk_bmc_sleepq_cmd(struct adapter *padapter)
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -5801,13 +5801,13 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
|
||||
int len_diff = 0;
|
||||
|
||||
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
if (!ph2c) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ptxBeacon_parm = rtw_zmalloc(sizeof(struct Tx_Beacon_param));
|
||||
if (ptxBeacon_parm == NULL) {
|
||||
if (!ptxBeacon_parm) {
|
||||
kfree(ph2c);
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
@@ -5867,7 +5867,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
|
||||
void (*event_callback)(struct adapter *dev, u8 *pbuf);
|
||||
struct evt_priv *pevt_priv = &(padapter->evtpriv);
|
||||
|
||||
if (pbuf == NULL)
|
||||
if (!pbuf)
|
||||
goto _abort_event_;
|
||||
|
||||
peventbuf = (uint *)pbuf;
|
||||
|
||||
@@ -51,7 +51,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
struct arc4_ctx *ctx = &psecuritypriv->xmit_arc4_ctx;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
if (!((struct xmit_frame *)pxmitframe)->buf_addr)
|
||||
return;
|
||||
|
||||
hw_hdr_offset = TXDESC_OFFSET;
|
||||
@@ -476,7 +476,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
struct arc4_ctx *ctx = &psecuritypriv->xmit_arc4_ctx;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
if (!((struct xmit_frame *)pxmitframe)->buf_addr)
|
||||
return _FAIL;
|
||||
|
||||
hw_hdr_offset = TXDESC_OFFSET;
|
||||
@@ -1043,7 +1043,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
if (!((struct xmit_frame *)pxmitframe)->buf_addr)
|
||||
return _FAIL;
|
||||
|
||||
hw_hdr_offset = TXDESC_OFFSET;
|
||||
|
||||
@@ -107,13 +107,13 @@ struct security_priv {
|
||||
|
||||
u32 dot118021XGrpPrivacy; /* This specify the privacy algthm. used for Grp key */
|
||||
u32 dot118021XGrpKeyid; /* key id used for Grp Key (tx key index) */
|
||||
union Keytype dot118021XGrpKey[BIP_MAX_KEYID]; /* 802.1x Group Key, for inx0 and inx1 */
|
||||
union Keytype dot118021XGrptxmickey[BIP_MAX_KEYID];
|
||||
union Keytype dot118021XGrprxmickey[BIP_MAX_KEYID];
|
||||
union Keytype dot118021XGrpKey[BIP_MAX_KEYID + 1]; /* 802.1x Group Key, for inx0 and inx1 */
|
||||
union Keytype dot118021XGrptxmickey[BIP_MAX_KEYID + 1];
|
||||
union Keytype dot118021XGrprxmickey[BIP_MAX_KEYID + 1];
|
||||
union pn48 dot11Grptxpn; /* PN48 used for Grp Key xmit. */
|
||||
union pn48 dot11Grprxpn; /* PN48 used for Grp Key recv. */
|
||||
u32 dot11wBIPKeyid; /* key id used for BIP Key (tx key index) */
|
||||
union Keytype dot11wBIPKey[6]; /* BIP Key, for index4 and index5 */
|
||||
union Keytype dot11wBIPKey[BIP_MAX_KEYID + 1]; /* BIP Key, for index4 and index5 */
|
||||
union pn48 dot11wBIPtxpn; /* PN48 used for Grp Key xmit. */
|
||||
union pn48 dot11wBIPrxpn; /* PN48 used for Grp Key recv. */
|
||||
|
||||
|
||||
@@ -113,13 +113,10 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
|
||||
struct ieee80211_supported_band *spt_band = NULL;
|
||||
int n_channels, n_bitrates;
|
||||
|
||||
if (band == NL80211_BAND_2GHZ)
|
||||
{
|
||||
if (band == NL80211_BAND_2GHZ) {
|
||||
n_channels = RTW_2G_CHANNELS_NUM;
|
||||
n_bitrates = RTW_G_RATES_NUM;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -135,8 +132,7 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
|
||||
spt_band->n_channels = n_channels;
|
||||
spt_band->n_bitrates = n_bitrates;
|
||||
|
||||
if (band == NL80211_BAND_2GHZ)
|
||||
{
|
||||
if (band == NL80211_BAND_2GHZ) {
|
||||
rtw_2g_channels_init(spt_band->channels);
|
||||
rtw_2g_rates_init(spt_band->bitrates);
|
||||
}
|
||||
@@ -235,8 +231,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
|
||||
{
|
||||
u16 wapi_len = 0;
|
||||
|
||||
if (rtw_get_wapi_ie(pnetwork->network.ies, pnetwork->network.ie_length, NULL, &wapi_len) > 0)
|
||||
{
|
||||
if (rtw_get_wapi_ie(pnetwork->network.ies, pnetwork->network.ie_length, NULL, &wapi_len) > 0) {
|
||||
if (wapi_len > 0)
|
||||
goto exit;
|
||||
}
|
||||
@@ -244,8 +239,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
|
||||
|
||||
/* To reduce PBC Overlap rate */
|
||||
/* spin_lock_bh(&pwdev_priv->scan_req_lock); */
|
||||
if (adapter_wdev_data(padapter)->scan_request)
|
||||
{
|
||||
if (adapter_wdev_data(padapter)->scan_request) {
|
||||
u8 *psr = NULL, sr = 0;
|
||||
struct ndis_802_11_ssid *pssid = &pnetwork->network.ssid;
|
||||
struct cfg80211_scan_request *request = adapter_wdev_data(padapter)->scan_request;
|
||||
@@ -258,14 +252,12 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
|
||||
if (wpsie && wpsielen > 0)
|
||||
psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8 *)(&sr), NULL);
|
||||
|
||||
if (sr != 0)
|
||||
{
|
||||
if (request->n_ssids == 1 && request->n_channels == 1) /* it means under processing WPS */
|
||||
{
|
||||
if (sr != 0) {
|
||||
/* it means under processing WPS */
|
||||
if (request->n_ssids == 1 && request->n_channels == 1) {
|
||||
if (ssids[0].ssid_len != 0 &&
|
||||
(pssid->ssid_length != ssids[0].ssid_len ||
|
||||
memcmp(pssid->ssid, ssids[0].ssid, ssids[0].ssid_len)))
|
||||
{
|
||||
memcmp(pssid->ssid, ssids[0].ssid, ssids[0].ssid_len))) {
|
||||
if (psr)
|
||||
*psr = 0; /* clear sr */
|
||||
}
|
||||
@@ -358,7 +350,7 @@ int rtw_cfg80211_check_bss(struct adapter *padapter)
|
||||
bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel,
|
||||
pnetwork->mac_address, pnetwork->ssid.ssid,
|
||||
pnetwork->ssid.ssid_length,
|
||||
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
||||
IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY);
|
||||
|
||||
cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss);
|
||||
|
||||
@@ -375,23 +367,18 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter)
|
||||
struct ieee80211_channel *chan;
|
||||
|
||||
if (pwdev->iftype != NL80211_IFTYPE_ADHOC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rtw_cfg80211_check_bss(padapter)) {
|
||||
struct wlan_bssid_ex *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
|
||||
struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
|
||||
|
||||
memcpy(&cur_network->network, pnetwork, sizeof(struct wlan_bssid_ex));
|
||||
rtw_cfg80211_inform_bss(padapter, cur_network);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scanned == NULL) {
|
||||
} else {
|
||||
if (!scanned) {
|
||||
rtw_warn_on(1);
|
||||
return;
|
||||
}
|
||||
@@ -432,7 +419,7 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)
|
||||
struct wlan_bssid_ex *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
|
||||
struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
|
||||
|
||||
if (scanned == NULL) {
|
||||
if (!scanned) {
|
||||
rtw_warn_on(1);
|
||||
goto check_bss;
|
||||
}
|
||||
@@ -473,9 +460,7 @@ check_bss:
|
||||
roam_info.resp_ie_len =
|
||||
pmlmepriv->assoc_rsp_len-sizeof(struct ieee80211_hdr_3addr)-6;
|
||||
cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
cfg80211_connect_result(padapter->pnetdev, cur_network->network.mac_address
|
||||
, pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2
|
||||
, pmlmepriv->assoc_req_len-sizeof(struct ieee80211_hdr_3addr)-2
|
||||
@@ -527,51 +512,41 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
param->u.crypt.err = 0;
|
||||
param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
|
||||
|
||||
if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len)
|
||||
{
|
||||
if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
|
||||
param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
|
||||
param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
|
||||
{
|
||||
if (param->u.crypt.idx >= WEP_KEYS)
|
||||
{
|
||||
param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
|
||||
if (param->u.crypt.idx >= WEP_KEYS) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
psta = rtw_get_stainfo(pstapriv, param->sta_addr);
|
||||
if (!psta)
|
||||
/* ret = -EINVAL; */
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && (psta == NULL))
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && !psta)
|
||||
goto exit;
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL))
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) {
|
||||
wep_key_idx = param->u.crypt.idx;
|
||||
wep_key_len = param->u.crypt.key_len;
|
||||
|
||||
if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0))
|
||||
{
|
||||
if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (wep_key_len > 0)
|
||||
{
|
||||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
}
|
||||
|
||||
if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
|
||||
{
|
||||
if (psecuritypriv->bWepDefaultKeyIdxSet == 0) {
|
||||
/* wep default key has not been set, so use this key index as default key. */
|
||||
|
||||
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
|
||||
@@ -579,8 +554,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
|
||||
|
||||
if (wep_key_len == 13)
|
||||
{
|
||||
if (wep_key_len == 13) {
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
|
||||
}
|
||||
@@ -598,24 +572,18 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */
|
||||
{
|
||||
if (param->u.crypt.set_tx == 0) /* group key */
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0)
|
||||
{
|
||||
/* group key */
|
||||
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
/* group key */
|
||||
if (param->u.crypt.set_tx == 0) {
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
|
||||
if (param->u.crypt.key_len == 13)
|
||||
{
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
|
||||
}
|
||||
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "TKIP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
|
||||
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
@@ -627,15 +595,11 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
psecuritypriv->busetkipkey = true;
|
||||
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "CCMP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _AES_;
|
||||
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
|
||||
}
|
||||
|
||||
@@ -648,8 +612,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
|
||||
|
||||
pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
|
||||
if (pbcmc_sta)
|
||||
{
|
||||
if (pbcmc_sta) {
|
||||
pbcmc_sta->ieee8021x_blocked = false;
|
||||
pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */
|
||||
}
|
||||
@@ -660,24 +623,16 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
}
|
||||
|
||||
if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
{
|
||||
if (param->u.crypt.set_tx == 1) /* pairwise key */
|
||||
{
|
||||
if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
if (param->u.crypt.set_tx == 1) { /* pairwise key */
|
||||
memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0)
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
psta->dot118021XPrivacy = _WEP40_;
|
||||
if (param->u.crypt.key_len == 13)
|
||||
{
|
||||
psta->dot118021XPrivacy = _WEP104_;
|
||||
}
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "TKIP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
||||
psta->dot118021XPrivacy = _TKIP_;
|
||||
|
||||
/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
|
||||
@@ -687,14 +642,10 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
psecuritypriv->busetkipkey = true;
|
||||
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "CCMP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
|
||||
psta->dot118021XPrivacy = _AES_;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
psta->dot118021XPrivacy = _NO_PRIVACY_;
|
||||
}
|
||||
|
||||
@@ -704,21 +655,14 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
psta->bpairwise_key_installed = true;
|
||||
|
||||
}
|
||||
else/* group key??? */
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0)
|
||||
{
|
||||
} else { /* group key??? */
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
|
||||
if (param->u.crypt.key_len == 13)
|
||||
{
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
|
||||
}
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "TKIP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
|
||||
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
@@ -730,15 +674,11 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
|
||||
psecuritypriv->busetkipkey = true;
|
||||
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "CCMP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _AES_;
|
||||
|
||||
memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
|
||||
}
|
||||
|
||||
@@ -751,8 +691,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa
|
||||
rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
|
||||
|
||||
pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
|
||||
if (pbcmc_sta)
|
||||
{
|
||||
if (pbcmc_sta) {
|
||||
pbcmc_sta->ieee8021x_blocked = false;
|
||||
pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */
|
||||
}
|
||||
@@ -772,6 +711,7 @@ exit:
|
||||
static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
|
||||
{
|
||||
int ret = 0;
|
||||
u8 max_idx;
|
||||
u32 wep_key_idx, wep_key_len;
|
||||
struct adapter *padapter = rtw_netdev_priv(dev);
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
@@ -780,43 +720,39 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
param->u.crypt.err = 0;
|
||||
param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
|
||||
|
||||
if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len)
|
||||
{
|
||||
if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
|
||||
param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
|
||||
param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff)
|
||||
{
|
||||
if (param->u.crypt.idx >= WEP_KEYS
|
||||
|| param->u.crypt.idx >= BIP_MAX_KEYID
|
||||
)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
} else {
|
||||
{
|
||||
if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff ||
|
||||
param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff ||
|
||||
param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0)
|
||||
{
|
||||
max_idx = WEP_KEYS - 1;
|
||||
else
|
||||
max_idx = BIP_MAX_KEYID;
|
||||
|
||||
if (param->u.crypt.idx > max_idx) {
|
||||
netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx);
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
wep_key_idx = param->u.crypt.idx;
|
||||
wep_key_len = param->u.crypt.key_len;
|
||||
|
||||
if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0))
|
||||
{
|
||||
if (wep_key_len <= 0) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (psecuritypriv->bWepDefaultKeyIdxSet == 0)
|
||||
{
|
||||
if (psecuritypriv->bWepDefaultKeyIdxSet == 0) {
|
||||
/* wep default key has not been set, so use this key index as default key. */
|
||||
|
||||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
@@ -825,8 +761,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
|
||||
|
||||
if (wep_key_len == 13)
|
||||
{
|
||||
if (wep_key_len == 13) {
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
|
||||
}
|
||||
@@ -843,13 +778,11 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */
|
||||
{
|
||||
if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802_1x */
|
||||
struct sta_info *psta, *pbcmc_sta;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) /* sta mode */
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
|
||||
if (psta) {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
@@ -858,18 +791,15 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
|
||||
|
||||
if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
|
||||
(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
|
||||
{
|
||||
(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
|
||||
psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
|
||||
}
|
||||
|
||||
if (param->u.crypt.set_tx == 1)/* pairwise key */
|
||||
{
|
||||
if (param->u.crypt.set_tx == 1) { /* pairwise key */
|
||||
|
||||
memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
|
||||
/* DEBUG_ERR(("\nset key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len)); */
|
||||
memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8);
|
||||
memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8);
|
||||
@@ -879,11 +809,8 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
}
|
||||
|
||||
rtw_setstakey_cmd(padapter, psta, true, true);
|
||||
}
|
||||
else/* group key */
|
||||
{
|
||||
if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0)
|
||||
{
|
||||
} else { /* group key */
|
||||
if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[16]), 8);
|
||||
memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &(param->u.crypt.key[24]), 8);
|
||||
@@ -891,9 +818,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
|
||||
padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
|
||||
rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, true);
|
||||
}
|
||||
else if (strcmp(param->u.crypt.alg, "BIP") == 0)
|
||||
{
|
||||
} else if (strcmp(param->u.crypt.alg, "BIP") == 0) {
|
||||
/* save the IGTK key, length 16 bytes */
|
||||
memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
|
||||
/*
|
||||
@@ -907,25 +832,19 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
||||
}
|
||||
|
||||
pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
|
||||
if (pbcmc_sta == NULL)
|
||||
{
|
||||
if (!pbcmc_sta) {
|
||||
/* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
if (strcmp(param->u.crypt.alg, "none") != 0)
|
||||
pbcmc_sta->ieee8021x_blocked = false;
|
||||
|
||||
if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
|
||||
(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled))
|
||||
{
|
||||
(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) {
|
||||
pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) /* adhoc mode */
|
||||
{
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { /* adhoc mode */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,7 +866,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
|
||||
param_len = sizeof(struct ieee_param) + params->key_len;
|
||||
param = rtw_malloc(param_len);
|
||||
if (param == NULL)
|
||||
if (!param)
|
||||
return -1;
|
||||
|
||||
memset(param, 0, param_len);
|
||||
@@ -983,39 +902,29 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
|
||||
|
||||
if (!mac_addr || is_broadcast_ether_addr(mac_addr))
|
||||
{
|
||||
param->u.crypt.set_tx = 0; /* for wpa/wpa2 group key */
|
||||
} else {
|
||||
else
|
||||
param->u.crypt.set_tx = 1; /* for wpa/wpa2 pairwise key */
|
||||
}
|
||||
|
||||
param->u.crypt.idx = key_index;
|
||||
|
||||
if (params->seq_len && params->seq)
|
||||
{
|
||||
memcpy(param->u.crypt.seq, (u8 *)params->seq, params->seq_len);
|
||||
}
|
||||
|
||||
if (params->key_len && params->key)
|
||||
{
|
||||
if (params->key_len && params->key) {
|
||||
param->u.crypt.key_len = params->key_len;
|
||||
memcpy(param->u.crypt.key, (u8 *)params->key, params->key_len);
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
|
||||
ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
|
||||
}
|
||||
else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
||||
{
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
|
||||
if (mac_addr)
|
||||
memcpy(param->sta_addr, (void *)mac_addr, ETH_ALEN);
|
||||
|
||||
ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
|
||||
}
|
||||
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)
|
||||
{
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
|
||||
ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
|
||||
}
|
||||
|
||||
@@ -1042,8 +951,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
struct adapter *padapter = rtw_netdev_priv(ndev);
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
if (key_index == psecuritypriv->dot11PrivacyKeyIndex)
|
||||
{
|
||||
if (key_index == psecuritypriv->dot11PrivacyKeyIndex) {
|
||||
/* clear the flag of wep default key set. */
|
||||
psecuritypriv->bWepDefaultKeyIdxSet = 0;
|
||||
}
|
||||
@@ -1059,16 +967,14 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
|
||||
struct adapter *padapter = rtw_netdev_priv(ndev);
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) /* set wep default key */
|
||||
{
|
||||
if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) { /* set wep default key */
|
||||
psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
|
||||
|
||||
psecuritypriv->dot11PrivacyKeyIndex = key_index;
|
||||
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
|
||||
if (psecuritypriv->dot11DefKeylen[key_index] == 13)
|
||||
{
|
||||
if (psecuritypriv->dot11DefKeylen[key_index] == 13) {
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
|
||||
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
|
||||
}
|
||||
@@ -1099,16 +1005,14 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
|
||||
}
|
||||
|
||||
psta = rtw_get_stainfo(pstapriv, (u8 *)mac);
|
||||
if (psta == NULL) {
|
||||
if (!psta) {
|
||||
ret = -ENOENT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* for infra./P2PClient mode */
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)
|
||||
)
|
||||
{
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
|
||||
|
||||
if (memcmp((u8 *)mac, cur_network->network.mac_address, ETH_ALEN)) {
|
||||
@@ -1134,9 +1038,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
|
||||
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)
|
||||
|| check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)
|
||||
)
|
||||
{
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
/* TODO: should acquire station info... */
|
||||
}
|
||||
|
||||
@@ -1156,8 +1058,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
int ret = 0;
|
||||
|
||||
if (adapter_to_dvobj(padapter)->processing_dev_remove == true)
|
||||
{
|
||||
if (adapter_to_dvobj(padapter)->processing_dev_remove == true) {
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -1176,8 +1077,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
|
||||
old_type = rtw_wdev->iftype;
|
||||
|
||||
if (old_type != type)
|
||||
{
|
||||
if (old_type != type) {
|
||||
pmlmeext->action_public_rxseq = 0xffff;
|
||||
pmlmeext->action_public_dialog_token = 0xff;
|
||||
}
|
||||
@@ -1199,8 +1099,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
||||
|
||||
rtw_wdev->iftype = type;
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, networkType) == false)
|
||||
{
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, networkType) == false) {
|
||||
rtw_wdev->iftype = old_type;
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
@@ -1240,8 +1139,8 @@ void rtw_cfg80211_unlink_bss(struct adapter *padapter, struct wlan_network *pnet
|
||||
|
||||
bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/,
|
||||
select_network->mac_address, select_network->ssid.ssid,
|
||||
select_network->ssid.ssid_length, 0/*WLAN_CAPABILITY_ESS*/,
|
||||
0/*WLAN_CAPABILITY_ESS*/);
|
||||
select_network->ssid.ssid_length, IEEE80211_BSS_TYPE_ANY,
|
||||
IEEE80211_PRIVACY_ANY);
|
||||
|
||||
if (bss) {
|
||||
cfg80211_unlink_bss(wiphy, bss);
|
||||
@@ -1265,9 +1164,7 @@ void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter)
|
||||
|
||||
/* report network only if the current channel set contains the channel to which this network belongs */
|
||||
if (rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.configuration.ds_config) >= 0
|
||||
&& true == rtw_validate_ssid(&(pnetwork->network.ssid))
|
||||
)
|
||||
{
|
||||
&& true == rtw_validate_ssid(&(pnetwork->network.ssid))) {
|
||||
/* ev =translate_scan(padapter, a, pnetwork, ev, stop); */
|
||||
rtw_cfg80211_inform_bss(padapter, pnetwork);
|
||||
}
|
||||
@@ -1284,13 +1181,10 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b
|
||||
u8 *wps_ie;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
if (len > 0) {
|
||||
wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen);
|
||||
if (wps_ie)
|
||||
{
|
||||
if (pmlmepriv->wps_probe_req_ie)
|
||||
{
|
||||
if (wps_ie) {
|
||||
if (pmlmepriv->wps_probe_req_ie) {
|
||||
pmlmepriv->wps_probe_req_ie_len = 0;
|
||||
kfree(pmlmepriv->wps_probe_req_ie);
|
||||
pmlmepriv->wps_probe_req_ie = NULL;
|
||||
@@ -1328,7 +1222,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
struct rtw_wdev_priv *pwdev_priv;
|
||||
struct mlme_priv *pmlmepriv;
|
||||
|
||||
if (ndev == NULL) {
|
||||
if (!ndev) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
@@ -1342,10 +1236,8 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
pwdev_priv->scan_request = request;
|
||||
spin_unlock_bh(&pwdev_priv->scan_req_lock);
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true)
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS|_FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) {
|
||||
need_indicate_scan_done = true;
|
||||
goto check_need_indicate_scan_done;
|
||||
}
|
||||
@@ -1368,15 +1260,13 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
goto check_need_indicate_scan_done;
|
||||
}
|
||||
|
||||
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true)
|
||||
{
|
||||
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) {
|
||||
static unsigned long lastscantime = 0;
|
||||
unsigned long passtime;
|
||||
|
||||
passtime = jiffies_to_msecs(jiffies - lastscantime);
|
||||
lastscantime = jiffies;
|
||||
if (passtime > 12000)
|
||||
{
|
||||
if (passtime > 12000) {
|
||||
need_indicate_scan_done = true;
|
||||
goto check_need_indicate_scan_done;
|
||||
}
|
||||
@@ -1415,9 +1305,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
} else if (request->n_channels <= 4) {
|
||||
for (j = request->n_channels - 1; j >= 0; j--)
|
||||
for (i = 0; i < survey_times; i++)
|
||||
{
|
||||
memcpy(&ch[j*survey_times+i], &ch[j], sizeof(struct rtw_ieee80211_channel));
|
||||
}
|
||||
_status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times * request->n_channels);
|
||||
} else {
|
||||
_status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0);
|
||||
@@ -1426,14 +1314,11 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||
|
||||
|
||||
if (_status == false)
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
check_need_indicate_scan_done:
|
||||
kfree(ssid);
|
||||
if (need_indicate_scan_done)
|
||||
{
|
||||
if (need_indicate_scan_done) {
|
||||
rtw_cfg80211_surveydone_event_callback(padapter);
|
||||
rtw_cfg80211_indicate_scan_done(padapter, false);
|
||||
}
|
||||
@@ -1459,9 +1344,7 @@ static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32
|
||||
|
||||
|
||||
if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2))
|
||||
{
|
||||
psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1572,7 +1455,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
|
||||
u8 *pwpa, *pwpa2;
|
||||
u8 null_addr[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
if (pie == NULL || !ielen) {
|
||||
if (!pie || !ielen) {
|
||||
/* Treat this as normal case, but need to clear WIFI_UNDER_WPS */
|
||||
_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
|
||||
goto exit;
|
||||
@@ -1584,7 +1467,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
|
||||
}
|
||||
|
||||
buf = rtw_zmalloc(ielen);
|
||||
if (buf == NULL) {
|
||||
if (!buf) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -1620,8 +1503,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
|
||||
if (pairwise_cipher == 0)
|
||||
pairwise_cipher = WPA_CIPHER_NONE;
|
||||
|
||||
switch (group_cipher)
|
||||
{
|
||||
switch (group_cipher) {
|
||||
case WPA_CIPHER_NONE:
|
||||
padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_;
|
||||
padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
|
||||
@@ -1644,8 +1526,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
|
||||
break;
|
||||
}
|
||||
|
||||
switch (pairwise_cipher)
|
||||
{
|
||||
switch (pairwise_cipher) {
|
||||
case WPA_CIPHER_NONE:
|
||||
padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_;
|
||||
padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
|
||||
@@ -1766,8 +1647,7 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
|
||||
|
||||
rtw_wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) == false)
|
||||
{
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) == false) {
|
||||
rtw_wdev->iftype = old_type;
|
||||
ret = -EPERM;
|
||||
goto leave_ibss;
|
||||
@@ -1827,9 +1707,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
|
||||
rtw_scan_abort(padapter);
|
||||
}
|
||||
|
||||
psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
|
||||
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
|
||||
@@ -1874,7 +1753,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
||||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
|
||||
pwep = rtw_malloc(wep_total_len);
|
||||
if (pwep == NULL) {
|
||||
if (!pwep) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -2323,9 +2202,8 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str
|
||||
mon_ndev->ieee80211_ptr = mon_wdev;
|
||||
|
||||
ret = cfg80211_register_netdevice(mon_ndev);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
*ndev = pwdev_priv->pmon_ndev = mon_ndev;
|
||||
memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1);
|
||||
@@ -2438,11 +2316,10 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l
|
||||
rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, WLAN_EID_VENDOR_SPECIFIC, P2P_OUI, 4);
|
||||
rtw_ies_remove_ie(pbuf, &len, _BEACON_IE_OFFSET_, WLAN_EID_VENDOR_SPECIFIC, WFD_OUI, 4);
|
||||
|
||||
if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS) {
|
||||
if (rtw_check_beacon_data(adapter, pbuf, len) == _SUCCESS)
|
||||
ret = 0;
|
||||
} else {
|
||||
else
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
kfree(pbuf);
|
||||
@@ -2711,7 +2588,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
|
||||
struct adapter *padapter;
|
||||
struct rtw_wdev_priv *pwdev_priv;
|
||||
|
||||
if (ndev == NULL) {
|
||||
if (!ndev) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value)
|
||||
static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
|
||||
{
|
||||
int ret = 0;
|
||||
u8 max_idx;
|
||||
u32 wep_key_idx, wep_key_len, wep_total_len;
|
||||
struct ndis_802_11_wep *pwep = NULL;
|
||||
struct adapter *padapter = rtw_netdev_priv(dev);
|
||||
@@ -74,19 +75,22 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
|
||||
param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
|
||||
param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
|
||||
if (param->u.crypt.idx >= WEP_KEYS ||
|
||||
param->u.crypt.idx >= BIP_MAX_KEYID) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
} else {
|
||||
{
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff ||
|
||||
param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff ||
|
||||
param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0)
|
||||
max_idx = WEP_KEYS - 1;
|
||||
else
|
||||
max_idx = BIP_MAX_KEYID;
|
||||
|
||||
if (param->u.crypt.idx > max_idx) {
|
||||
netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx);
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
@@ -98,9 +102,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
wep_key_idx = param->u.crypt.idx;
|
||||
wep_key_len = param->u.crypt.key_len;
|
||||
|
||||
if (wep_key_idx > WEP_KEYS)
|
||||
return -EINVAL;
|
||||
|
||||
if (wep_key_len > 0) {
|
||||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
|
||||
@@ -153,7 +154,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
|
||||
if (psta == NULL) {
|
||||
if (!psta) {
|
||||
/* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */
|
||||
} else {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
@@ -206,7 +207,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
}
|
||||
|
||||
pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
|
||||
if (pbcmc_sta == NULL) {
|
||||
if (!pbcmc_sta) {
|
||||
/* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */
|
||||
} else {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
@@ -236,9 +237,9 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
|
||||
int ret = 0;
|
||||
u8 null_addr[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL)) {
|
||||
if (ielen > MAX_WPA_IE_LEN || !pie) {
|
||||
_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
|
||||
if (pie == NULL)
|
||||
if (!pie)
|
||||
return ret;
|
||||
else
|
||||
return -EINVAL;
|
||||
@@ -246,7 +247,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
|
||||
|
||||
if (ielen) {
|
||||
buf = rtw_zmalloc(ielen);
|
||||
if (buf == NULL) {
|
||||
if (!buf) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -491,7 +492,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
||||
return -EINVAL;
|
||||
|
||||
param = rtw_malloc(p->length);
|
||||
if (param == NULL)
|
||||
if (!param)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(param, p->pointer, p->length)) {
|
||||
@@ -571,7 +572,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && (psta == NULL)) {
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) {
|
||||
/* todo:clear default encryption keys */
|
||||
|
||||
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
|
||||
@@ -583,7 +584,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL)) {
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) {
|
||||
wep_key_idx = param->u.crypt.idx;
|
||||
wep_key_len = param->u.crypt.key_len;
|
||||
|
||||
@@ -1227,7 +1228,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
||||
return -EINVAL;
|
||||
|
||||
param = rtw_malloc(p->length);
|
||||
if (param == NULL)
|
||||
if (!param)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(param, p->pointer, p->length)) {
|
||||
|
||||
@@ -488,7 +488,7 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj)
|
||||
|
||||
padapter = dvobj->padapters;
|
||||
|
||||
if (padapter == NULL)
|
||||
if (!padapter)
|
||||
return;
|
||||
|
||||
pnetdev = padapter->pnetdev;
|
||||
@@ -594,7 +594,7 @@ struct dvobj_priv *devobj_init(void)
|
||||
struct dvobj_priv *pdvobj = NULL;
|
||||
|
||||
pdvobj = rtw_zmalloc(sizeof(*pdvobj));
|
||||
if (pdvobj == NULL)
|
||||
if (!pdvobj)
|
||||
return NULL;
|
||||
|
||||
mutex_init(&pdvobj->hw_init_mutex);
|
||||
|
||||
72
fs/attr.c
72
fs/attr.c
@@ -18,6 +18,70 @@
|
||||
#include <linux/evm.h>
|
||||
#include <linux/ima.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/**
|
||||
* setattr_should_drop_sgid - determine whether the setgid bit needs to be
|
||||
* removed
|
||||
* @mnt_userns: user namespace of the mount @inode was found from
|
||||
* @inode: inode to check
|
||||
*
|
||||
* This function determines whether the setgid bit needs to be removed.
|
||||
* We retain backwards compatibility and require setgid bit to be removed
|
||||
* unconditionally if S_IXGRP is set. Otherwise we have the exact same
|
||||
* requirements as setattr_prepare() and setattr_copy().
|
||||
*
|
||||
* Return: ATTR_KILL_SGID if setgid bit needs to be removed, 0 otherwise.
|
||||
*/
|
||||
int setattr_should_drop_sgid(struct user_namespace *mnt_userns,
|
||||
const struct inode *inode)
|
||||
{
|
||||
umode_t mode = inode->i_mode;
|
||||
|
||||
if (!(mode & S_ISGID))
|
||||
return 0;
|
||||
if (mode & S_IXGRP)
|
||||
return ATTR_KILL_SGID;
|
||||
if (!in_group_or_capable(mnt_userns, inode,
|
||||
i_gid_into_mnt(mnt_userns, inode)))
|
||||
return ATTR_KILL_SGID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* setattr_should_drop_suidgid - determine whether the set{g,u}id bit needs to
|
||||
* be dropped
|
||||
* @mnt_userns: user namespace of the mount @inode was found from
|
||||
* @inode: inode to check
|
||||
*
|
||||
* This function determines whether the set{g,u}id bits need to be removed.
|
||||
* If the setuid bit needs to be removed ATTR_KILL_SUID is returned. If the
|
||||
* setgid bit needs to be removed ATTR_KILL_SGID is returned. If both
|
||||
* set{g,u}id bits need to be removed the corresponding mask of both flags is
|
||||
* returned.
|
||||
*
|
||||
* Return: A mask of ATTR_KILL_S{G,U}ID indicating which - if any - setid bits
|
||||
* to remove, 0 otherwise.
|
||||
*/
|
||||
int setattr_should_drop_suidgid(struct user_namespace *mnt_userns,
|
||||
struct inode *inode)
|
||||
{
|
||||
umode_t mode = inode->i_mode;
|
||||
int kill = 0;
|
||||
|
||||
/* suid always must be killed */
|
||||
if (unlikely(mode & S_ISUID))
|
||||
kill = ATTR_KILL_SUID;
|
||||
|
||||
kill |= setattr_should_drop_sgid(mnt_userns, inode);
|
||||
|
||||
if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
|
||||
return kill;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(setattr_should_drop_suidgid);
|
||||
|
||||
/**
|
||||
* chown_ok - verify permissions to chown inode
|
||||
* @mnt_userns: user namespace of the mount @inode was found from
|
||||
@@ -141,8 +205,7 @@ int setattr_prepare(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||
mapped_gid = i_gid_into_mnt(mnt_userns, inode);
|
||||
|
||||
/* Also check the setgid bit! */
|
||||
if (!in_group_p(mapped_gid) &&
|
||||
!capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
|
||||
if (!in_group_or_capable(mnt_userns, inode, mapped_gid))
|
||||
attr->ia_mode &= ~S_ISGID;
|
||||
}
|
||||
|
||||
@@ -257,8 +320,7 @@ void setattr_copy(struct user_namespace *mnt_userns, struct inode *inode,
|
||||
if (ia_valid & ATTR_MODE) {
|
||||
umode_t mode = attr->ia_mode;
|
||||
kgid_t kgid = i_gid_into_mnt(mnt_userns, inode);
|
||||
if (!in_group_p(kgid) &&
|
||||
!capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
|
||||
if (!in_group_or_capable(mnt_userns, inode, kgid))
|
||||
mode &= ~S_ISGID;
|
||||
inode->i_mode = mode;
|
||||
}
|
||||
@@ -383,7 +445,7 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||
}
|
||||
}
|
||||
if (ia_valid & ATTR_KILL_SGID) {
|
||||
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
|
||||
if (mode & S_ISGID) {
|
||||
if (!(ia_valid & ATTR_MODE)) {
|
||||
ia_valid = attr->ia_valid |= ATTR_MODE;
|
||||
attr->ia_mode = inode->i_mode;
|
||||
|
||||
@@ -1554,7 +1554,8 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
|
||||
|
||||
btrfs_info(fs_info,
|
||||
"reclaiming chunk %llu with %llu%% used %llu%% unusable",
|
||||
bg->start, div_u64(bg->used * 100, bg->length),
|
||||
bg->start,
|
||||
div64_u64(bg->used * 100, bg->length),
|
||||
div64_u64(zone_unusable * 100, bg->length));
|
||||
trace_btrfs_reclaim_block_group(bg);
|
||||
ret = btrfs_relocate_chunk(fs_info, bg->start);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "recoverd.h"
|
||||
#include "dir.h"
|
||||
#include "midcomms.h"
|
||||
#include "lowcomms.h"
|
||||
#include "config.h"
|
||||
#include "memory.h"
|
||||
#include "lock.h"
|
||||
@@ -384,23 +383,23 @@ static int threads_start(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = dlm_scand_start();
|
||||
if (error) {
|
||||
log_print("cannot start dlm_scand thread %d", error);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Thread for sending/receiving messages for all lockspace's */
|
||||
error = dlm_midcomms_start();
|
||||
if (error) {
|
||||
log_print("cannot start dlm lowcomms %d", error);
|
||||
goto scand_fail;
|
||||
log_print("cannot start dlm midcomms %d", error);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = dlm_scand_start();
|
||||
if (error) {
|
||||
log_print("cannot start dlm_scand thread %d", error);
|
||||
goto midcomms_fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
scand_fail:
|
||||
dlm_scand_stop();
|
||||
midcomms_fail:
|
||||
dlm_midcomms_stop();
|
||||
fail:
|
||||
return error;
|
||||
}
|
||||
@@ -705,7 +704,7 @@ int dlm_new_lockspace(const char *name, const char *cluster,
|
||||
if (!ls_count) {
|
||||
dlm_scand_stop();
|
||||
dlm_midcomms_shutdown();
|
||||
dlm_lowcomms_stop();
|
||||
dlm_midcomms_stop();
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&ls_lock);
|
||||
@@ -889,7 +888,7 @@ int dlm_release_lockspace(void *lockspace, int force)
|
||||
if (!error)
|
||||
ls_count--;
|
||||
if (!ls_count)
|
||||
dlm_lowcomms_stop();
|
||||
dlm_midcomms_stop();
|
||||
mutex_unlock(&ls_lock);
|
||||
|
||||
return error;
|
||||
|
||||
@@ -1959,10 +1959,6 @@ static const struct dlm_proto_ops dlm_sctp_ops = {
|
||||
int dlm_lowcomms_start(void)
|
||||
{
|
||||
int error = -EINVAL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++)
|
||||
INIT_HLIST_HEAD(&connection_hash[i]);
|
||||
|
||||
init_local();
|
||||
if (!dlm_local_count) {
|
||||
@@ -1971,8 +1967,6 @@ int dlm_lowcomms_start(void)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
|
||||
|
||||
error = work_start();
|
||||
if (error)
|
||||
goto fail_local;
|
||||
@@ -2011,6 +2005,16 @@ fail:
|
||||
return error;
|
||||
}
|
||||
|
||||
void dlm_lowcomms_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++)
|
||||
INIT_HLIST_HEAD(&connection_hash[i]);
|
||||
|
||||
INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
|
||||
}
|
||||
|
||||
void dlm_lowcomms_exit(void)
|
||||
{
|
||||
struct dlm_node_addr *na, *safe;
|
||||
|
||||
@@ -35,6 +35,7 @@ extern int dlm_allow_conn;
|
||||
int dlm_lowcomms_start(void);
|
||||
void dlm_lowcomms_shutdown(void);
|
||||
void dlm_lowcomms_stop(void);
|
||||
void dlm_lowcomms_init(void);
|
||||
void dlm_lowcomms_exit(void);
|
||||
int dlm_lowcomms_close(int nodeid);
|
||||
struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "user.h"
|
||||
#include "memory.h"
|
||||
#include "config.h"
|
||||
#include "lowcomms.h"
|
||||
#include "midcomms.h"
|
||||
|
||||
static int __init init_dlm(void)
|
||||
{
|
||||
@@ -27,6 +27,8 @@ static int __init init_dlm(void)
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
dlm_midcomms_init();
|
||||
|
||||
error = dlm_lockspace_init();
|
||||
if (error)
|
||||
goto out_mem;
|
||||
@@ -63,6 +65,7 @@ static int __init init_dlm(void)
|
||||
out_lockspace:
|
||||
dlm_lockspace_exit();
|
||||
out_mem:
|
||||
dlm_midcomms_exit();
|
||||
dlm_memory_exit();
|
||||
out:
|
||||
return error;
|
||||
@@ -76,7 +79,7 @@ static void __exit exit_dlm(void)
|
||||
dlm_config_exit();
|
||||
dlm_memory_exit();
|
||||
dlm_lockspace_exit();
|
||||
dlm_lowcomms_exit();
|
||||
dlm_midcomms_exit();
|
||||
dlm_unregister_debugfs();
|
||||
}
|
||||
|
||||
|
||||
@@ -1142,13 +1142,28 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh)
|
||||
}
|
||||
|
||||
int dlm_midcomms_start(void)
|
||||
{
|
||||
return dlm_lowcomms_start();
|
||||
}
|
||||
|
||||
void dlm_midcomms_stop(void)
|
||||
{
|
||||
dlm_lowcomms_stop();
|
||||
}
|
||||
|
||||
void dlm_midcomms_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++)
|
||||
INIT_HLIST_HEAD(&node_hash[i]);
|
||||
|
||||
return dlm_lowcomms_start();
|
||||
dlm_lowcomms_init();
|
||||
}
|
||||
|
||||
void dlm_midcomms_exit(void)
|
||||
{
|
||||
dlm_lowcomms_exit();
|
||||
}
|
||||
|
||||
static void dlm_act_fin_ack_rcv(struct midcomms_node *node)
|
||||
|
||||
@@ -20,6 +20,9 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
|
||||
void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh);
|
||||
int dlm_midcomms_close(int nodeid);
|
||||
int dlm_midcomms_start(void);
|
||||
void dlm_midcomms_stop(void);
|
||||
void dlm_midcomms_init(void);
|
||||
void dlm_midcomms_exit(void);
|
||||
void dlm_midcomms_shutdown(void);
|
||||
void dlm_midcomms_add_member(int nodeid);
|
||||
void dlm_midcomms_remove_member(int nodeid);
|
||||
|
||||
@@ -159,7 +159,6 @@ int ext4_find_inline_data_nolock(struct inode *inode)
|
||||
(void *)ext4_raw_inode(&is.iloc));
|
||||
EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE +
|
||||
le32_to_cpu(is.s.here->e_value_size);
|
||||
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
|
||||
}
|
||||
out:
|
||||
brelse(is.iloc.bh);
|
||||
|
||||
@@ -4580,8 +4580,13 @@ static inline int ext4_iget_extra_inode(struct inode *inode,
|
||||
|
||||
if (EXT4_INODE_HAS_XATTR_SPACE(inode) &&
|
||||
*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
|
||||
int err;
|
||||
|
||||
ext4_set_inode_state(inode, EXT4_STATE_XATTR);
|
||||
return ext4_find_inline_data_nolock(inode);
|
||||
err = ext4_find_inline_data_nolock(inode);
|
||||
if (!err && ext4_has_inline_data(inode))
|
||||
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
|
||||
return err;
|
||||
} else
|
||||
EXT4_I(inode)->i_inline_off = 0;
|
||||
return 0;
|
||||
|
||||
@@ -184,6 +184,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
|
||||
ei_bl->i_flags = 0;
|
||||
inode_set_iversion(inode_bl, 1);
|
||||
i_size_write(inode_bl, 0);
|
||||
EXT4_I(inode_bl)->i_disksize = inode_bl->i_size;
|
||||
inode_bl->i_mode = S_IFREG;
|
||||
if (ext4_has_feature_extents(sb)) {
|
||||
ext4_set_inode_flag(inode_bl, EXT4_INODE_EXTENTS);
|
||||
|
||||
@@ -1595,11 +1595,10 @@ static struct buffer_head *__ext4_find_entry(struct inode *dir,
|
||||
int has_inline_data = 1;
|
||||
ret = ext4_find_inline_entry(dir, fname, res_dir,
|
||||
&has_inline_data);
|
||||
if (has_inline_data) {
|
||||
if (inlined)
|
||||
*inlined = 1;
|
||||
if (inlined)
|
||||
*inlined = has_inline_data;
|
||||
if (has_inline_data)
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ((namelen <= 2) && (name[0] == '.') &&
|
||||
@@ -3660,7 +3659,8 @@ static void ext4_resetent(handle_t *handle, struct ext4_renament *ent,
|
||||
* so the old->de may no longer valid and need to find it again
|
||||
* before reset old inode info.
|
||||
*/
|
||||
old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
|
||||
old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de,
|
||||
&old.inlined);
|
||||
if (IS_ERR(old.bh))
|
||||
retval = PTR_ERR(old.bh);
|
||||
if (!old.bh)
|
||||
@@ -3827,9 +3827,20 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
return retval;
|
||||
}
|
||||
|
||||
old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
|
||||
if (IS_ERR(old.bh))
|
||||
return PTR_ERR(old.bh);
|
||||
/*
|
||||
* We need to protect against old.inode directory getting converted
|
||||
* from inline directory format into a normal one.
|
||||
*/
|
||||
if (S_ISDIR(old.inode->i_mode))
|
||||
inode_lock_nested(old.inode, I_MUTEX_NONDIR2);
|
||||
|
||||
old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de,
|
||||
&old.inlined);
|
||||
if (IS_ERR(old.bh)) {
|
||||
retval = PTR_ERR(old.bh);
|
||||
goto unlock_moved_dir;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for inode number is _not_ due to possible IO errors.
|
||||
* We might rmdir the source, keep it as pwd of some process
|
||||
@@ -3887,8 +3898,10 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
goto end_rename;
|
||||
}
|
||||
retval = ext4_rename_dir_prepare(handle, &old);
|
||||
if (retval)
|
||||
if (retval) {
|
||||
inode_unlock(old.inode);
|
||||
goto end_rename;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we're renaming a file within an inline_data dir and adding or
|
||||
@@ -4017,6 +4030,11 @@ release_bh:
|
||||
brelse(old.dir_bh);
|
||||
brelse(old.bh);
|
||||
brelse(new.bh);
|
||||
|
||||
unlock_moved_dir:
|
||||
if (S_ISDIR(old.inode->i_mode))
|
||||
inode_unlock(old.inode);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,8 @@ static void io_submit_init_bio(struct ext4_io_submit *io,
|
||||
|
||||
static void io_submit_add_bh(struct ext4_io_submit *io,
|
||||
struct inode *inode,
|
||||
struct page *page,
|
||||
struct page *pagecache_page,
|
||||
struct page *bounce_page,
|
||||
struct buffer_head *bh)
|
||||
{
|
||||
int ret;
|
||||
@@ -427,10 +428,11 @@ submit_and_retry:
|
||||
io_submit_init_bio(io, bh);
|
||||
io->io_bio->bi_write_hint = inode->i_write_hint;
|
||||
}
|
||||
ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh));
|
||||
ret = bio_add_page(io->io_bio, bounce_page ?: pagecache_page,
|
||||
bh->b_size, bh_offset(bh));
|
||||
if (ret != bh->b_size)
|
||||
goto submit_and_retry;
|
||||
wbc_account_cgroup_owner(io->io_wbc, page, bh->b_size);
|
||||
wbc_account_cgroup_owner(io->io_wbc, pagecache_page, bh->b_size);
|
||||
io->io_next_block++;
|
||||
}
|
||||
|
||||
@@ -548,8 +550,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
|
||||
do {
|
||||
if (!buffer_async_write(bh))
|
||||
continue;
|
||||
io_submit_add_bh(io, inode,
|
||||
bounce_page ? bounce_page : page, bh);
|
||||
io_submit_add_bh(io, inode, page, bounce_page, bh);
|
||||
nr_submitted++;
|
||||
clear_buffer_dirty(bh);
|
||||
} while ((bh = bh->b_this_page) != head);
|
||||
|
||||
@@ -2789,6 +2789,9 @@ shift:
|
||||
(void *)header, total_ino);
|
||||
EXT4_I(inode)->i_extra_isize = new_extra_isize;
|
||||
|
||||
if (ext4_has_inline_data(inode))
|
||||
error = ext4_find_inline_data_nolock(inode);
|
||||
|
||||
cleanup:
|
||||
if (error && (mnt_count != le16_to_cpu(sbi->s_es->s_mnt_count))) {
|
||||
ext4_warning(inode->i_sb, "Unable to expand inode %lu. Delete some EAs or run e2fsck.",
|
||||
|
||||
@@ -646,6 +646,7 @@ static struct file *pick_file(struct files_struct *files, unsigned fd)
|
||||
file = ERR_PTR(-EINVAL);
|
||||
goto out_unlock;
|
||||
}
|
||||
fd = array_index_nospec(fd, fdt->max_fds);
|
||||
file = fdt->fd[fd];
|
||||
if (!file) {
|
||||
file = ERR_PTR(-EBADF);
|
||||
|
||||
@@ -1345,7 +1345,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||
return err;
|
||||
|
||||
if (fc->handle_killpriv_v2 &&
|
||||
should_remove_suid(file_dentry(file))) {
|
||||
setattr_should_drop_suidgid(&init_user_ns, file_inode(file))) {
|
||||
goto writethrough;
|
||||
}
|
||||
|
||||
|
||||
90
fs/inode.c
90
fs/inode.c
@@ -1864,41 +1864,13 @@ skip_update:
|
||||
}
|
||||
EXPORT_SYMBOL_NS(touch_atime, ANDROID_GKI_VFS_EXPORT_ONLY);
|
||||
|
||||
/*
|
||||
* The logic we want is
|
||||
*
|
||||
* if suid or (sgid and xgrp)
|
||||
* remove privs
|
||||
*/
|
||||
int should_remove_suid(struct dentry *dentry)
|
||||
{
|
||||
umode_t mode = d_inode(dentry)->i_mode;
|
||||
int kill = 0;
|
||||
|
||||
/* suid always must be killed */
|
||||
if (unlikely(mode & S_ISUID))
|
||||
kill = ATTR_KILL_SUID;
|
||||
|
||||
/*
|
||||
* sgid without any exec bits is just a mandatory locking mark; leave
|
||||
* it alone. If some exec bits are set, it's a real sgid; kill it.
|
||||
*/
|
||||
if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
|
||||
kill |= ATTR_KILL_SGID;
|
||||
|
||||
if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
|
||||
return kill;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(should_remove_suid);
|
||||
|
||||
/*
|
||||
* Return mask of changes for notify_change() that need to be done as a
|
||||
* response to write or truncate. Return 0 if nothing has to be changed.
|
||||
* Negative value on error (change should be denied).
|
||||
*/
|
||||
int dentry_needs_remove_privs(struct dentry *dentry)
|
||||
int dentry_needs_remove_privs(struct user_namespace *mnt_userns,
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
int mask = 0;
|
||||
@@ -1907,7 +1879,7 @@ int dentry_needs_remove_privs(struct dentry *dentry)
|
||||
if (IS_NOSEC(inode))
|
||||
return 0;
|
||||
|
||||
mask = should_remove_suid(dentry);
|
||||
mask = setattr_should_drop_suidgid(mnt_userns, inode);
|
||||
ret = security_inode_need_killpriv(dentry);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1949,7 +1921,7 @@ int file_remove_privs(struct file *file)
|
||||
if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode))
|
||||
return 0;
|
||||
|
||||
kill = dentry_needs_remove_privs(dentry);
|
||||
kill = dentry_needs_remove_privs(file_mnt_user_ns(file), dentry);
|
||||
if (kill < 0)
|
||||
return kill;
|
||||
if (kill)
|
||||
@@ -2165,10 +2137,6 @@ void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
|
||||
/* Directories are special, and always inherit S_ISGID */
|
||||
if (S_ISDIR(mode))
|
||||
mode |= S_ISGID;
|
||||
else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
|
||||
!in_group_p(i_gid_into_mnt(mnt_userns, dir)) &&
|
||||
!capable_wrt_inode_uidgid(mnt_userns, dir, CAP_FSETID))
|
||||
mode &= ~S_ISGID;
|
||||
} else
|
||||
inode_fsgid_set(inode, mnt_userns);
|
||||
inode->i_mode = mode;
|
||||
@@ -2324,3 +2292,53 @@ struct timespec64 current_time(struct inode *inode)
|
||||
return timestamp_truncate(now, inode);
|
||||
}
|
||||
EXPORT_SYMBOL(current_time);
|
||||
|
||||
/**
|
||||
* in_group_or_capable - check whether caller is CAP_FSETID privileged
|
||||
* @mnt_userns: user namespace of the mount @inode was found from
|
||||
* @inode: inode to check
|
||||
* @gid: the new/current gid of @inode
|
||||
*
|
||||
* Check wether @gid is in the caller's group list or if the caller is
|
||||
* privileged with CAP_FSETID over @inode. This can be used to determine
|
||||
* whether the setgid bit can be kept or must be dropped.
|
||||
*
|
||||
* Return: true if the caller is sufficiently privileged, false if not.
|
||||
*/
|
||||
bool in_group_or_capable(struct user_namespace *mnt_userns,
|
||||
const struct inode *inode, kgid_t gid)
|
||||
{
|
||||
if (in_group_p(gid))
|
||||
return true;
|
||||
if (capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* mode_strip_sgid - handle the sgid bit for non-directories
|
||||
* @mnt_userns: User namespace of the mount the inode was created from
|
||||
* @dir: parent directory inode
|
||||
* @mode: mode of the file to be created in @dir
|
||||
*
|
||||
* If the @mode of the new file has both the S_ISGID and S_IXGRP bit
|
||||
* raised and @dir has the S_ISGID bit raised ensure that the caller is
|
||||
* either in the group of the parent directory or they have CAP_FSETID
|
||||
* in their user namespace and are privileged over the parent directory.
|
||||
* In all other cases, strip the S_ISGID bit from @mode.
|
||||
*
|
||||
* Return: the new mode to use for the file
|
||||
*/
|
||||
umode_t mode_strip_sgid(struct user_namespace *mnt_userns,
|
||||
const struct inode *dir, umode_t mode)
|
||||
{
|
||||
if ((mode & (S_ISGID | S_IXGRP)) != (S_ISGID | S_IXGRP))
|
||||
return mode;
|
||||
if (S_ISDIR(mode) || !dir || !(dir->i_mode & S_ISGID))
|
||||
return mode;
|
||||
if (in_group_or_capable(mnt_userns, dir,
|
||||
i_gid_into_mnt(mnt_userns, dir)))
|
||||
return mode;
|
||||
return mode & ~S_ISGID;
|
||||
}
|
||||
EXPORT_SYMBOL(mode_strip_sgid);
|
||||
|
||||
@@ -149,7 +149,9 @@ extern int vfs_open(const struct path *, struct file *);
|
||||
*/
|
||||
extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc);
|
||||
extern void inode_add_lru(struct inode *inode);
|
||||
extern int dentry_needs_remove_privs(struct dentry *dentry);
|
||||
int dentry_needs_remove_privs(struct user_namespace *, struct dentry *dentry);
|
||||
bool in_group_or_capable(struct user_namespace *mnt_userns,
|
||||
const struct inode *inode, kgid_t gid);
|
||||
|
||||
/*
|
||||
* fs-writeback.c
|
||||
@@ -229,3 +231,9 @@ struct xattr_ctx {
|
||||
int setxattr_copy(const char __user *name, struct xattr_ctx *ctx);
|
||||
int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||
struct xattr_ctx *ctx);
|
||||
|
||||
/*
|
||||
* fs/attr.c
|
||||
*/
|
||||
int setattr_should_drop_sgid(struct user_namespace *mnt_userns,
|
||||
const struct inode *inode);
|
||||
|
||||
@@ -1901,9 +1901,10 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp,
|
||||
void **priv)
|
||||
{
|
||||
struct inode *inode = locks_inode(filp);
|
||||
kuid_t uid = i_uid_into_mnt(file_mnt_user_ns(filp), inode);
|
||||
int error;
|
||||
|
||||
if ((!uid_eq(current_fsuid(), inode->i_uid)) && !capable(CAP_LEASE))
|
||||
if ((!uid_eq(current_fsuid(), uid)) && !capable(CAP_LEASE))
|
||||
return -EACCES;
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return -EINVAL;
|
||||
|
||||
82
fs/namei.c
82
fs/namei.c
@@ -3000,6 +3000,65 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
|
||||
}
|
||||
EXPORT_SYMBOL(unlock_rename);
|
||||
|
||||
/**
|
||||
* mode_strip_umask - handle vfs umask stripping
|
||||
* @dir: parent directory of the new inode
|
||||
* @mode: mode of the new inode to be created in @dir
|
||||
*
|
||||
* Umask stripping depends on whether or not the filesystem supports POSIX
|
||||
* ACLs. If the filesystem doesn't support it umask stripping is done directly
|
||||
* in here. If the filesystem does support POSIX ACLs umask stripping is
|
||||
* deferred until the filesystem calls posix_acl_create().
|
||||
*
|
||||
* Returns: mode
|
||||
*/
|
||||
static inline umode_t mode_strip_umask(const struct inode *dir, umode_t mode)
|
||||
{
|
||||
if (!IS_POSIXACL(dir))
|
||||
mode &= ~current_umask();
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* vfs_prepare_mode - prepare the mode to be used for a new inode
|
||||
* @mnt_userns: user namespace of the mount the inode was found from
|
||||
* @dir: parent directory of the new inode
|
||||
* @mode: mode of the new inode
|
||||
* @mask_perms: allowed permission by the vfs
|
||||
* @type: type of file to be created
|
||||
*
|
||||
* This helper consolidates and enforces vfs restrictions on the @mode of a new
|
||||
* object to be created.
|
||||
*
|
||||
* Umask stripping depends on whether the filesystem supports POSIX ACLs (see
|
||||
* the kernel documentation for mode_strip_umask()). Moving umask stripping
|
||||
* after setgid stripping allows the same ordering for both non-POSIX ACL and
|
||||
* POSIX ACL supporting filesystems.
|
||||
*
|
||||
* Note that it's currently valid for @type to be 0 if a directory is created.
|
||||
* Filesystems raise that flag individually and we need to check whether each
|
||||
* filesystem can deal with receiving S_IFDIR from the vfs before we enforce a
|
||||
* non-zero type.
|
||||
*
|
||||
* Returns: mode to be passed to the filesystem
|
||||
*/
|
||||
static inline umode_t vfs_prepare_mode(struct user_namespace *mnt_userns,
|
||||
const struct inode *dir, umode_t mode,
|
||||
umode_t mask_perms, umode_t type)
|
||||
{
|
||||
mode = mode_strip_sgid(mnt_userns, dir, mode);
|
||||
mode = mode_strip_umask(dir, mode);
|
||||
|
||||
/*
|
||||
* Apply the vfs mandated allowed permission mask and set the type of
|
||||
* file to be created before we call into the filesystem.
|
||||
*/
|
||||
mode &= (mask_perms & ~S_IFMT);
|
||||
mode |= (type & S_IFMT);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* vfs_create - create new file
|
||||
* @mnt_userns: user namespace of the mount the inode was found from
|
||||
@@ -3025,8 +3084,8 @@ int vfs_create(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
|
||||
if (!dir->i_op->create)
|
||||
return -EACCES; /* shouldn't it be ENOSYS? */
|
||||
mode &= S_IALLUGO;
|
||||
mode |= S_IFREG;
|
||||
|
||||
mode = vfs_prepare_mode(mnt_userns, dir, mode, S_IALLUGO, S_IFREG);
|
||||
error = security_inode_create(dir, dentry, mode);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -3291,8 +3350,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
|
||||
if (open_flag & O_CREAT) {
|
||||
if (open_flag & O_EXCL)
|
||||
open_flag &= ~O_TRUNC;
|
||||
if (!IS_POSIXACL(dir->d_inode))
|
||||
mode &= ~current_umask();
|
||||
mode = vfs_prepare_mode(mnt_userns, dir->d_inode, mode, mode, mode);
|
||||
if (likely(got_write))
|
||||
create_error = may_o_create(mnt_userns, &nd->path,
|
||||
dentry, mode);
|
||||
@@ -3525,8 +3583,7 @@ struct dentry *vfs_tmpfile(struct user_namespace *mnt_userns,
|
||||
child = d_alloc(dentry, &slash_name);
|
||||
if (unlikely(!child))
|
||||
goto out_err;
|
||||
if (!IS_POSIXACL(dir))
|
||||
mode &= ~current_umask();
|
||||
mode = vfs_prepare_mode(mnt_userns, dir, mode, mode, mode);
|
||||
error = dir->i_op->tmpfile(mnt_userns, dir, child, mode);
|
||||
if (error)
|
||||
goto out_err;
|
||||
@@ -3804,6 +3861,7 @@ int vfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
if (!dir->i_op->mknod)
|
||||
return -EPERM;
|
||||
|
||||
mode = vfs_prepare_mode(mnt_userns, dir, mode, mode, mode);
|
||||
error = devcgroup_inode_mknod(mode, dev);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -3854,9 +3912,8 @@ retry:
|
||||
if (IS_ERR(dentry))
|
||||
goto out1;
|
||||
|
||||
if (!IS_POSIXACL(path.dentry->d_inode))
|
||||
mode &= ~current_umask();
|
||||
error = security_path_mknod(&path, dentry, mode, dev);
|
||||
error = security_path_mknod(&path, dentry,
|
||||
mode_strip_umask(path.dentry->d_inode, mode), dev);
|
||||
if (error)
|
||||
goto out2;
|
||||
|
||||
@@ -3926,7 +3983,7 @@ int vfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
if (!dir->i_op->mkdir)
|
||||
return -EPERM;
|
||||
|
||||
mode &= (S_IRWXUGO|S_ISVTX);
|
||||
mode = vfs_prepare_mode(mnt_userns, dir, mode, S_IRWXUGO | S_ISVTX, 0);
|
||||
error = security_inode_mkdir(dir, dentry, mode);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -3954,9 +4011,8 @@ retry:
|
||||
if (IS_ERR(dentry))
|
||||
goto out_putname;
|
||||
|
||||
if (!IS_POSIXACL(path.dentry->d_inode))
|
||||
mode &= ~current_umask();
|
||||
error = security_path_mkdir(&path, dentry, mode);
|
||||
error = security_path_mkdir(&path, dentry,
|
||||
mode_strip_umask(path.dentry->d_inode, mode));
|
||||
if (!error) {
|
||||
struct user_namespace *mnt_userns;
|
||||
mnt_userns = mnt_user_ns(path.mnt);
|
||||
|
||||
@@ -3968,6 +3968,23 @@ static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* mnt_allow_writers() - check whether the attribute change allows writers
|
||||
* @kattr: the new mount attributes
|
||||
* @mnt: the mount to which @kattr will be applied
|
||||
*
|
||||
* Check whether thew new mount attributes in @kattr allow concurrent writers.
|
||||
*
|
||||
* Return: true if writers need to be held, false if not
|
||||
*/
|
||||
static inline bool mnt_allow_writers(const struct mount_kattr *kattr,
|
||||
const struct mount *mnt)
|
||||
{
|
||||
return (!(kattr->attr_set & MNT_READONLY) ||
|
||||
(mnt->mnt.mnt_flags & MNT_READONLY)) &&
|
||||
!kattr->mnt_userns;
|
||||
}
|
||||
|
||||
static struct mount *mount_setattr_prepare(struct mount_kattr *kattr,
|
||||
struct mount *mnt, int *err)
|
||||
{
|
||||
@@ -3998,8 +4015,7 @@ static struct mount *mount_setattr_prepare(struct mount_kattr *kattr,
|
||||
|
||||
last = m;
|
||||
|
||||
if ((kattr->attr_set & MNT_READONLY) &&
|
||||
!(m->mnt.mnt_flags & MNT_READONLY)) {
|
||||
if (!mnt_allow_writers(kattr, m)) {
|
||||
*err = mnt_hold_writers(m);
|
||||
if (*err)
|
||||
goto out;
|
||||
@@ -4050,13 +4066,8 @@ static void mount_setattr_commit(struct mount_kattr *kattr,
|
||||
WRITE_ONCE(m->mnt.mnt_flags, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* We either set MNT_READONLY above so make it visible
|
||||
* before ~MNT_WRITE_HOLD or we failed to recursively
|
||||
* apply mount options.
|
||||
*/
|
||||
if ((kattr->attr_set & MNT_READONLY) &&
|
||||
(m->mnt.mnt_flags & MNT_WRITE_HOLD))
|
||||
/* If we had to hold writers unblock them. */
|
||||
if (m->mnt.mnt_flags & MNT_WRITE_HOLD)
|
||||
mnt_unhold_writers(m);
|
||||
|
||||
if (!err && kattr->propagation)
|
||||
|
||||
@@ -1994,7 +1994,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
|
||||
}
|
||||
}
|
||||
|
||||
if (file && should_remove_suid(file->f_path.dentry)) {
|
||||
if (file && setattr_should_drop_suidgid(&init_user_ns, file_inode(file))) {
|
||||
ret = __ocfs2_write_remove_suid(inode, di_bh);
|
||||
if (ret) {
|
||||
mlog_errno(ret);
|
||||
@@ -2282,7 +2282,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
|
||||
* inode. There's also the dinode i_size state which
|
||||
* can be lost via setattr during extending writes (we
|
||||
* set inode->i_size at the end of a write. */
|
||||
if (should_remove_suid(dentry)) {
|
||||
if (setattr_should_drop_suidgid(&init_user_ns, inode)) {
|
||||
if (meta_level == 0) {
|
||||
ocfs2_inode_unlock_for_extent_tree(inode,
|
||||
&di_bh,
|
||||
|
||||
@@ -197,6 +197,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
|
||||
* callers. */
|
||||
if (S_ISDIR(mode))
|
||||
set_nlink(inode, 2);
|
||||
mode = mode_strip_sgid(&init_user_ns, dir, mode);
|
||||
inode_init_owner(&init_user_ns, inode, dir, mode);
|
||||
status = dquot_initialize(inode);
|
||||
if (status)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user