···7272 if (setsockopt(fd, SOL_SOCKET, SO_ZEROCOPY, &one, sizeof(one)))7373 error(1, errno, "setsockopt zerocopy");74747575+Setting the socket option only works when the socket is in its initial7676+(TCP_CLOSED) state. Trying to set the option for a socket returned by accept(),7777+for example, will lead to an EBUSY error. In this case, the option should be set7878+to the listening socket and it will be inherited by the accepted sockets.75797680Transmission7781------------
···3535 reg = <0x80 0x10>, <0x100 0x10>;3636 #clock-cells = <0>;3737 clocks = <&input_clk>;3838+3939+ /*4040+ * Set initial core pll output frequency to 90MHz.4141+ * It will be applied at the core pll driver probing4242+ * on early boot.4343+ */4444+ assigned-clocks = <&core_clk>;4545+ assigned-clock-rates = <90000000>;3846 };39474048 core_intc: archs-intc@cpu {
+8
arch/arc/boot/dts/axc003_idu.dtsi
···3535 reg = <0x80 0x10>, <0x100 0x10>;3636 #clock-cells = <0>;3737 clocks = <&input_clk>;3838+3939+ /*4040+ * Set initial core pll output frequency to 100MHz.4141+ * It will be applied at the core pll driver probing4242+ * on early boot.4343+ */4444+ assigned-clocks = <&core_clk>;4545+ assigned-clock-rates = <100000000>;3846 };39474048 core_intc: archs-intc@cpu {
+8
arch/arc/boot/dts/hsdk.dts
···114114 reg = <0x00 0x10>, <0x14B8 0x4>;115115 #clock-cells = <0>;116116 clocks = <&input_clk>;117117+118118+ /*119119+ * Set initial core pll output frequency to 1GHz.120120+ * It will be applied at the core pll driver probing121121+ * on early boot.122122+ */123123+ assigned-clocks = <&core_clk>;124124+ assigned-clock-rates = <1000000000>;117125 };118126119127 serial: serial@5000 {
+3-2
arch/arc/configs/hsdk_defconfig
···4949CONFIG_SERIAL_OF_PLATFORM=y5050# CONFIG_HW_RANDOM is not set5151# CONFIG_HWMON is not set5252+CONFIG_DRM=y5353+# CONFIG_DRM_FBDEV_EMULATION is not set5454+CONFIG_DRM_UDL=y5255CONFIG_FB=y5353-CONFIG_FB_UDL=y5456CONFIG_FRAMEBUFFER_CONSOLE=y5555-CONFIG_USB=y5657CONFIG_USB_EHCI_HCD=y5758CONFIG_USB_EHCI_HCD_PLATFORM=y5859CONFIG_USB_OHCI_HCD=y
···199199 unsigned int exec_ctrl;200200201201 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);202202- cpu->extn.dual_enb = exec_ctrl & 1;202202+ cpu->extn.dual_enb = !(exec_ctrl & 1);203203204204 /* dual issue always present for this core */205205 cpu->extn.dual = 1;
+1-1
arch/arc/kernel/stacktrace.c
···163163 */164164static int __print_sym(unsigned int address, void *unused)165165{166166- __print_symbol(" %s\n", address);166166+ printk(" %pS\n", (void *)address);167167 return 0;168168}169169
+14
arch/arc/kernel/traps.c
···8383DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR)8484DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)8585DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)8686+DO_ERROR_INFO(SIGSEGV, "gcc generated __builtin_trap", do_trap5_error, 0)86878788/*8889 * Entry Point for Misaligned Data access Exception, for emulating in software···116115 * Thus TRAP_S <n> can be used for specific purpose117116 * -1 used for software breakpointing (gdb)118117 * -2 used by kprobes118118+ * -5 __builtin_trap() generated by gcc (2018.03 onwards) for toggle such as119119+ * -fno-isolate-erroneous-paths-dereference119120 */120121void do_non_swi_trap(unsigned long address, struct pt_regs *regs)121122{···137134 kgdb_trap(regs);138135 break;139136137137+ case 5:138138+ do_trap5_error(address, regs);139139+ break;140140 default:141141 break;142142 }···160154 return;161155162156 insterror_is_error(address, regs);157157+}158158+159159+/*160160+ * abort() call generated by older gcc for __builtin_trap()161161+ */162162+void abort(void)163163+{164164+ __asm__ __volatile__("trap_s 5\n");163165}
···317317 * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack318318 * of fudging the freq in DT319319 */320320+#define AXS103_QUAD_CORE_CPU_FREQ_HZ 50000000321321+320322 unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;321323 if (num_cores > 2) {322322- u32 freq = 50, orig;323323- /*324324- * TODO: use cpu node "cpu-freq" param instead of platform-specific325325- * "/cpu_card/core_clk" as it works only if we use fixed-clock for cpu.326326- */324324+ u32 freq;327325 int off = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk");328326 const struct fdt_property *prop;329327330328 prop = fdt_get_property(initial_boot_params, off,331331- "clock-frequency", NULL);332332- orig = be32_to_cpu(*(u32*)(prop->data)) / 1000000;329329+ "assigned-clock-rates", NULL);330330+ freq = be32_to_cpu(*(u32 *)(prop->data));333331334332 /* Patching .dtb in-place with new core clock value */335335- if (freq != orig ) {336336- freq = cpu_to_be32(freq * 1000000);333333+ if (freq != AXS103_QUAD_CORE_CPU_FREQ_HZ) {334334+ freq = cpu_to_be32(AXS103_QUAD_CORE_CPU_FREQ_HZ);337335 fdt_setprop_inplace(initial_boot_params, off,338338- "clock-frequency", &freq, sizeof(freq));336336+ "assigned-clock-rates", &freq, sizeof(freq));339337 }340338 }341339#endif
-42
arch/arc/plat-hsdk/platform.c
···3838#define CREG_PAE (CREG_BASE + 0x180)3939#define CREG_PAE_UPDATE (CREG_BASE + 0x194)40404141-#define CREG_CORE_IF_CLK_DIV (CREG_BASE + 0x4B8)4242-#define CREG_CORE_IF_CLK_DIV_2 0x14343-#define CGU_BASE ARC_PERIPHERAL_BASE4444-#define CGU_PLL_STATUS (ARC_PERIPHERAL_BASE + 0x4)4545-#define CGU_PLL_CTRL (ARC_PERIPHERAL_BASE + 0x0)4646-#define CGU_PLL_STATUS_LOCK BIT(0)4747-#define CGU_PLL_STATUS_ERR BIT(1)4848-#define CGU_PLL_CTRL_1GHZ 0x3A104949-#define HSDK_PLL_LOCK_TIMEOUT 5005050-5151-#define HSDK_PLL_LOCKED() \5252- !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_LOCK)5353-5454-#define HSDK_PLL_ERR() \5555- !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR)5656-5757-static void __init hsdk_set_cpu_freq_1ghz(void)5858-{5959- u32 timeout = HSDK_PLL_LOCK_TIMEOUT;6060-6161- /*6262- * As we set cpu clock which exceeds 500MHz, the divider for the interface6363- * clock must be programmed to div-by-2.6464- */6565- iowrite32(CREG_CORE_IF_CLK_DIV_2, (void __iomem *) CREG_CORE_IF_CLK_DIV);6666-6767- /* Set cpu clock to 1GHz */6868- iowrite32(CGU_PLL_CTRL_1GHZ, (void __iomem *) CGU_PLL_CTRL);6969-7070- while (!HSDK_PLL_LOCKED() && timeout--)7171- cpu_relax();7272-7373- if (!HSDK_PLL_LOCKED() || HSDK_PLL_ERR())7474- pr_err("Failed to setup CPU frequency to 1GHz!");7575-}7676-7741#define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000)7842#define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108)7943#define SDIO_UHS_REG_EXT_DIV_2 (2 << 30)···6298 * minimum possible div-by-2.6399 */64100 iowrite32(SDIO_UHS_REG_EXT_DIV_2, (void __iomem *) SDIO_UHS_REG_EXT);6565-6666- /*6767- * Setup CPU frequency to 1GHz.6868- * TODO: remove it after smart hsdk pll driver will be introduced.6969- */7070- hsdk_set_cpu_freq_1ghz();71101}7210273103static const char *hsdk_compat[] __initconst = {
+2
arch/mips/kernel/cps-vec.S
···235235 has_mt t0, 3f236236237237 .set push238238+ .set MIPS_ISA_LEVEL_RAW238239 .set mt239240240241 /* Only allow 1 TC per VPE to execute... */···389388#elif defined(CONFIG_MIPS_MT)390389391390 .set push391391+ .set MIPS_ISA_LEVEL_RAW392392 .set mt393393394394 /* If the core doesn't support MT then return */
+12
arch/mips/kernel/process.c
···705705 struct task_struct *t;706706 int max_users;707707708708+ /* If nothing to change, return right away, successfully. */709709+ if (value == mips_get_process_fp_mode(task))710710+ return 0;711711+712712+ /* Only accept a mode change if 64-bit FP enabled for o32. */713713+ if (!IS_ENABLED(CONFIG_MIPS_O32_FP64_SUPPORT))714714+ return -EOPNOTSUPP;715715+716716+ /* And only for o32 tasks. */717717+ if (IS_ENABLED(CONFIG_64BIT) && !test_thread_flag(TIF_32BIT_REGS))718718+ return -EOPNOTSUPP;719719+708720 /* Check the value is valid */709721 if (value & ~known_bits)710722 return -EOPNOTSUPP;
+125-28
arch/mips/kernel/ptrace.c
···419419420420#endif /* CONFIG_64BIT */421421422422-static int fpr_get(struct task_struct *target,423423- const struct user_regset *regset,424424- unsigned int pos, unsigned int count,425425- void *kbuf, void __user *ubuf)422422+/*423423+ * Copy the floating-point context to the supplied NT_PRFPREG buffer,424424+ * !CONFIG_CPU_HAS_MSA variant. FP context's general register slots425425+ * correspond 1:1 to buffer slots. Only general registers are copied.426426+ */427427+static int fpr_get_fpa(struct task_struct *target,428428+ unsigned int *pos, unsigned int *count,429429+ void **kbuf, void __user **ubuf)426430{427427- unsigned i;428428- int err;431431+ return user_regset_copyout(pos, count, kbuf, ubuf,432432+ &target->thread.fpu,433433+ 0, NUM_FPU_REGS * sizeof(elf_fpreg_t));434434+}435435+436436+/*437437+ * Copy the floating-point context to the supplied NT_PRFPREG buffer,438438+ * CONFIG_CPU_HAS_MSA variant. Only lower 64 bits of FP context's439439+ * general register slots are copied to buffer slots. Only general440440+ * registers are copied.441441+ */442442+static int fpr_get_msa(struct task_struct *target,443443+ unsigned int *pos, unsigned int *count,444444+ void **kbuf, void __user **ubuf)445445+{446446+ unsigned int i;429447 u64 fpr_val;448448+ int err;430449431431- /* XXX fcr31 */432432-433433- if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))434434- return user_regset_copyout(&pos, &count, &kbuf, &ubuf,435435- &target->thread.fpu,436436- 0, sizeof(elf_fpregset_t));437437-450450+ BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t));438451 for (i = 0; i < NUM_FPU_REGS; i++) {439452 fpr_val = get_fpr64(&target->thread.fpu.fpr[i], 0);440440- err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,453453+ err = user_regset_copyout(pos, count, kbuf, ubuf,441454 &fpr_val, i * sizeof(elf_fpreg_t),442455 (i + 1) * sizeof(elf_fpreg_t));443456 if (err)···460447 return 0;461448}462449463463-static int fpr_set(struct task_struct *target,450450+/*451451+ * Copy the floating-point context to the supplied NT_PRFPREG buffer.452452+ * Choose the appropriate helper for general registers, and then copy453453+ * the FCSR register separately.454454+ */455455+static int fpr_get(struct task_struct *target,464456 const struct user_regset *regset,465457 unsigned int pos, unsigned int count,466466- const void *kbuf, const void __user *ubuf)458458+ void *kbuf, void __user *ubuf)467459{468468- unsigned i;460460+ const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t);469461 int err;462462+463463+ if (sizeof(target->thread.fpu.fpr[0]) == sizeof(elf_fpreg_t))464464+ err = fpr_get_fpa(target, &pos, &count, &kbuf, &ubuf);465465+ else466466+ err = fpr_get_msa(target, &pos, &count, &kbuf, &ubuf);467467+ if (err)468468+ return err;469469+470470+ err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,471471+ &target->thread.fpu.fcr31,472472+ fcr31_pos, fcr31_pos + sizeof(u32));473473+474474+ return err;475475+}476476+477477+/*478478+ * Copy the supplied NT_PRFPREG buffer to the floating-point context,479479+ * !CONFIG_CPU_HAS_MSA variant. Buffer slots correspond 1:1 to FP480480+ * context's general register slots. Only general registers are copied.481481+ */482482+static int fpr_set_fpa(struct task_struct *target,483483+ unsigned int *pos, unsigned int *count,484484+ const void **kbuf, const void __user **ubuf)485485+{486486+ return user_regset_copyin(pos, count, kbuf, ubuf,487487+ &target->thread.fpu,488488+ 0, NUM_FPU_REGS * sizeof(elf_fpreg_t));489489+}490490+491491+/*492492+ * Copy the supplied NT_PRFPREG buffer to the floating-point context,493493+ * CONFIG_CPU_HAS_MSA variant. Buffer slots are copied to lower 64494494+ * bits only of FP context's general register slots. Only general495495+ * registers are copied.496496+ */497497+static int fpr_set_msa(struct task_struct *target,498498+ unsigned int *pos, unsigned int *count,499499+ const void **kbuf, const void __user **ubuf)500500+{501501+ unsigned int i;470502 u64 fpr_val;471471-472472- /* XXX fcr31 */473473-474474- init_fp_ctx(target);475475-476476- if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))477477- return user_regset_copyin(&pos, &count, &kbuf, &ubuf,478478- &target->thread.fpu,479479- 0, sizeof(elf_fpregset_t));503503+ int err;480504481505 BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t));482482- for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) {483483- err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,506506+ for (i = 0; i < NUM_FPU_REGS && *count > 0; i++) {507507+ err = user_regset_copyin(pos, count, kbuf, ubuf,484508 &fpr_val, i * sizeof(elf_fpreg_t),485509 (i + 1) * sizeof(elf_fpreg_t));486510 if (err)···526476 }527477528478 return 0;479479+}480480+481481+/*482482+ * Copy the supplied NT_PRFPREG buffer to the floating-point context.483483+ * Choose the appropriate helper for general registers, and then copy484484+ * the FCSR register separately.485485+ *486486+ * We optimize for the case where `count % sizeof(elf_fpreg_t) == 0',487487+ * which is supposed to have been guaranteed by the kernel before488488+ * calling us, e.g. in `ptrace_regset'. We enforce that requirement,489489+ * so that we can safely avoid preinitializing temporaries for490490+ * partial register writes.491491+ */492492+static int fpr_set(struct task_struct *target,493493+ const struct user_regset *regset,494494+ unsigned int pos, unsigned int count,495495+ const void *kbuf, const void __user *ubuf)496496+{497497+ const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t);498498+ u32 fcr31;499499+ int err;500500+501501+ BUG_ON(count % sizeof(elf_fpreg_t));502502+503503+ if (pos + count > sizeof(elf_fpregset_t))504504+ return -EIO;505505+506506+ init_fp_ctx(target);507507+508508+ if (sizeof(target->thread.fpu.fpr[0]) == sizeof(elf_fpreg_t))509509+ err = fpr_set_fpa(target, &pos, &count, &kbuf, &ubuf);510510+ else511511+ err = fpr_set_msa(target, &pos, &count, &kbuf, &ubuf);512512+ if (err)513513+ return err;514514+515515+ if (count > 0) {516516+ err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,517517+ &fcr31,518518+ fcr31_pos, fcr31_pos + sizeof(u32));519519+ if (err)520520+ return err;521521+522522+ ptrace_setfcr31(target, fcr31);523523+ }524524+525525+ return err;529526}530527531528enum mips_regset {
···145145 return __bad_area(regs, address, SEGV_MAPERR);146146}147147148148+static noinline int bad_access(struct pt_regs *regs, unsigned long address)149149+{150150+ return __bad_area(regs, address, SEGV_ACCERR);151151+}152152+148153static int do_sigbus(struct pt_regs *regs, unsigned long address,149154 unsigned int fault)150155{···495490496491good_area:497492 if (unlikely(access_error(is_write, is_exec, vma)))498498- return bad_area(regs, address);493493+ return bad_access(regs, address);499494500495 /*501496 * If for any reason at all we couldn't handle the fault,
+75
arch/riscv/configs/defconfig
···11+CONFIG_SMP=y22+CONFIG_PCI=y33+CONFIG_PCIE_XILINX=y44+CONFIG_SYSVIPC=y55+CONFIG_POSIX_MQUEUE=y66+CONFIG_IKCONFIG=y77+CONFIG_IKCONFIG_PROC=y88+CONFIG_CGROUPS=y99+CONFIG_CGROUP_SCHED=y1010+CONFIG_CFS_BANDWIDTH=y1111+CONFIG_CGROUP_BPF=y1212+CONFIG_NAMESPACES=y1313+CONFIG_USER_NS=y1414+CONFIG_BLK_DEV_INITRD=y1515+CONFIG_EXPERT=y1616+CONFIG_CHECKPOINT_RESTORE=y1717+CONFIG_BPF_SYSCALL=y1818+CONFIG_NET=y1919+CONFIG_PACKET=y2020+CONFIG_UNIX=y2121+CONFIG_INET=y2222+CONFIG_IP_MULTICAST=y2323+CONFIG_IP_ADVANCED_ROUTER=y2424+CONFIG_IP_PNP=y2525+CONFIG_IP_PNP_DHCP=y2626+CONFIG_IP_PNP_BOOTP=y2727+CONFIG_IP_PNP_RARP=y2828+CONFIG_NETLINK_DIAG=y2929+CONFIG_DEVTMPFS=y3030+CONFIG_BLK_DEV_LOOP=y3131+CONFIG_VIRTIO_BLK=y3232+CONFIG_BLK_DEV_SD=y3333+CONFIG_BLK_DEV_SR=y3434+CONFIG_ATA=y3535+CONFIG_SATA_AHCI=y3636+CONFIG_SATA_AHCI_PLATFORM=y3737+CONFIG_NETDEVICES=y3838+CONFIG_VIRTIO_NET=y3939+CONFIG_MACB=y4040+CONFIG_E1000E=y4141+CONFIG_R8169=y4242+CONFIG_MICROSEMI_PHY=y4343+CONFIG_INPUT_MOUSEDEV=y4444+CONFIG_SERIAL_8250=y4545+CONFIG_SERIAL_8250_CONSOLE=y4646+CONFIG_SERIAL_OF_PLATFORM=y4747+# CONFIG_PTP_1588_CLOCK is not set4848+CONFIG_DRM=y4949+CONFIG_DRM_RADEON=y5050+CONFIG_FRAMEBUFFER_CONSOLE=y5151+CONFIG_USB=y5252+CONFIG_USB_XHCI_HCD=y5353+CONFIG_USB_XHCI_PLATFORM=y5454+CONFIG_USB_EHCI_HCD=y5555+CONFIG_USB_EHCI_HCD_PLATFORM=y5656+CONFIG_USB_OHCI_HCD=y5757+CONFIG_USB_OHCI_HCD_PLATFORM=y5858+CONFIG_USB_STORAGE=y5959+CONFIG_USB_UAS=y6060+CONFIG_VIRTIO_MMIO=y6161+CONFIG_RAS=y6262+CONFIG_EXT4_FS=y6363+CONFIG_EXT4_FS_POSIX_ACL=y6464+CONFIG_AUTOFS4_FS=y6565+CONFIG_MSDOS_FS=y6666+CONFIG_VFAT_FS=y6767+CONFIG_TMPFS=y6868+CONFIG_TMPFS_POSIX_ACL=y6969+CONFIG_NFS_FS=y7070+CONFIG_NFS_V4=y7171+CONFIG_NFS_V4_1=y7272+CONFIG_NFS_V4_2=y7373+CONFIG_ROOT_NFS=y7474+# CONFIG_RCU_TRACE is not set7575+CONFIG_CRYPTO_USER_API_HASH=y
···11-/*22- * Copyright (C) 2017 SiFive33- *44- * This program is free software; you can redistribute it and/or modify55- * it under the terms of the GNU General Public License version 2 as66- * published by the Free Software Foundation.77- *88- * This program is distributed in the hope that it will be useful,99- * but WITHOUT ANY WARRANTY; without even the implied warranty of1010- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1111- * GNU General Public License for more details.1212- *1313- * You should have received a copy of the GNU General Public License1414- * along with this program. If not, see <http://www.gnu.org/licenses/>.1515- */1616-1717-#ifndef _ASM_RISCV_VDSO_SYSCALLS_H1818-#define _ASM_RISCV_VDSO_SYSCALLS_H1919-2020-#ifdef CONFIG_SMP2121-2222-/* These syscalls are only used by the vDSO and are not in the uapi. */2323-#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)2424-__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)2525-2626-#endif2727-2828-#endif /* _ASM_RISCV_VDSO_H */
+26
arch/riscv/include/uapi/asm/syscalls.h
···11+/* SPDX-License-Identifier: GPL-2.0 */22+/*33+ * Copyright (C) 2017 SiFive44+ */55+66+#ifndef _ASM__UAPI__SYSCALLS_H77+#define _ASM__UAPI__SYSCALLS_H88+99+/*1010+ * Allows the instruction cache to be flushed from userspace. Despite RISC-V1111+ * having a direct 'fence.i' instruction available to userspace (which we1212+ * can't trap!), that's not actually viable when running on Linux because the1313+ * kernel might schedule a process on another hart. There is no way for1414+ * userspace to handle this without invoking the kernel (as it doesn't know the1515+ * thread->hart mappings), so we've defined a RISC-V specific system call to1616+ * flush the instruction cache.1717+ *1818+ * __NR_riscv_flush_icache is defined to flush the instruction cache over an1919+ * address range, with the flush applying to either all threads or just the2020+ * caller. We don't currently do anything with the address range, that's just2121+ * in there for forwards compatibility.2222+ */2323+#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)2424+__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)2525+2626+#endif
+4-4
arch/riscv/kernel/entry.S
···196196 addi s2, s2, 0x4197197 REG_S s2, PT_SEPC(sp)198198 /* System calls run with interrupts enabled */199199- csrs sstatus, SR_IE199199+ csrs sstatus, SR_SIE200200 /* Trace syscalls, but only if requested by the user. */201201 REG_L t0, TASK_TI_FLAGS(tp)202202 andi t0, t0, _TIF_SYSCALL_TRACE···224224225225ret_from_exception:226226 REG_L s0, PT_SSTATUS(sp)227227- csrc sstatus, SR_IE228228- andi s0, s0, SR_PS227227+ csrc sstatus, SR_SIE228228+ andi s0, s0, SR_SPP229229 bnez s0, restore_all230230231231resume_userspace:···255255 bnez s1, work_resched256256work_notifysig:257257 /* Handle pending signals and notify-resume requests */258258- csrs sstatus, SR_IE /* Enable interrupts for do_notify_resume() */258258+ csrs sstatus, SR_SIE /* Enable interrupts for do_notify_resume() */259259 move a0, sp /* pt_regs */260260 move a1, s0 /* current_thread_info->flags */261261 tail do_notify_resume
+2-2
arch/riscv/kernel/process.c
···7676void start_thread(struct pt_regs *regs, unsigned long pc,7777 unsigned long sp)7878{7979- regs->sstatus = SR_PIE /* User mode, irqs on */ | SR_FS_INITIAL;7979+ regs->sstatus = SR_SPIE /* User mode, irqs on */ | SR_FS_INITIAL;8080 regs->sepc = pc;8181 regs->sp = sp;8282 set_fs(USER_DS);···110110 const register unsigned long gp __asm__ ("gp");111111 memset(childregs, 0, sizeof(struct pt_regs));112112 childregs->gp = gp;113113- childregs->sstatus = SR_PS | SR_PIE; /* Supervisor, irqs on */113113+ childregs->sstatus = SR_SPP | SR_SPIE; /* Supervisor, irqs on */114114115115 p->thread.ra = (unsigned long)ret_from_kernel_thread;116116 p->thread.s[0] = usp; /* fn */
···13131414#include <linux/linkage.h>1515#include <asm/unistd.h>1616-#include <asm/vdso-syscalls.h>17161817 .text1918/* int __vdso_flush_icache(void *start, void *end, unsigned long flags); */
+1-1
arch/riscv/mm/fault.c
···6363 goto vmalloc_fault;64646565 /* Enable interrupts if they were enabled in the parent context. */6666- if (likely(regs->sstatus & SR_PIE))6666+ if (likely(regs->sstatus & SR_SPIE))6767 local_irq_enable();68686969 /*
+5-4
arch/s390/kvm/kvm-s390.c
···792792793793 if (kvm->arch.use_cmma) {794794 /*795795- * Get the last slot. They should be sorted by base_gfn, so the796796- * last slot is also the one at the end of the address space.797797- * We have verified above that at least one slot is present.795795+ * Get the first slot. They are reverse sorted by base_gfn, so796796+ * the first slot is also the one at the end of the address797797+ * space. We have verified above that at least one slot is798798+ * present.798799 */799799- ms = slots->memslots + slots->used_slots - 1;800800+ ms = slots->memslots;800801 /* round up so we only use full longs */801802 ram_pages = roundup(ms->base_gfn + ms->npages, BITS_PER_LONG);802803 /* allocate enough bytes to store all the bits */
+1-1
arch/s390/kvm/priv.c
···10061006 cbrlo[entries] = gfn << PAGE_SHIFT;10071007 }1008100810091009- if (orc) {10091009+ if (orc && gfn < ms->bitmap_size) {10101010 /* increment only if we are really flipping the bit to 1 */10111011 if (!test_and_set_bit(gfn, ms->pgste_bitmap))10121012 atomic64_inc(&ms->dirty_pages);
···161161 * exported to drivers as the only user for unfreeze is blk_mq.162162 */163163 blk_freeze_queue_start(q);164164+ if (!q->mq_ops)165165+ blk_drain_queue(q);164166 blk_mq_freeze_queue_wait(q);165167}166168
···28932893EXPORT_SYMBOL_GPL(gpiod_set_raw_value);2894289428952895/**28962896+ * gpiod_set_value_nocheck() - set a GPIO line value without checking28972897+ * @desc: the descriptor to set the value on28982898+ * @value: value to set28992899+ *29002900+ * This sets the value of a GPIO line backing a descriptor, applying29012901+ * different semantic quirks like active low and open drain/source29022902+ * handling.29032903+ */29042904+static void gpiod_set_value_nocheck(struct gpio_desc *desc, int value)29052905+{29062906+ if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))29072907+ value = !value;29082908+ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))29092909+ gpio_set_open_drain_value_commit(desc, value);29102910+ else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))29112911+ gpio_set_open_source_value_commit(desc, value);29122912+ else29132913+ gpiod_set_raw_value_commit(desc, value);29142914+}29152915+29162916+/**28962917 * gpiod_set_value() - assign a gpio's value28972918 * @desc: gpio whose value will be assigned28982919 * @value: value to assign···29272906void gpiod_set_value(struct gpio_desc *desc, int value)29282907{29292908 VALIDATE_DESC_VOID(desc);29302930- /* Should be using gpiod_set_value_cansleep() */29312909 WARN_ON(desc->gdev->chip->can_sleep);29322932- if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))29332933- value = !value;29342934- if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))29352935- gpio_set_open_drain_value_commit(desc, value);29362936- else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))29372937- gpio_set_open_source_value_commit(desc, value);29382938- else29392939- gpiod_set_raw_value_commit(desc, value);29102910+ gpiod_set_value_nocheck(desc, value);29402911}29412912EXPORT_SYMBOL_GPL(gpiod_set_value);29422913···32563243{32573244 might_sleep_if(extra_checks);32583245 VALIDATE_DESC_VOID(desc);32593259- if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))32603260- value = !value;32613261- gpiod_set_raw_value_commit(desc, value);32463246+ gpiod_set_value_nocheck(desc, value);32623247}32633248EXPORT_SYMBOL_GPL(gpiod_set_value_cansleep);32643249
···816816 spin_lock_irqsave(&priv->lock, flags);817817 if (!neigh) {818818 neigh = ipoib_neigh_alloc(daddr, dev);819819- if (neigh) {819819+ /* Make sure that the neigh will be added only820820+ * once to mcast list.821821+ */822822+ if (neigh && list_empty(&neigh->list)) {820823 kref_get(&mcast->ah->ref);821824 neigh->ah = mcast->ah;822825 list_add_tail(&neigh->list, &mcast->neigh_list);
···163163#define GET_TIME(x) do { x = (unsigned int)rdtsc(); } while (0)164164#define DELTA(x,y) ((y)-(x))165165#define TIME_NAME "TSC"166166-#elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_TILE)166166+#elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_RISCV) || defined(CONFIG_TILE)167167#define GET_TIME(x) do { x = get_cycles(); } while (0)168168#define DELTA(x,y) ((y)-(x))169169#define TIME_NAME "get_cycles"
+1-1
drivers/input/misc/ims-pcu.c
···16511651 return union_desc;1652165216531653 dev_err(&intf->dev,16541654- "Union descriptor to short (%d vs %zd\n)",16541654+ "Union descriptor too short (%d vs %zd)\n",16551655 union_desc->bLength, sizeof(*union_desc));16561656 return NULL;16571657 }
···2727#include <linux/module.h>2828#include <linux/input.h>2929#include <linux/interrupt.h>3030+#include <linux/irq.h>3031#include <linux/platform_device.h>3132#include <linux/async.h>3233#include <linux/i2c.h>···12621261 }1263126212641263 /*12651265- * Systems using device tree should set up interrupt via DTS,12661266- * the rest will use the default falling edge interrupts.12641264+ * Platform code (ACPI, DTS) should normally set up interrupt12651265+ * for us, but in case it did not let's fall back to using falling12661266+ * edge to be compatible with older Chromebooks.12671267 */12681268- irqflags = client->dev.of_node ? 0 : IRQF_TRIGGER_FALLING;12681268+ irqflags = irq_get_trigger_type(client->irq);12691269+ if (!irqflags)12701270+ irqflags = IRQF_TRIGGER_FALLING;1269127112701272 error = devm_request_threaded_irq(&client->dev, client->irq,12711273 NULL, elants_i2c_irq,
···16981698 domain->pgsize_bitmap = pgtbl_cfg.pgsize_bitmap;16991699 domain->geometry.aperture_end = (1UL << ias) - 1;17001700 domain->geometry.force_aperture = true;17011701- smmu_domain->pgtbl_ops = pgtbl_ops;1702170117031702 ret = finalise_stage_fn(smmu_domain, &pgtbl_cfg);17041704- if (ret < 0)17031703+ if (ret < 0) {17051704 free_io_pgtable_ops(pgtbl_ops);17051705+ return ret;17061706+ }1706170717071707- return ret;17081708+ smmu_domain->pgtbl_ops = pgtbl_ops;17091709+ return 0;17081710}1709171117101712static __le64 *arm_smmu_get_step_for_sid(struct arm_smmu_device *smmu, u32 sid)···1733173117341732static void arm_smmu_install_ste_for_dev(struct iommu_fwspec *fwspec)17351733{17361736- int i;17341734+ int i, j;17371735 struct arm_smmu_master_data *master = fwspec->iommu_priv;17381736 struct arm_smmu_device *smmu = master->smmu;1739173717401738 for (i = 0; i < fwspec->num_ids; ++i) {17411739 u32 sid = fwspec->ids[i];17421740 __le64 *step = arm_smmu_get_step_for_sid(smmu, sid);17411741+17421742+ /* Bridged PCI devices may end up with duplicated IDs */17431743+ for (j = 0; j < i; j++)17441744+ if (fwspec->ids[j] == sid)17451745+ break;17461746+ if (j < i)17471747+ continue;1743174817441749 arm_smmu_write_strtab_ent(smmu, sid, step, &master->ste);17451750 }
+2-1
drivers/leds/led-core.c
···186186 unsigned long *delay_on,187187 unsigned long *delay_off)188188{189189- led_stop_software_blink(led_cdev);189189+ del_timer_sync(&led_cdev->blink_timer);190190191191+ clear_bit(LED_BLINK_SW, &led_cdev->work_flags);191192 clear_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags);192193 clear_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags);193194
+1
drivers/mtd/nand/pxa3xx_nand.c
···963963964964 switch (command) {965965 case NAND_CMD_READ0:966966+ case NAND_CMD_READOOB:966967 case NAND_CMD_PAGEPROG:967968 info->use_ecc = 1;968969 break;
+1-1
drivers/net/can/flexcan.c
···526526 data = be32_to_cpup((__be32 *)&cf->data[0]);527527 flexcan_write(data, &priv->tx_mb->data[0]);528528 }529529- if (cf->can_dlc > 3) {529529+ if (cf->can_dlc > 4) {530530 data = be32_to_cpup((__be32 *)&cf->data[4]);531531 flexcan_write(data, &priv->tx_mb->data[1]);532532 }
···15001500{15011501 struct b53_device *dev = ds->priv;1502150215031503- /* Older models support a different tag format that we do not15041504- * support in net/dsa/tag_brcm.c yet.15031503+ /* Older models (5325, 5365) support a different tag format that we do15041504+ * not support in net/dsa/tag_brcm.c yet. 539x and 531x5 require managed15051505+ * mode to be turned on which means we need to specifically manage ARL15061506+ * misses on multicast addresses (TBD).15051507 */15061506- if (is5325(dev) || is5365(dev) || !b53_can_enable_brcm_tags(ds, port))15081508+ if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) ||15091509+ !b53_can_enable_brcm_tags(ds, port))15071510 return DSA_TAG_PROTO_NONE;1508151115091512 /* Broadcom BCM58xx chips have a flow accelerator on Port 8
+38-52
drivers/net/ethernet/3com/3c59x.c
···602602 struct sk_buff* rx_skbuff[RX_RING_SIZE];603603 struct sk_buff* tx_skbuff[TX_RING_SIZE];604604 unsigned int cur_rx, cur_tx; /* The next free ring entry */605605- unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */605605+ unsigned int dirty_tx; /* The ring entries to be free()ed. */606606 struct vortex_extra_stats xstats; /* NIC-specific extra stats */607607 struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */608608 dma_addr_t tx_skb_dma; /* Allocated DMA address for bus master ctrl DMA. */···618618619619 /* The remainder are related to chip state, mostly media selection. */620620 struct timer_list timer; /* Media selection timer. */621621- struct timer_list rx_oom_timer; /* Rx skb allocation retry timer */622621 int options; /* User-settable misc. driver options. */623622 unsigned int media_override:4, /* Passed-in media type. */624623 default_media:4, /* Read from the EEPROM/Wn3_Config. */···759760static int mdio_read(struct net_device *dev, int phy_id, int location);760761static void mdio_write(struct net_device *vp, int phy_id, int location, int value);761762static void vortex_timer(struct timer_list *t);762762-static void rx_oom_timer(struct timer_list *t);763763static netdev_tx_t vortex_start_xmit(struct sk_buff *skb,764764 struct net_device *dev);765765static netdev_tx_t boomerang_start_xmit(struct sk_buff *skb,···1599160116001602 timer_setup(&vp->timer, vortex_timer, 0);16011603 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait));16021602- timer_setup(&vp->rx_oom_timer, rx_oom_timer, 0);1603160416041605 if (vortex_debug > 1)16051606 pr_debug("%s: Initial media type %s.\n",···16731676 window_write16(vp, 0x0040, 4, Wn4_NetDiag);1674167716751678 if (vp->full_bus_master_rx) { /* Boomerang bus master. */16761676- vp->cur_rx = vp->dirty_rx = 0;16791679+ vp->cur_rx = 0;16771680 /* Initialize the RxEarly register as recommended. */16781681 iowrite16(SetRxThreshold + (1536>>2), ioaddr + EL3_CMD);16791682 iowrite32(0x0020, ioaddr + PktStatus);···17261729 struct vortex_private *vp = netdev_priv(dev);17271730 int i;17281731 int retval;17321732+ dma_addr_t dma;1729173317301734 /* Use the now-standard shared IRQ implementation. */17311735 if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?···17511753 break; /* Bad news! */1752175417531755 skb_reserve(skb, NET_IP_ALIGN); /* Align IP on 16 byte boundaries */17541754- vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));17561756+ dma = pci_map_single(VORTEX_PCI(vp), skb->data,17571757+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);17581758+ if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma))17591759+ break;17601760+ vp->rx_ring[i].addr = cpu_to_le32(dma);17551761 }17561762 if (i != RX_RING_SIZE) {17571763 pr_emerg("%s: no memory for rx ring\n", dev->name);···20692067 int len = (skb->len + 3) & ~3;20702068 vp->tx_skb_dma = pci_map_single(VORTEX_PCI(vp), skb->data, len,20712069 PCI_DMA_TODEVICE);20702070+ if (dma_mapping_error(&VORTEX_PCI(vp)->dev, vp->tx_skb_dma)) {20712071+ dev_kfree_skb_any(skb);20722072+ dev->stats.tx_dropped++;20732073+ return NETDEV_TX_OK;20742074+ }20752075+20722076 spin_lock_irq(&vp->window_lock);20732077 window_set(vp, 7);20742078 iowrite32(vp->tx_skb_dma, ioaddr + Wn7_MasterAddr);···26012593 int entry = vp->cur_rx % RX_RING_SIZE;26022594 void __iomem *ioaddr = vp->ioaddr;26032595 int rx_status;26042604- int rx_work_limit = vp->dirty_rx + RX_RING_SIZE - vp->cur_rx;25962596+ int rx_work_limit = RX_RING_SIZE;2605259726062598 if (vortex_debug > 5)26072599 pr_debug("boomerang_rx(): status %4.4x\n", ioread16(ioaddr+EL3_STATUS));···26222614 } else {26232615 /* The packet length: up to 4.5K!. */26242616 int pkt_len = rx_status & 0x1fff;26252625- struct sk_buff *skb;26172617+ struct sk_buff *skb, *newskb;26182618+ dma_addr_t newdma;26262619 dma_addr_t dma = le32_to_cpu(vp->rx_ring[entry].addr);2627262026282621 if (vortex_debug > 4)···26422633 pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE);26432634 vp->rx_copy++;26442635 } else {26362636+ /* Pre-allocate the replacement skb. If it or its26372637+ * mapping fails then recycle the buffer thats already26382638+ * in place26392639+ */26402640+ newskb = netdev_alloc_skb_ip_align(dev, PKT_BUF_SZ);26412641+ if (!newskb) {26422642+ dev->stats.rx_dropped++;26432643+ goto clear_complete;26442644+ }26452645+ newdma = pci_map_single(VORTEX_PCI(vp), newskb->data,26462646+ PKT_BUF_SZ, PCI_DMA_FROMDEVICE);26472647+ if (dma_mapping_error(&VORTEX_PCI(vp)->dev, newdma)) {26482648+ dev->stats.rx_dropped++;26492649+ consume_skb(newskb);26502650+ goto clear_complete;26512651+ }26522652+26452653 /* Pass up the skbuff already on the Rx ring. */26462654 skb = vp->rx_skbuff[entry];26472647- vp->rx_skbuff[entry] = NULL;26552655+ vp->rx_skbuff[entry] = newskb;26562656+ vp->rx_ring[entry].addr = cpu_to_le32(newdma);26482657 skb_put(skb, pkt_len);26492658 pci_unmap_single(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE);26502659 vp->rx_nocopy++;···26802653 netif_rx(skb);26812654 dev->stats.rx_packets++;26822655 }26832683- entry = (++vp->cur_rx) % RX_RING_SIZE;26842684- }26852685- /* Refill the Rx ring buffers. */26862686- for (; vp->cur_rx - vp->dirty_rx > 0; vp->dirty_rx++) {26872687- struct sk_buff *skb;26882688- entry = vp->dirty_rx % RX_RING_SIZE;26892689- if (vp->rx_skbuff[entry] == NULL) {26902690- skb = netdev_alloc_skb_ip_align(dev, PKT_BUF_SZ);26912691- if (skb == NULL) {26922692- static unsigned long last_jif;26932693- if (time_after(jiffies, last_jif + 10 * HZ)) {26942694- pr_warn("%s: memory shortage\n",26952695- dev->name);26962696- last_jif = jiffies;26972697- }26982698- if ((vp->cur_rx - vp->dirty_rx) == RX_RING_SIZE)26992699- mod_timer(&vp->rx_oom_timer, RUN_AT(HZ * 1));27002700- break; /* Bad news! */27012701- }2702265627032703- vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));27042704- vp->rx_skbuff[entry] = skb;27052705- }26572657+clear_complete:27062658 vp->rx_ring[entry].status = 0; /* Clear complete bit. */27072659 iowrite16(UpUnstall, ioaddr + EL3_CMD);26602660+ entry = (++vp->cur_rx) % RX_RING_SIZE;27082661 }27092662 return 0;27102710-}27112711-27122712-/*27132713- * If we've hit a total OOM refilling the Rx ring we poll once a second27142714- * for some memory. Otherwise there is no way to restart the rx process.27152715- */27162716-static void27172717-rx_oom_timer(struct timer_list *t)27182718-{27192719- struct vortex_private *vp = from_timer(vp, t, rx_oom_timer);27202720- struct net_device *dev = vp->mii.dev;27212721-27222722- spin_lock_irq(&vp->lock);27232723- if ((vp->cur_rx - vp->dirty_rx) == RX_RING_SIZE) /* This test is redundant, but makes me feel good */27242724- boomerang_rx(dev);27252725- if (vortex_debug > 1) {27262726- pr_debug("%s: rx_oom_timer %s\n", dev->name,27272727- ((vp->cur_rx - vp->dirty_rx) != RX_RING_SIZE) ? "succeeded" : "retrying");27282728- }27292729- spin_unlock_irq(&vp->lock);27302663}2731266427322665static void···26982711 netdev_reset_queue(dev);26992712 netif_stop_queue(dev);2700271327012701- del_timer_sync(&vp->rx_oom_timer);27022714 del_timer_sync(&vp->timer);2703271527042716 /* Turn off statistics ASAP. We update dev->stats below. */
+30-15
drivers/net/ethernet/amazon/ena/ena_netdev.c
···7575MODULE_DEVICE_TABLE(pci, ena_pci_tbl);76767777static int ena_rss_init_default(struct ena_adapter *adapter);7878+static void check_for_admin_com_state(struct ena_adapter *adapter);7979+static void ena_destroy_device(struct ena_adapter *adapter);8080+static int ena_restore_device(struct ena_adapter *adapter);78817982static void ena_tx_timeout(struct net_device *dev)8083{···1568156515691566static int ena_up_complete(struct ena_adapter *adapter)15701567{15711571- int rc, i;15681568+ int rc;1572156915731570 rc = ena_rss_configure(adapter);15741571 if (rc)···15861583 ena_restore_ethtool_params(adapter);1587158415881585 ena_napi_enable_all(adapter);15891589-15901590- /* Enable completion queues interrupt */15911591- for (i = 0; i < adapter->num_queues; i++)15921592- ena_unmask_interrupt(&adapter->tx_ring[i],15931593- &adapter->rx_ring[i]);15941594-15951595- /* schedule napi in case we had pending packets15961596- * from the last time we disable napi15971597- */15981598- for (i = 0; i < adapter->num_queues; i++)15991599- napi_schedule(&adapter->ena_napi[i].napi);1600158616011587 return 0;16021588}···1723173117241732static int ena_up(struct ena_adapter *adapter)17251733{17261726- int rc;17341734+ int rc, i;1727173517281736 netdev_dbg(adapter->netdev, "%s\n", __func__);17291737···17651773 u64_stats_update_end(&adapter->syncp);1766177417671775 set_bit(ENA_FLAG_DEV_UP, &adapter->flags);17761776+17771777+ /* Enable completion queues interrupt */17781778+ for (i = 0; i < adapter->num_queues; i++)17791779+ ena_unmask_interrupt(&adapter->tx_ring[i],17801780+ &adapter->rx_ring[i]);17811781+17821782+ /* schedule napi in case we had pending packets17831783+ * from the last time we disable napi17841784+ */17851785+ for (i = 0; i < adapter->num_queues; i++)17861786+ napi_schedule(&adapter->ena_napi[i].napi);1768178717691788 return rc;17701789···1886188318871884 if (test_bit(ENA_FLAG_DEV_UP, &adapter->flags))18881885 ena_down(adapter);18861886+18871887+ /* Check for device status and issue reset if needed*/18881888+ check_for_admin_com_state(adapter);18891889+ if (unlikely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {18901890+ netif_err(adapter, ifdown, adapter->netdev,18911891+ "Destroy failure, restarting device\n");18921892+ ena_dump_stats_to_dmesg(adapter);18931893+ /* rtnl lock already obtained in dev_ioctl() layer */18941894+ ena_destroy_device(adapter);18951895+ ena_restore_device(adapter);18961896+ }1889189718901898 return 0;18911899}···2558254425592545 ena_com_set_admin_running_state(ena_dev, false);2560254625612561- ena_close(netdev);25472547+ if (test_bit(ENA_FLAG_DEV_UP, &adapter->flags))25482548+ ena_down(adapter);2562254925632550 /* Before releasing the ENA resources, a device reset is required.25642551 * (to prevent the device from accessing them).25652565- * In case the reset flag is set and the device is up, ena_close25522552+ * In case the reset flag is set and the device is up, ena_down()25662553 * already perform the reset, so it can be skipped.25672554 */25682555 if (!(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags) && dev_up))
+1-1
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
···7070 netdev_err(bp->dev, "vf ndo called though sriov is disabled\n");7171 return -EINVAL;7272 }7373- if (vf_id >= bp->pf.max_vfs) {7373+ if (vf_id >= bp->pf.active_vfs) {7474 netdev_err(bp->dev, "Invalid VF id %d\n", vf_id);7575 return -EINVAL;7676 }
+1-1
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
···421421 }422422423423 /* If all IP and L4 fields are wildcarded then this is an L2 flow */424424- if (is_wildcard(&l3_mask, sizeof(l3_mask)) &&424424+ if (is_wildcard(l3_mask, sizeof(*l3_mask)) &&425425 is_wildcard(&flow->l4_mask, sizeof(flow->l4_mask))) {426426 flow_flags |= CFA_FLOW_ALLOC_REQ_FLAGS_FLOWTYPE_L2;427427 } else {
-1
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
···344344345345 unsigned int sf_size; /* serial flash size in bytes */346346 unsigned int sf_nsec; /* # of flash sectors */347347- unsigned int sf_fw_start; /* start of FW image in flash */348347349348 unsigned int fw_vers; /* firmware version */350349 unsigned int bs_vers; /* bootstrap version */
+8-9
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
···28442844 SF_RD_DATA_FAST = 0xb, /* read flash */28452845 SF_RD_ID = 0x9f, /* read ID */28462846 SF_ERASE_SECTOR = 0xd8, /* erase sector */28472847-28482848- FW_MAX_SIZE = 16 * SF_SEC_SIZE,28492847};2850284828512849/**···35563558 const __be32 *p = (const __be32 *)fw_data;35573559 const struct fw_hdr *hdr = (const struct fw_hdr *)fw_data;35583560 unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec;35593559- unsigned int fw_img_start = adap->params.sf_fw_start;35603560- unsigned int fw_start_sec = fw_img_start / sf_sec_size;35613561+ unsigned int fw_start_sec = FLASH_FW_START_SEC;35623562+ unsigned int fw_size = FLASH_FW_MAX_SIZE;35633563+ unsigned int fw_start = FLASH_FW_START;3561356435623565 if (!size) {35633566 dev_err(adap->pdev_dev, "FW image has no data\n");···35743575 "FW image size differs from size in FW header\n");35753576 return -EINVAL;35763577 }35773577- if (size > FW_MAX_SIZE) {35783578+ if (size > fw_size) {35783579 dev_err(adap->pdev_dev, "FW image too large, max is %u bytes\n",35793579- FW_MAX_SIZE);35803580+ fw_size);35803581 return -EFBIG;35813582 }35823583 if (!t4_fw_matches_chip(adap, hdr))···36033604 */36043605 memcpy(first_page, fw_data, SF_PAGE_SIZE);36053606 ((struct fw_hdr *)first_page)->fw_ver = cpu_to_be32(0xffffffff);36063606- ret = t4_write_flash(adap, fw_img_start, SF_PAGE_SIZE, first_page);36073607+ ret = t4_write_flash(adap, fw_start, SF_PAGE_SIZE, first_page);36073608 if (ret)36083609 goto out;3609361036103610- addr = fw_img_start;36113611+ addr = fw_start;36113612 for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) {36123613 addr += SF_PAGE_SIZE;36133614 fw_data += SF_PAGE_SIZE;···36173618 }3618361936193620 ret = t4_write_flash(adap,36203620- fw_img_start + offsetof(struct fw_hdr, fw_ver),36213621+ fw_start + offsetof(struct fw_hdr, fw_ver),36213622 sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver);36223623out:36233624 if (ret)
···945945static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)946946{947947 struct net_device *netdev;948948- struct e1000_adapter *adapter;948948+ struct e1000_adapter *adapter = NULL;949949 struct e1000_hw *hw;950950951951 static int cards_found;···955955 u16 tmp = 0;956956 u16 eeprom_apme_mask = E1000_EEPROM_APME;957957 int bars, need_ioport;958958+ bool disable_dev = false;958959959960 /* do not allocate ioport bars when not needed */960961 need_ioport = e1000_is_need_ioport(pdev);···12601259 iounmap(hw->ce4100_gbe_mdio_base_virt);12611260 iounmap(hw->hw_addr);12621261err_ioremap:12621262+ disable_dev = !test_and_set_bit(__E1000_DISABLED, &adapter->flags);12631263 free_netdev(netdev);12641264err_alloc_etherdev:12651265 pci_release_selected_regions(pdev, bars);12661266err_pci_reg:12671267- pci_disable_device(pdev);12671267+ if (!adapter || disable_dev)12681268+ pci_disable_device(pdev);12681269 return err;12691270}12701271···12841281 struct net_device *netdev = pci_get_drvdata(pdev);12851282 struct e1000_adapter *adapter = netdev_priv(netdev);12861283 struct e1000_hw *hw = &adapter->hw;12841284+ bool disable_dev;1287128512881286 e1000_down_and_stop(adapter);12891287 e1000_release_manageability(adapter);···13031299 iounmap(hw->flash_address);13041300 pci_release_selected_regions(pdev, adapter->bars);1305130113021302+ disable_dev = !test_and_set_bit(__E1000_DISABLED, &adapter->flags);13061303 free_netdev(netdev);1307130413081308- pci_disable_device(pdev);13051305+ if (disable_dev)13061306+ pci_disable_device(pdev);13091307}1310130813111309/**···51625156 if (netif_running(netdev))51635157 e1000_free_irq(adapter);5164515851655165- pci_disable_device(pdev);51595159+ if (!test_and_set_bit(__E1000_DISABLED, &adapter->flags))51605160+ pci_disable_device(pdev);5166516151675162 return 0;51685163}···52075200 pr_err("Cannot enable PCI device from suspend\n");52085201 return err;52095202 }52035203+52045204+ /* flush memory to make sure state is correct */52055205+ smp_mb__before_atomic();52065206+ clear_bit(__E1000_DISABLED, &adapter->flags);52105207 pci_set_master(pdev);5211520852125209 pci_enable_wake(pdev, PCI_D3hot, 0);···5285527452865275 if (netif_running(netdev))52875276 e1000_down(adapter);52885288- pci_disable_device(pdev);52775277+52785278+ if (!test_and_set_bit(__E1000_DISABLED, &adapter->flags))52795279+ pci_disable_device(pdev);5289528052905281 /* Request a slot slot reset. */52915282 return PCI_ERS_RESULT_NEED_RESET;···53155302 pr_err("Cannot re-enable PCI device after reset.\n");53165303 return PCI_ERS_RESULT_DISCONNECT;53175304 }53055305+53065306+ /* flush memory to make sure state is correct */53075307+ smp_mb__before_atomic();53085308+ clear_bit(__E1000_DISABLED, &adapter->flags);53185309 pci_set_master(pdev);5319531053205311 pci_enable_wake(pdev, PCI_D3hot, 0);
+8-3
drivers/net/ethernet/intel/e1000e/ich8lan.c
···13671367 * Checks to see of the link status of the hardware has changed. If a13681368 * change in link status has been detected, then we read the PHY registers13691369 * to get the current speed/duplex if link exists.13701370+ *13711371+ * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link13721372+ * up).13701373 **/13711374static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)13721375{···13851382 * Change or Rx Sequence Error interrupt.13861383 */13871384 if (!mac->get_link_status)13881388- return 0;13851385+ return 1;1389138613901387 /* First we want to see if the MII Status Register reports13911388 * link. If so, then we want to get the current speed/duplex···16161613 * different link partner.16171614 */16181615 ret_val = e1000e_config_fc_after_link_up(hw);16191619- if (ret_val)16161616+ if (ret_val) {16201617 e_dbg("Error configuring flow control\n");16181618+ return ret_val;16191619+ }1621162016221622- return ret_val;16211621+ return 1;16231622}1624162316251624static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
+26-11
drivers/net/ethernet/intel/i40e/i40e_main.c
···15731573 else15741574 netdev_info(netdev, "set new mac address %pM\n", addr->sa_data);1575157515761576+ /* Copy the address first, so that we avoid a possible race with15771577+ * .set_rx_mode(). If we copy after changing the address in the filter15781578+ * list, we might open ourselves to a narrow race window where15791579+ * .set_rx_mode could delete our dev_addr filter and prevent traffic15801580+ * from passing.15811581+ */15821582+ ether_addr_copy(netdev->dev_addr, addr->sa_data);15831583+15761584 spin_lock_bh(&vsi->mac_filter_hash_lock);15771585 i40e_del_mac_filter(vsi, netdev->dev_addr);15781586 i40e_add_mac_filter(vsi, addr->sa_data);15791587 spin_unlock_bh(&vsi->mac_filter_hash_lock);15801580- ether_addr_copy(netdev->dev_addr, addr->sa_data);15811588 if (vsi->type == I40E_VSI_MAIN) {15821589 i40e_status ret;15831590···19291922{19301923 struct i40e_netdev_priv *np = netdev_priv(netdev);19311924 struct i40e_vsi *vsi = np->vsi;19251925+19261926+ /* Under some circumstances, we might receive a request to delete19271927+ * our own device address from our uc list. Because we store the19281928+ * device address in the VSI's MAC/VLAN filter list, we need to ignore19291929+ * such requests and not delete our device address from this list.19301930+ */19311931+ if (ether_addr_equal(addr, netdev->dev_addr))19321932+ return 0;1932193319331934 i40e_del_mac_filter(vsi, addr);19341935···60536038 /* Set Bit 7 to be valid */60546039 mode = I40E_AQ_SET_SWITCH_BIT7_VALID;6055604060566056- /* Set L4type to both TCP and UDP support */60576057- mode |= I40E_AQ_SET_SWITCH_L4_TYPE_BOTH;60416041+ /* Set L4type for TCP support */60426042+ mode |= I40E_AQ_SET_SWITCH_L4_TYPE_TCP;6058604360596044 /* Set cloud filter mode */60606045 mode |= I40E_AQ_SET_SWITCH_MODE_NON_TUNNEL;···69846969 is_valid_ether_addr(filter->src_mac)) ||69856970 (is_multicast_ether_addr(filter->dst_mac) &&69866971 is_multicast_ether_addr(filter->src_mac)))69876987- return -EINVAL;69726972+ return -EOPNOTSUPP;6988697369896989- /* Make sure port is specified, otherwise bail out, for channel69906990- * specific cloud filter needs 'L4 port' to be non-zero69746974+ /* Big buffer cloud filter needs 'L4 port' to be non-zero. Also, UDP69756975+ * ports are not supported via big buffer now.69916976 */69926992- if (!filter->dst_port)69936993- return -EINVAL;69776977+ if (!filter->dst_port || filter->ip_proto == IPPROTO_UDP)69786978+ return -EOPNOTSUPP;6994697969956980 /* adding filter using src_port/src_ip is not supported at this stage */69966981 if (filter->src_port || filter->src_ipv4 ||69976982 !ipv6_addr_any(&filter->ip.v6.src_ip6))69986998- return -EINVAL;69836983+ return -EOPNOTSUPP;6999698470006985 /* copy element needed to add cloud filter from filter */70016986 i40e_set_cld_element(filter, &cld_filter.element);···70066991 is_multicast_ether_addr(filter->src_mac)) {70076992 /* MAC + IP : unsupported mode */70086993 if (filter->dst_ipv4)70097009- return -EINVAL;69946994+ return -EOPNOTSUPP;7010699570116996 /* since we validated that L4 port must be valid before70126997 * we get here, start with respective "flags" value···7371735673727357 if (tc < 0) {73737358 dev_err(&vsi->back->pdev->dev, "Invalid traffic class\n");73747374- return -EINVAL;73597359+ return -EOPNOTSUPP;73757360 }7376736173777362 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
+23-3
drivers/net/ethernet/intel/i40e/i40e_txrx.c
···30473047 /* Walk through fragments adding latest fragment, testing it, and30483048 * then removing stale fragments from the sum.30493049 */30503050- stale = &skb_shinfo(skb)->frags[0];30513051- for (;;) {30503050+ for (stale = &skb_shinfo(skb)->frags[0];; stale++) {30513051+ int stale_size = skb_frag_size(stale);30523052+30523053 sum += skb_frag_size(frag++);30543054+30553055+ /* The stale fragment may present us with a smaller30563056+ * descriptor than the actual fragment size. To account30573057+ * for that we need to remove all the data on the front and30583058+ * figure out what the remainder would be in the last30593059+ * descriptor associated with the fragment.30603060+ */30613061+ if (stale_size > I40E_MAX_DATA_PER_TXD) {30623062+ int align_pad = -(stale->page_offset) &30633063+ (I40E_MAX_READ_REQ_SIZE - 1);30643064+30653065+ sum -= align_pad;30663066+ stale_size -= align_pad;30673067+30683068+ do {30693069+ sum -= I40E_MAX_DATA_PER_TXD_ALIGNED;30703070+ stale_size -= I40E_MAX_DATA_PER_TXD_ALIGNED;30713071+ } while (stale_size > I40E_MAX_DATA_PER_TXD);30723072+ }3053307330543074 /* if sum is negative we failed to make sufficient progress */30553075 if (sum < 0)···30783058 if (!nr_frags--)30793059 break;3080306030813081- sum -= skb_frag_size(stale++);30613061+ sum -= stale_size;30823062 }3083306330843064 return false;
+23-3
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
···20122012 /* Walk through fragments adding latest fragment, testing it, and20132013 * then removing stale fragments from the sum.20142014 */20152015- stale = &skb_shinfo(skb)->frags[0];20162016- for (;;) {20152015+ for (stale = &skb_shinfo(skb)->frags[0];; stale++) {20162016+ int stale_size = skb_frag_size(stale);20172017+20172018 sum += skb_frag_size(frag++);20192019+20202020+ /* The stale fragment may present us with a smaller20212021+ * descriptor than the actual fragment size. To account20222022+ * for that we need to remove all the data on the front and20232023+ * figure out what the remainder would be in the last20242024+ * descriptor associated with the fragment.20252025+ */20262026+ if (stale_size > I40E_MAX_DATA_PER_TXD) {20272027+ int align_pad = -(stale->page_offset) &20282028+ (I40E_MAX_READ_REQ_SIZE - 1);20292029+20302030+ sum -= align_pad;20312031+ stale_size -= align_pad;20322032+20332033+ do {20342034+ sum -= I40E_MAX_DATA_PER_TXD_ALIGNED;20352035+ stale_size -= I40E_MAX_DATA_PER_TXD_ALIGNED;20362036+ } while (stale_size > I40E_MAX_DATA_PER_TXD);20372037+ }2018203820192039 /* if sum is negative we failed to make sufficient progress */20202040 if (sum < 0)···20432023 if (!nr_frags--)20442024 break;2045202520462046- sum -= skb_frag_size(stale++);20262026+ sum -= stale_size;20472027 }2048202820492029 return false;
+6-1
drivers/net/ethernet/mellanox/mlxsw/pci.c
···16431643 return 0;16441644 }1645164516461646- wmb(); /* reset needs to be written before we read control register */16461646+ /* Reset needs to be written before we read control register, and16471647+ * we must wait for the HW to become responsive once again16481648+ */16491649+ wmb();16501650+ msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS);16511651+16471652 end = jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);16481653 do {16491654 u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
···43764376 }43774377 if (!info->linking)43784378 break;43794379- if (netdev_has_any_upper_dev(upper_dev)) {43794379+ if (netdev_has_any_upper_dev(upper_dev) &&43804380+ (!netif_is_bridge_master(upper_dev) ||43814381+ !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp,43824382+ upper_dev))) {43804383 NL_SET_ERR_MSG(extack,43814384 "spectrum: Enslaving a port to a device that already has an upper device is not supported");43824385 return -EINVAL;···45074504 u16 vid)45084505{45094506 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);45074507+ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;45104508 struct netdev_notifier_changeupper_info *info = ptr;45114509 struct netlink_ext_ack *extack;45124510 struct net_device *upper_dev;···45244520 }45254521 if (!info->linking)45264522 break;45274527- if (netdev_has_any_upper_dev(upper_dev)) {45234523+ if (netdev_has_any_upper_dev(upper_dev) &&45244524+ (!netif_is_bridge_master(upper_dev) ||45254525+ !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp,45264526+ upper_dev))) {45284527 NL_SET_ERR_MSG(extack, "spectrum: Enslaving a port to a device that already has an upper device is not supported");45294528 return -EINVAL;45304529 }
···147147 [FWNLCR0] = 0x0090,148148 [FWALCR0] = 0x0094,149149 [TXNLCR1] = 0x00a0,150150- [TXALCR1] = 0x00a0,150150+ [TXALCR1] = 0x00a4,151151 [RXNLCR1] = 0x00a8,152152 [RXALCR1] = 0x00ac,153153 [FWNLCR1] = 0x00b0,···399399 [FWNLCR0] = 0x0090,400400 [FWALCR0] = 0x0094,401401 [TXNLCR1] = 0x00a0,402402- [TXALCR1] = 0x00a0,402402+ [TXALCR1] = 0x00a4,403403 [RXNLCR1] = 0x00a8,404404 [RXALCR1] = 0x00ac,405405 [FWNLCR1] = 0x00b0,···32253225 /* ioremap the TSU registers */32263226 if (mdp->cd->tsu) {32273227 struct resource *rtsu;32283228+32283229 rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);32293229- mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);32303230- if (IS_ERR(mdp->tsu_addr)) {32313231- ret = PTR_ERR(mdp->tsu_addr);32303230+ if (!rtsu) {32313231+ dev_err(&pdev->dev, "no TSU resource\n");32323232+ ret = -ENODEV;32333233+ goto out_release;32343234+ }32353235+ /* We can only request the TSU region for the first port32363236+ * of the two sharing this TSU for the probe to succeed...32373237+ */32383238+ if (devno % 2 == 0 &&32393239+ !devm_request_mem_region(&pdev->dev, rtsu->start,32403240+ resource_size(rtsu),32413241+ dev_name(&pdev->dev))) {32423242+ dev_err(&pdev->dev, "can't request TSU resource.\n");32433243+ ret = -EBUSY;32443244+ goto out_release;32453245+ }32463246+ mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,32473247+ resource_size(rtsu));32483248+ if (!mdp->tsu_addr) {32493249+ dev_err(&pdev->dev, "TSU region ioremap() failed.\n");32503250+ ret = -ENOMEM;32323251 goto out_release;32333252 }32343253 mdp->port = devno % 2;32353254 ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER;32363255 }3237325632383238- /* initialize first or needed device */32393239- if (!devno || pd->needs_init) {32573257+ /* Need to init only the first port of the two sharing a TSU */32583258+ if (devno % 2 == 0) {32403259 if (mdp->cd->chip_reset)32413260 mdp->cd->chip_reset(ndev);32423261
+6
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
···364364bool stmmac_eee_init(struct stmmac_priv *priv)365365{366366 struct net_device *ndev = priv->dev;367367+ int interface = priv->plat->interface;367368 unsigned long flags;368369 bool ret = false;370370+371371+ if ((interface != PHY_INTERFACE_MODE_MII) &&372372+ (interface != PHY_INTERFACE_MODE_GMII) &&373373+ !phy_interface_mode_is_rgmii(interface))374374+ goto out;369375370376 /* Using PCS we cannot dial with the phy registers at this stage371377 * so we do not support extra feature like EEE.
+14
drivers/net/geneve.c
···825825 if (IS_ERR(rt))826826 return PTR_ERR(rt);827827828828+ if (skb_dst(skb)) {829829+ int mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr) -830830+ GENEVE_BASE_HLEN - info->options_len - 14;831831+832832+ skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);833833+ }834834+828835 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);829836 if (geneve->collect_md) {830837 tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);···870863 dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);871864 if (IS_ERR(dst))872865 return PTR_ERR(dst);866866+867867+ if (skb_dst(skb)) {868868+ int mtu = dst_mtu(dst) - sizeof(struct ipv6hdr) -869869+ GENEVE_BASE_HLEN - info->options_len - 14;870870+871871+ skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);872872+ }873873874874 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);875875 if (geneve->collect_md) {
+6-1
drivers/net/macvlan.c
···14441444 return 0;1445144514461446unregister_netdev:14471447+ /* macvlan_uninit would free the macvlan port */14471448 unregister_netdevice(dev);14491449+ return err;14481450destroy_macvlan_port:14491449- if (create)14511451+ /* the macvlan port may be freed by macvlan_uninit when fail to register.14521452+ * so we destroy the macvlan port only when it's valid.14531453+ */14541454+ if (create && macvlan_port_get_rtnl(dev))14501455 macvlan_port_destroy(port->dev);14511456 return err;14521457}
+4-2
drivers/net/phy/mdio-sun4i.c
···118118119119 data->regulator = devm_regulator_get(&pdev->dev, "phy");120120 if (IS_ERR(data->regulator)) {121121- if (PTR_ERR(data->regulator) == -EPROBE_DEFER)122122- return -EPROBE_DEFER;121121+ if (PTR_ERR(data->regulator) == -EPROBE_DEFER) {122122+ ret = -EPROBE_DEFER;123123+ goto err_out_free_mdiobus;124124+ }123125124126 dev_info(&pdev->dev, "no regulator found\n");125127 data->regulator = NULL;
+3-2
drivers/net/phy/phylink.c
···12961296 switch (cmd) {12971297 case SIOCGMIIPHY:12981298 mii->phy_id = pl->phydev->mdio.addr;12991299+ /* fall through */1299130013001301 case SIOCGMIIREG:13011302 ret = phylink_phy_read(pl, mii->phy_id, mii->reg_num);···13191318 switch (cmd) {13201319 case SIOCGMIIPHY:13211320 mii->phy_id = 0;13211321+ /* fall through */1322132213231323 case SIOCGMIIREG:13241324 ret = phylink_mii_read(pl, mii->phy_id, mii->reg_num);···14311429 WARN_ON(!lockdep_rtnl_is_held());1432143014331431 set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);14321432+ queue_work(system_power_efficient_wq, &pl->resolve);14341433 flush_work(&pl->resolve);14351435-14361436- netif_carrier_off(pl->netdev);14371434}1438143514391436static void phylink_sfp_link_up(void *upstream)
···4545 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);46464747 if (WCN36XX_BMPS != vif_priv->pw_state) {4848- wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n");4949- return -EINVAL;4848+ /* Unbalanced call or last BMPS enter failed */4949+ wcn36xx_dbg(WCN36XX_DBG_PMC,5050+ "Not in BMPS mode, no need to exit\n");5151+ return -EALREADY;5052 }5153 wcn36xx_smd_exit_bmps(wcn, vif);5254 vif_priv->pw_state = WCN36XX_FULL_POWER;
···448448 return (void **)(iod->sg + blk_rq_nr_phys_segments(req));449449}450450451451+static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req)452452+{453453+ struct nvme_iod *iod = blk_mq_rq_to_pdu(req);454454+ unsigned int avg_seg_size;455455+456456+ avg_seg_size = DIV_ROUND_UP(blk_rq_payload_bytes(req),457457+ blk_rq_nr_phys_segments(req));458458+459459+ if (!(dev->ctrl.sgls & ((1 << 0) | (1 << 1))))460460+ return false;461461+ if (!iod->nvmeq->qid)462462+ return false;463463+ if (!sgl_threshold || avg_seg_size < sgl_threshold)464464+ return false;465465+ return true;466466+}467467+451468static blk_status_t nvme_init_iod(struct request *rq, struct nvme_dev *dev)452469{453470 struct nvme_iod *iod = blk_mq_rq_to_pdu(rq);454471 int nseg = blk_rq_nr_phys_segments(rq);455472 unsigned int size = blk_rq_payload_bytes(rq);473473+474474+ iod->use_sgl = nvme_pci_use_sgls(dev, rq);456475457476 if (nseg > NVME_INT_PAGES || size > NVME_INT_BYTES(dev)) {458477 size_t alloc_size = nvme_pci_iod_alloc_size(dev, size, nseg,···623604 dma_addr_t prp_dma;624605 int nprps, i;625606626626- iod->use_sgl = false;627627-628607 length -= (page_size - offset);629608 if (length <= 0) {630609 iod->first_dma = 0;···732715 int entries = iod->nents, i = 0;733716 dma_addr_t sgl_dma;734717735735- iod->use_sgl = true;736736-737718 /* setting the transfer type as SGL */738719 cmd->flags = NVME_CMD_SGL_METABUF;739720···785770 return BLK_STS_OK;786771}787772788788-static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req)789789-{790790- struct nvme_iod *iod = blk_mq_rq_to_pdu(req);791791- unsigned int avg_seg_size;792792-793793- avg_seg_size = DIV_ROUND_UP(blk_rq_payload_bytes(req),794794- blk_rq_nr_phys_segments(req));795795-796796- if (!(dev->ctrl.sgls & ((1 << 0) | (1 << 1))))797797- return false;798798- if (!iod->nvmeq->qid)799799- return false;800800- if (!sgl_threshold || avg_seg_size < sgl_threshold)801801- return false;802802- return true;803803-}804804-805773static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,806774 struct nvme_command *cmnd)807775{···804806 DMA_ATTR_NO_WARN))805807 goto out;806808807807- if (nvme_pci_use_sgls(dev, req))809809+ if (iod->use_sgl)808810 ret = nvme_pci_setup_sgls(dev, req, &cmnd->rw);809811 else810812 ret = nvme_pci_setup_prps(dev, req, &cmnd->rw);
+13-1
drivers/nvme/host/rdma.c
···974974 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);975975 nvme_start_queues(&ctrl->ctrl);976976977977+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {978978+ /* state change failure should never happen */979979+ WARN_ON_ONCE(1);980980+ return;981981+ }982982+977983 nvme_rdma_reconnect_or_remove(ctrl);978984}979985980986static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)981987{982982- if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING))988988+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))983989 return;984990985991 queue_work(nvme_wq, &ctrl->err_work);···1758175217591753 nvme_stop_ctrl(&ctrl->ctrl);17601754 nvme_rdma_shutdown_ctrl(ctrl, false);17551755+17561756+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {17571757+ /* state change failure should never happen */17581758+ WARN_ON_ONCE(1);17591759+ return;17601760+ }1761176117621762 ret = nvme_rdma_configure_admin_queue(ctrl, false);17631763 if (ret)
···2323#define _UAPI_LINUX_IF_ETHER_H24242525#include <linux/types.h>2626+#include <linux/libc-compat.h>26272728/*2829 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble···150149 * This is an Ethernet frame header.151150 */152151152152+#if __UAPI_DEF_ETHHDR153153struct ethhdr {154154 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */155155 unsigned char h_source[ETH_ALEN]; /* source ether addr */156156 __be16 h_proto; /* packet type ID field */157157} __attribute__((packed));158158+#endif158159159160160161#endif /* _UAPI_LINUX_IF_ETHER_H */
+60-1
include/uapi/linux/libc-compat.h
···168168169169/* If we did not see any headers from any supported C libraries,170170 * or we are being included in the kernel, then define everything171171- * that we need. */171171+ * that we need. Check for previous __UAPI_* definitions to give172172+ * unsupported C libraries a way to opt out of any kernel definition. */172173#else /* !defined(__GLIBC__) */173174174175/* Definitions for if.h */176176+#ifndef __UAPI_DEF_IF_IFCONF175177#define __UAPI_DEF_IF_IFCONF 1178178+#endif179179+#ifndef __UAPI_DEF_IF_IFMAP176180#define __UAPI_DEF_IF_IFMAP 1181181+#endif182182+#ifndef __UAPI_DEF_IF_IFNAMSIZ177183#define __UAPI_DEF_IF_IFNAMSIZ 1184184+#endif185185+#ifndef __UAPI_DEF_IF_IFREQ178186#define __UAPI_DEF_IF_IFREQ 1187187+#endif179188/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */189189+#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS180190#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1191191+#endif181192/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */193193+#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO182194#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1195195+#endif183196184197/* Definitions for in.h */198198+#ifndef __UAPI_DEF_IN_ADDR185199#define __UAPI_DEF_IN_ADDR 1200200+#endif201201+#ifndef __UAPI_DEF_IN_IPPROTO186202#define __UAPI_DEF_IN_IPPROTO 1203203+#endif204204+#ifndef __UAPI_DEF_IN_PKTINFO187205#define __UAPI_DEF_IN_PKTINFO 1206206+#endif207207+#ifndef __UAPI_DEF_IP_MREQ188208#define __UAPI_DEF_IP_MREQ 1209209+#endif210210+#ifndef __UAPI_DEF_SOCKADDR_IN189211#define __UAPI_DEF_SOCKADDR_IN 1212212+#endif213213+#ifndef __UAPI_DEF_IN_CLASS190214#define __UAPI_DEF_IN_CLASS 1215215+#endif191216192217/* Definitions for in6.h */218218+#ifndef __UAPI_DEF_IN6_ADDR193219#define __UAPI_DEF_IN6_ADDR 1220220+#endif221221+#ifndef __UAPI_DEF_IN6_ADDR_ALT194222#define __UAPI_DEF_IN6_ADDR_ALT 1223223+#endif224224+#ifndef __UAPI_DEF_SOCKADDR_IN6195225#define __UAPI_DEF_SOCKADDR_IN6 1226226+#endif227227+#ifndef __UAPI_DEF_IPV6_MREQ196228#define __UAPI_DEF_IPV6_MREQ 1229229+#endif230230+#ifndef __UAPI_DEF_IPPROTO_V6197231#define __UAPI_DEF_IPPROTO_V6 1232232+#endif233233+#ifndef __UAPI_DEF_IPV6_OPTIONS198234#define __UAPI_DEF_IPV6_OPTIONS 1235235+#endif236236+#ifndef __UAPI_DEF_IN6_PKTINFO199237#define __UAPI_DEF_IN6_PKTINFO 1238238+#endif239239+#ifndef __UAPI_DEF_IP6_MTUINFO200240#define __UAPI_DEF_IP6_MTUINFO 1241241+#endif201242202243/* Definitions for ipx.h */244244+#ifndef __UAPI_DEF_SOCKADDR_IPX203245#define __UAPI_DEF_SOCKADDR_IPX 1246246+#endif247247+#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION204248#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1249249+#endif250250+#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION205251#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1252252+#endif253253+#ifndef __UAPI_DEF_IPX_CONFIG_DATA206254#define __UAPI_DEF_IPX_CONFIG_DATA 1255255+#endif256256+#ifndef __UAPI_DEF_IPX_ROUTE_DEF207257#define __UAPI_DEF_IPX_ROUTE_DEF 1258258+#endif208259209260/* Definitions for xattr.h */261261+#ifndef __UAPI_DEF_XATTR210262#define __UAPI_DEF_XATTR 1263263+#endif211264212265#endif /* __GLIBC__ */266266+267267+/* Definitions for if_ether.h */268268+/* allow libcs like musl to deactivate this, glibc does not implement this. */269269+#ifndef __UAPI_DEF_ETHHDR270270+#define __UAPI_DEF_ETHHDR 1271271+#endif213272214273#endif /* _UAPI_LIBC_COMPAT_H */
···13961396 Enable the bpf() system call that allows to manipulate eBPF13971397 programs and maps via file descriptors.1398139813991399+config BPF_JIT_ALWAYS_ON14001400+ bool "Permanently enable BPF JIT and remove BPF interpreter"14011401+ depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT14021402+ help14031403+ Enables BPF JIT and removes BPF interpreter to avoid14041404+ speculative execution of BPF instructions by the interpreter14051405+13991406config USERFAULTFD14001407 bool "Enable userfaultfd() system call"14011408 select ANON_INODES
···767767}768768EXPORT_SYMBOL_GPL(__bpf_call_base);769769770770+#ifndef CONFIG_BPF_JIT_ALWAYS_ON770771/**771772 * __bpf_prog_run - run eBPF program on a given context772773 * @ctx: is the data we are operating on···13181317EVAL4(PROG_NAME_LIST, 416, 448, 480, 512)13191318};1320131913201320+#else13211321+static unsigned int __bpf_prog_ret0(const void *ctx,13221322+ const struct bpf_insn *insn)13231323+{13241324+ return 0;13251325+}13261326+#endif13271327+13211328bool bpf_prog_array_compatible(struct bpf_array *array,13221329 const struct bpf_prog *fp)13231330{···13731364 */13741365struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err)13751366{13671367+#ifndef CONFIG_BPF_JIT_ALWAYS_ON13761368 u32 stack_depth = max_t(u32, fp->aux->stack_depth, 1);1377136913781370 fp->bpf_func = interpreters[(round_up(stack_depth, 32) / 32) - 1];13711371+#else13721372+ fp->bpf_func = __bpf_prog_ret0;13731373+#endif1379137413801375 /* eBPF JITs can rewrite the program in case constant13811376 * blinding is active. However, in case of error during···13891376 */13901377 if (!bpf_prog_is_dev_bound(fp->aux)) {13911378 fp = bpf_int_jit_compile(fp);13791379+#ifdef CONFIG_BPF_JIT_ALWAYS_ON13801380+ if (!fp->jited) {13811381+ *err = -ENOTSUPP;13821382+ return fp;13831383+ }13841384+#endif13921385 } else {13931386 *err = bpf_prog_offload_compile(fp);13941387 if (*err)
+39-1
kernel/bpf/inode.c
···368368 putname(pname);369369 return ret;370370}371371-EXPORT_SYMBOL_GPL(bpf_obj_get_user);371371+372372+static struct bpf_prog *__get_prog_inode(struct inode *inode, enum bpf_prog_type type)373373+{374374+ struct bpf_prog *prog;375375+ int ret = inode_permission(inode, MAY_READ | MAY_WRITE);376376+ if (ret)377377+ return ERR_PTR(ret);378378+379379+ if (inode->i_op == &bpf_map_iops)380380+ return ERR_PTR(-EINVAL);381381+ if (inode->i_op != &bpf_prog_iops)382382+ return ERR_PTR(-EACCES);383383+384384+ prog = inode->i_private;385385+386386+ ret = security_bpf_prog(prog);387387+ if (ret < 0)388388+ return ERR_PTR(ret);389389+390390+ if (!bpf_prog_get_ok(prog, &type, false))391391+ return ERR_PTR(-EINVAL);392392+393393+ return bpf_prog_inc(prog);394394+}395395+396396+struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type type)397397+{398398+ struct bpf_prog *prog;399399+ struct path path;400400+ int ret = kern_path(name, LOOKUP_FOLLOW, &path);401401+ if (ret)402402+ return ERR_PTR(ret);403403+ prog = __get_prog_inode(d_backing_inode(path.dentry), type);404404+ if (!IS_ERR(prog))405405+ touch_atime(&path);406406+ path_put(&path);407407+ return prog;408408+}409409+EXPORT_SYMBOL(bpf_prog_get_type_path);372410373411static void bpf_evict_inode(struct inode *inode)374412{
+9-2
kernel/bpf/sockmap.c
···591591592592 write_lock_bh(&sock->sk_callback_lock);593593 psock = smap_psock_sk(sock);594594- smap_list_remove(psock, &stab->sock_map[i]);595595- smap_release_sock(psock, sock);594594+ /* This check handles a racing sock event that can get the595595+ * sk_callback_lock before this case but after xchg happens596596+ * causing the refcnt to hit zero and sock user data (psock)597597+ * to be null and queued for garbage collection.598598+ */599599+ if (likely(psock)) {600600+ smap_list_remove(psock, &stab->sock_map[i]);601601+ smap_release_sock(psock, sock);602602+ }596603 write_unlock_bh(&sock->sk_callback_lock);597604 }598605 rcu_read_unlock();
+1-1
kernel/bpf/syscall.c
···10571057}10581058EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);1059105910601060-static bool bpf_prog_get_ok(struct bpf_prog *prog,10601060+bool bpf_prog_get_ok(struct bpf_prog *prog,10611061 enum bpf_prog_type *attach_type, bool attach_drv)10621062{10631063 /* not an attachment, just a refcount inc, always allow */
+36
kernel/bpf/verifier.c
···17291729 err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta);17301730 if (err)17311731 return err;17321732+ if (func_id == BPF_FUNC_tail_call) {17331733+ if (meta.map_ptr == NULL) {17341734+ verbose(env, "verifier bug\n");17351735+ return -EINVAL;17361736+ }17371737+ env->insn_aux_data[insn_idx].map_ptr = meta.map_ptr;17381738+ }17321739 err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta);17331740 if (err)17341741 return err;···44634456 */44644457 insn->imm = 0;44654458 insn->code = BPF_JMP | BPF_TAIL_CALL;44594459+44604460+ /* instead of changing every JIT dealing with tail_call44614461+ * emit two extra insns:44624462+ * if (index >= max_entries) goto out;44634463+ * index &= array->index_mask;44644464+ * to avoid out-of-bounds cpu speculation44654465+ */44664466+ map_ptr = env->insn_aux_data[i + delta].map_ptr;44674467+ if (map_ptr == BPF_MAP_PTR_POISON) {44684468+ verbose(env, "tail_call obusing map_ptr\n");44694469+ return -EINVAL;44704470+ }44714471+ if (!map_ptr->unpriv_array)44724472+ continue;44734473+ insn_buf[0] = BPF_JMP_IMM(BPF_JGE, BPF_REG_3,44744474+ map_ptr->max_entries, 2);44754475+ insn_buf[1] = BPF_ALU32_IMM(BPF_AND, BPF_REG_3,44764476+ container_of(map_ptr,44774477+ struct bpf_array,44784478+ map)->index_mask);44794479+ insn_buf[2] = *insn;44804480+ cnt = 3;44814481+ new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);44824482+ if (!new_prog)44834483+ return -ENOMEM;44844484+44854485+ delta += cnt - 1;44864486+ env->prog = prog = new_prog;44874487+ insn = new_prog->insnsi + i + delta;44664488 continue;44674489 }44684490
+5-1
kernel/cgroup/cgroup-v1.c
···123123 */124124 do {125125 css_task_iter_start(&from->self, 0, &it);126126- task = css_task_iter_next(&it);126126+127127+ do {128128+ task = css_task_iter_next(&it);129129+ } while (task && (task->flags & PF_EXITING));130130+127131 if (task)128132 get_task_struct(task);129133 css_task_iter_end(&it);
+9-11
kernel/cgroup/cgroup.c
···13971397 cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,13981398 cft->name);13991399 else14001400- strncpy(buf, cft->name, CGROUP_FILE_NAME_MAX);14001400+ strlcpy(buf, cft->name, CGROUP_FILE_NAME_MAX);14011401 return buf;14021402}14031403···1864186418651865 root->flags = opts->flags;18661866 if (opts->release_agent)18671867- strcpy(root->release_agent_path, opts->release_agent);18671867+ strlcpy(root->release_agent_path, opts->release_agent, PATH_MAX);18681868 if (opts->name)18691869- strcpy(root->name, opts->name);18691869+ strlcpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);18701870 if (opts->cpuset_clone_children)18711871 set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);18721872}···4125412541264126static void css_task_iter_advance(struct css_task_iter *it)41274127{41284128- struct list_head *l = it->task_pos;41284128+ struct list_head *next;4129412941304130 lockdep_assert_held(&css_set_lock);41314131- WARN_ON_ONCE(!l);41324132-41334131repeat:41344132 /*41354133 * Advance iterator to find next entry. cset->tasks is consumed41364134 * first and then ->mg_tasks. After ->mg_tasks, we move onto the41374135 * next cset.41384136 */41394139- l = l->next;41374137+ next = it->task_pos->next;4140413841414141- if (l == it->tasks_head)41424142- l = it->mg_tasks_head->next;41394139+ if (next == it->tasks_head)41404140+ next = it->mg_tasks_head->next;4143414141444144- if (l == it->mg_tasks_head)41424142+ if (next == it->mg_tasks_head)41454143 css_task_iter_advance_css_set(it);41464144 else41474147- it->task_pos = l;41454145+ it->task_pos = next;4148414641494147 /* if PROCS, skip over tasks which aren't group leaders */41504148 if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos &&
···111111 vlan_gvrp_uninit_applicant(real_dev);112112 }113113114114- /* Take it out of our own structures, but be sure to interlock with115115- * HW accelerating devices or SW vlan input packet processing if116116- * VLAN is not 0 (leave it there for 802.1p).117117- */118118- if (vlan_id)119119- vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id);114114+ vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id);120115121116 /* Get rid of the vlan's reference to real_dev */122117 dev_put(real_dev);
···11461146int dev_get_valid_name(struct net *net, struct net_device *dev,11471147 const char *name)11481148{11491149- return dev_alloc_name_ns(net, dev, name);11491149+ BUG_ON(!net);11501150+11511151+ if (!dev_valid_name(name))11521152+ return -EINVAL;11531153+11541154+ if (strchr(name, '%'))11551155+ return dev_alloc_name_ns(net, dev, name);11561156+ else if (__dev_get_by_name(net, name))11571157+ return -EEXIST;11581158+ else if (dev->name != name)11591159+ strlcpy(dev->name, name, IFNAMSIZ);11601160+11611161+ return 0;11501162}11511163EXPORT_SYMBOL(dev_get_valid_name);11521164
+2-13
net/core/ethtool.c
···770770 return dev->ethtool_ops->set_link_ksettings(dev, &link_ksettings);771771}772772773773-static void774774-warn_incomplete_ethtool_legacy_settings_conversion(const char *details)775775-{776776- char name[sizeof(current->comm)];777777-778778- pr_info_once("warning: `%s' uses legacy ethtool link settings API, %s\n",779779- get_task_comm(name, current), details);780780-}781781-782773/* Query device for its ethtool_cmd settings.783774 *784775 * Backward compatibility note: for compatibility with legacy ethtool,···796805 &link_ksettings);797806 if (err < 0)798807 return err;799799- if (!convert_link_ksettings_to_legacy_settings(&cmd,800800- &link_ksettings))801801- warn_incomplete_ethtool_legacy_settings_conversion(802802- "link modes are only partially reported");808808+ convert_link_ksettings_to_legacy_settings(&cmd,809809+ &link_ksettings);803810804811 /* send a sensible cmd tag back to user */805812 cmd.cmd = ETHTOOL_GSET;
+2-4
net/core/filter.c
···10541054 */10551055 goto out_err_free;1056105610571057- /* We are guaranteed to never error here with cBPF to eBPF10581058- * transitions, since there's no issue with type compatibility10591059- * checks on program arrays.10601060- */10611057 fp = bpf_prog_select_runtime(fp, &err);10581058+ if (err)10591059+ goto out_err_free;1062106010631061 kfree(old_prog);10641062 return fp;
+5-5
net/core/rtnetlink.c
···16811681 return false;16821682}1683168316841684-static struct net *get_target_net(struct sk_buff *skb, int netnsid)16841684+static struct net *get_target_net(struct sock *sk, int netnsid)16851685{16861686 struct net *net;1687168716881688- net = get_net_ns_by_id(sock_net(skb->sk), netnsid);16881688+ net = get_net_ns_by_id(sock_net(sk), netnsid);16891689 if (!net)16901690 return ERR_PTR(-EINVAL);1691169116921692 /* For now, the caller is required to have CAP_NET_ADMIN in16931693 * the user namespace owning the target net ns.16941694 */16951695- if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {16951695+ if (!sk_ns_capable(sk, net->user_ns, CAP_NET_ADMIN)) {16961696 put_net(net);16971697 return ERR_PTR(-EACCES);16981698 }···17331733 ifla_policy, NULL) >= 0) {17341734 if (tb[IFLA_IF_NETNSID]) {17351735 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);17361736- tgt_net = get_target_net(skb, netnsid);17361736+ tgt_net = get_target_net(skb->sk, netnsid);17371737 if (IS_ERR(tgt_net)) {17381738 tgt_net = net;17391739 netnsid = -1;···2883288328842884 if (tb[IFLA_IF_NETNSID]) {28852885 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);28862886- tgt_net = get_target_net(skb, netnsid);28862886+ tgt_net = get_target_net(NETLINK_CB(skb).sk, netnsid);28872887 if (IS_ERR(tgt_net))28882888 return PTR_ERR(tgt_net);28892889 }
+1-1
net/core/sock_diag.c
···288288 case SKNLGRP_INET6_UDP_DESTROY:289289 if (!sock_diag_handlers[AF_INET6])290290 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,291291- NETLINK_SOCK_DIAG, AF_INET);291291+ NETLINK_SOCK_DIAG, AF_INET6);292292 break;293293 }294294 return 0;
···520520 goto out;521521522522 /* hdrincl should be READ_ONCE(inet->hdrincl)523523- * but READ_ONCE() doesn't work with bit fields523523+ * but READ_ONCE() doesn't work with bit fields.524524+ * Doing this indirectly yields the same result.524525 */525526 hdrincl = inet->hdrincl;527527+ hdrincl = READ_ONCE(hdrincl);526528 /*527529 * Check the flags.528530 */
···640640 if (!(fn->fn_flags & RTN_RTINFO)) {641641 RCU_INIT_POINTER(fn->leaf, NULL);642642 rt6_release(leaf);643643+ /* remove null_entry in the root node */644644+ } else if (fn->fn_flags & RTN_TL_ROOT &&645645+ rcu_access_pointer(fn->leaf) ==646646+ net->ipv6.ip6_null_entry) {647647+ RCU_INIT_POINTER(fn->leaf, NULL);643648 }644649645650 return fn;···12461241 * If fib6_add_1 has cleared the old leaf pointer in the12471242 * super-tree leaf node we have to find a new one for it.12481243 */12491249- struct rt6_info *pn_leaf = rcu_dereference_protected(pn->leaf,12501250- lockdep_is_held(&table->tb6_lock));12511251- if (pn != fn && pn_leaf == rt) {12521252- pn_leaf = NULL;12531253- RCU_INIT_POINTER(pn->leaf, NULL);12541254- atomic_dec(&rt->rt6i_ref);12551255- }12561256- if (pn != fn && !pn_leaf && !(pn->fn_flags & RTN_RTINFO)) {12571257- pn_leaf = fib6_find_prefix(info->nl_net, table, pn);12581258-#if RT6_DEBUG >= 212591259- if (!pn_leaf) {12601260- WARN_ON(!pn_leaf);12611261- pn_leaf = info->nl_net->ipv6.ip6_null_entry;12441244+ if (pn != fn) {12451245+ struct rt6_info *pn_leaf =12461246+ rcu_dereference_protected(pn->leaf,12471247+ lockdep_is_held(&table->tb6_lock));12481248+ if (pn_leaf == rt) {12491249+ pn_leaf = NULL;12501250+ RCU_INIT_POINTER(pn->leaf, NULL);12511251+ atomic_dec(&rt->rt6i_ref);12621252 }12531253+ if (!pn_leaf && !(pn->fn_flags & RTN_RTINFO)) {12541254+ pn_leaf = fib6_find_prefix(info->nl_net, table,12551255+ pn);12561256+#if RT6_DEBUG >= 212571257+ if (!pn_leaf) {12581258+ WARN_ON(!pn_leaf);12591259+ pn_leaf =12601260+ info->nl_net->ipv6.ip6_null_entry;12611261+ }12631262#endif12641264- atomic_inc(&pn_leaf->rt6i_ref);12651265- rcu_assign_pointer(pn->leaf, pn_leaf);12631263+ atomic_inc(&pn_leaf->rt6i_ref);12641264+ rcu_assign_pointer(pn->leaf, pn_leaf);12651265+ }12661266 }12671267#endif12681268 goto failure;···12751265 return err;1276126612771267failure:12781278- /* fn->leaf could be NULL if fn is an intermediate node and we12791279- * failed to add the new route to it in both subtree creation12801280- * failure and fib6_add_rt2node() failure case.12811281- * In both cases, fib6_repair_tree() should be called to fix12821282- * fn->leaf.12681268+ /* fn->leaf could be NULL and fib6_repair_tree() needs to be called if:12691269+ * 1. fn is an intermediate node and we failed to add the new12701270+ * route to it in both subtree creation failure and fib6_add_rt2node()12711271+ * failure case.12721272+ * 2. fn is the root node in the table and we fail to add the first12731273+ * default route to it.12831274 */12841284- if (fn && !(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)))12751275+ if (fn &&12761276+ (!(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)) ||12771277+ (fn->fn_flags & RTN_TL_ROOT &&12781278+ !rcu_access_pointer(fn->leaf))))12851279 fib6_repair_tree(info->nl_net, table, fn);12861280 /* Always release dst as dst->__refcnt is guaranteed12871281 * to be taken before entering this function···15401526 struct fib6_walker *w;15411527 int iter = 0;1542152815291529+ /* Set fn->leaf to null_entry for root node. */15301530+ if (fn->fn_flags & RTN_TL_ROOT) {15311531+ rcu_assign_pointer(fn->leaf, net->ipv6.ip6_null_entry);15321532+ return fn;15331533+ }15341534+15431535 for (;;) {15441536 struct fib6_node *fn_r = rcu_dereference_protected(fn->right,15451537 lockdep_is_held(&table->tb6_lock));···17001680 }17011681 read_unlock(&net->ipv6.fib6_walker_lock);1702168217031703- /* If it was last route, expunge its radix tree node */16831683+ /* If it was last route, call fib6_repair_tree() to:16841684+ * 1. For root node, put back null_entry as how the table was created.16851685+ * 2. For other nodes, expunge its radix tree node.16861686+ */17041687 if (!rcu_access_pointer(fn->leaf)) {17051705- fn->fn_flags &= ~RTN_RTINFO;17061706- net->ipv6.rt6_stats->fib_route_nodes--;16881688+ if (!(fn->fn_flags & RTN_TL_ROOT)) {16891689+ fn->fn_flags &= ~RTN_RTINFO;16901690+ net->ipv6.rt6_stats->fib_route_nodes--;16911691+ }17071692 fn = fib6_repair_tree(net, table, fn);17081693 }17091694
···10741074 memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));10751075 neigh_release(neigh);10761076 }10771077- } else if (!(t->parms.flags &10781078- (IP6_TNL_F_USE_ORIG_TCLASS | IP6_TNL_F_USE_ORIG_FWMARK))) {10791079- /* enable the cache only only if the routing decision does10801080- * not depend on the current inner header value10771077+ } else if (t->parms.proto != 0 && !(t->parms.flags &10781078+ (IP6_TNL_F_USE_ORIG_TCLASS |10791079+ IP6_TNL_F_USE_ORIG_FWMARK))) {10801080+ /* enable the cache only if neither the outer protocol nor the10811081+ * routing decision depends on the current inner header value10811082 */10821083 use_cache = true;10831084 }···16771676{16781677 struct ip6_tnl *tnl = netdev_priv(dev);1679167816801680- if (tnl->parms.proto == IPPROTO_IPIP) {16811681- if (new_mtu < ETH_MIN_MTU)16791679+ if (tnl->parms.proto == IPPROTO_IPV6) {16801680+ if (new_mtu < IPV6_MIN_MTU)16821681 return -EINVAL;16831682 } else {16841684- if (new_mtu < IPV6_MIN_MTU)16831683+ if (new_mtu < ETH_MIN_MTU)16851684 return -EINVAL;16861685 }16871686 if (new_mtu > 0xFFF8 - dev->hard_header_len)
+2
net/mac80211/rx.c
···36323632 }36333633 return true;36343634 case NL80211_IFTYPE_MESH_POINT:36353635+ if (ether_addr_equal(sdata->vif.addr, hdr->addr2))36363636+ return false;36353637 if (multicast)36363638 return true;36373639 return ether_addr_equal(sdata->vif.addr, hdr->addr1);
···525525526526 local_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;527527528528+ if (args->nr_local == 0)529529+ return -EINVAL;530530+528531 /* figure out the number of pages in the vector */529532 for (i = 0; i < args->nr_local; i++) {530533 if (copy_from_user(&vec, &local_vec[i],···877874err:878875 if (page)879876 put_page(page);877877+ rm->atomic.op_active = 0;880878 kfree(rm->atomic.op_notifier);881879882880 return ret;
···399399 return;400400 }401401402402- if (t->param_flags & SPP_PMTUD_ENABLE) {403403- /* Update transports view of the MTU */404404- sctp_transport_update_pmtu(t, pmtu);402402+ if (!(t->param_flags & SPP_PMTUD_ENABLE))403403+ /* We can't allow retransmitting in such case, as the404404+ * retransmission would be sized just as before, and thus we405405+ * would get another icmp, and retransmit again.406406+ */407407+ return;405408406406- /* Update association pmtu. */407407- sctp_assoc_sync_pmtu(asoc);408408- }409409-410410- /* Retransmit with the new pmtu setting.411411- * Normally, if PMTU discovery is disabled, an ICMP Fragmentation412412- * Needed will never be sent, but if a message was sent before413413- * PMTU discovery was disabled that was larger than the PMTU, it414414- * would not be fragmented, so it must be re-transmitted fragmented.409409+ /* Update transports view of the MTU. Return if no update was needed.410410+ * If an update wasn't needed/possible, it also doesn't make sense to411411+ * try to retransmit now.415412 */413413+ if (!sctp_transport_update_pmtu(t, pmtu))414414+ return;415415+416416+ /* Update association pmtu. */417417+ sctp_assoc_sync_pmtu(asoc);418418+419419+ /* Retransmit with the new pmtu setting. */416420 sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD);417421}418422
+21-7
net/sctp/socket.c
···2277227722782278 if (asoc && sctp_outq_is_empty(&asoc->outqueue)) {22792279 event = sctp_ulpevent_make_sender_dry_event(asoc,22802280- GFP_ATOMIC);22802280+ GFP_USER | __GFP_NOWARN);22812281 if (!event)22822282 return -ENOMEM;22832283···3498349834993499 if (optlen < sizeof(struct sctp_hmacalgo))35003500 return -EINVAL;35013501+ optlen = min_t(unsigned int, optlen, sizeof(struct sctp_hmacalgo) +35023502+ SCTP_AUTH_NUM_HMACS * sizeof(u16));3501350335023504 hmacs = memdup_user(optval, optlen);35033505 if (IS_ERR(hmacs))···3538353635393537 if (optlen <= sizeof(struct sctp_authkey))35403538 return -EINVAL;35393539+ /* authkey->sca_keylength is u16, so optlen can't be bigger than35403540+ * this.35413541+ */35423542+ optlen = min_t(unsigned int, optlen, USHRT_MAX +35433543+ sizeof(struct sctp_authkey));3541354435423545 authkey = memdup_user(optval, optlen);35433546 if (IS_ERR(authkey))···3900389339013894 if (optlen < sizeof(*params))39023895 return -EINVAL;38963896+ /* srs_number_streams is u16, so optlen can't be bigger than this. */38973897+ optlen = min_t(unsigned int, optlen, USHRT_MAX +38983898+ sizeof(__u16) * sizeof(*params));3903389939043900 params = memdup_user(optval, optlen);39053901 if (IS_ERR(params))···50255015 len = sizeof(int);50265016 if (put_user(len, optlen))50275017 return -EFAULT;50285028- if (copy_to_user(optval, &sctp_sk(sk)->autoclose, sizeof(int)))50185018+ if (copy_to_user(optval, &sctp_sk(sk)->autoclose, len))50295019 return -EFAULT;50305020 return 0;50315021}···56555645 err = -EFAULT;56565646 goto out;56575647 }56485648+ /* XXX: We should have accounted for sizeof(struct sctp_getaddrs) too,56495649+ * but we can't change it anymore.56505650+ */56585651 if (put_user(bytes_copied, optlen))56595652 err = -EFAULT;56605653out:···60946081 params.assoc_id = 0;60956082 } else if (len >= sizeof(struct sctp_assoc_value)) {60966083 len = sizeof(struct sctp_assoc_value);60976097- if (copy_from_user(¶ms, optval, sizeof(params)))60846084+ if (copy_from_user(¶ms, optval, len))60986085 return -EFAULT;60996086 } else61006087 return -EINVAL;···6264625162656252 if (len < sizeof(struct sctp_authkeyid))62666253 return -EINVAL;62676267- if (copy_from_user(&val, optval, sizeof(struct sctp_authkeyid)))62546254+62556255+ len = sizeof(struct sctp_authkeyid);62566256+ if (copy_from_user(&val, optval, len))62686257 return -EFAULT;6269625862706259 asoc = sctp_id2assoc(sk, val.scact_assoc_id);···62786263 else62796264 val.scact_keynumber = ep->active_key_id;6280626562816281- len = sizeof(struct sctp_authkeyid);62826266 if (put_user(len, optlen))62836267 return -EFAULT;62846268 if (copy_to_user(optval, &val, len))···63036289 if (len < sizeof(struct sctp_authchunks))63046290 return -EINVAL;6305629163066306- if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks)))62926292+ if (copy_from_user(&val, optval, sizeof(val)))63076293 return -EFAULT;6308629463096295 to = p->gauth_chunks;···63486334 if (len < sizeof(struct sctp_authchunks))63496335 return -EINVAL;6350633663516351- if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks)))63376337+ if (copy_from_user(&val, optval, sizeof(val)))63526338 return -EFAULT;6353633963546340 to = p->gauth_chunks;
+10-12
net/sctp/stream.c
···156156 sctp_stream_outq_migrate(stream, NULL, outcnt);157157 sched->sched_all(stream);158158159159- i = sctp_stream_alloc_out(stream, outcnt, gfp);160160- if (i)161161- return i;159159+ ret = sctp_stream_alloc_out(stream, outcnt, gfp);160160+ if (ret)161161+ goto out;162162163163 stream->outcnt = outcnt;164164 for (i = 0; i < stream->outcnt; i++)···170170 if (!incnt)171171 goto out;172172173173- i = sctp_stream_alloc_in(stream, incnt, gfp);174174- if (i) {175175- ret = -ENOMEM;176176- goto free;173173+ ret = sctp_stream_alloc_in(stream, incnt, gfp);174174+ if (ret) {175175+ sched->free(stream);176176+ kfree(stream->out);177177+ stream->out = NULL;178178+ stream->outcnt = 0;179179+ goto out;177180 }178181179182 stream->incnt = incnt;180180- goto out;181183182182-free:183183- sched->free(stream);184184- kfree(stream->out);185185- stream->out = NULL;186184out:187185 return ret;188186}
+19-10
net/sctp/transport.c
···248248 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;249249}250250251251-void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)251251+bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)252252{253253 struct dst_entry *dst = sctp_transport_dst_check(t);254254+ bool change = true;254255255256 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {256256- pr_warn("%s: Reported pmtu %d too low, using default minimum of %d\n",257257- __func__, pmtu, SCTP_DEFAULT_MINSEGMENT);258258- /* Use default minimum segment size and disable259259- * pmtu discovery on this transport.260260- */261261- t->pathmtu = SCTP_DEFAULT_MINSEGMENT;262262- } else {263263- t->pathmtu = pmtu;257257+ pr_warn_ratelimited("%s: Reported pmtu %d too low, using default minimum of %d\n",258258+ __func__, pmtu, SCTP_DEFAULT_MINSEGMENT);259259+ /* Use default minimum segment instead */260260+ pmtu = SCTP_DEFAULT_MINSEGMENT;264261 }262262+ pmtu = SCTP_TRUNC4(pmtu);265263266264 if (dst) {267265 dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu);268266 dst = sctp_transport_dst_check(t);269267 }270268271271- if (!dst)269269+ if (!dst) {272270 t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk);271271+ dst = t->dst;272272+ }273273+274274+ if (dst) {275275+ /* Re-fetch, as under layers may have a higher minimum size */276276+ pmtu = SCTP_TRUNC4(dst_mtu(dst));277277+ change = t->pathmtu != pmtu;278278+ }279279+ t->pathmtu = pmtu;280280+281281+ return change;273282}274283275284/* Caches the dst entry and source address for a transport's destination
+12-1
net/socket.c
···436436{437437 struct file *newfile;438438 int fd = get_unused_fd_flags(flags);439439- if (unlikely(fd < 0))439439+ if (unlikely(fd < 0)) {440440+ sock_release(sock);440441 return fd;442442+ }441443442444 newfile = sock_alloc_file(sock, flags, NULL);443445 if (likely(!IS_ERR(newfile))) {···26202618}2621261926222620core_initcall(sock_init); /* early initcall */26212621+26222622+static int __init jit_init(void)26232623+{26242624+#ifdef CONFIG_BPF_JIT_ALWAYS_ON26252625+ bpf_jit_enable = 1;26262626+#endif26272627+ return 0;26282628+}26292629+pure_initcall(jit_init);2623263026242631#ifdef CONFIG_PROC_FS26252632void socket_seq_show(struct seq_file *seq)
+18-4
net/tipc/group.c
···109109static void tipc_group_decr_active(struct tipc_group *grp,110110 struct tipc_member *m)111111{112112- if (m->state == MBR_ACTIVE || m->state == MBR_RECLAIMING)112112+ if (m->state == MBR_ACTIVE || m->state == MBR_RECLAIMING ||113113+ m->state == MBR_REMITTED)113114 grp->active_cnt--;114115}115116···563562 int max_active = grp->max_active;564563 int reclaim_limit = max_active * 3 / 4;565564 int active_cnt = grp->active_cnt;566566- struct tipc_member *m, *rm;565565+ struct tipc_member *m, *rm, *pm;567566568567 m = tipc_group_find_member(grp, node, port);569568 if (!m)···606605 pr_warn_ratelimited("Rcv unexpected msg after REMIT\n");607606 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq);608607 }608608+ grp->active_cnt--;609609+ list_del_init(&m->list);610610+ if (list_empty(&grp->pending))611611+ return;612612+613613+ /* Set oldest pending member to active and advertise */614614+ pm = list_first_entry(&grp->pending, struct tipc_member, list);615615+ pm->state = MBR_ACTIVE;616616+ list_move_tail(&pm->list, &grp->active);617617+ grp->active_cnt++;618618+ tipc_group_proto_xmit(grp, pm, GRP_ADV_MSG, xmitq);609619 break;610620 case MBR_RECLAIMING:611621 case MBR_DISCOVERED:···754742 if (!m || m->state != MBR_RECLAIMING)755743 return;756744757757- list_del_init(&m->list);758758- grp->active_cnt--;759745 remitted = msg_grp_remitted(hdr);760746761747 /* Messages preceding the REMIT still in receive queue */762748 if (m->advertised > remitted) {763749 m->state = MBR_REMITTED;764750 in_flight = m->advertised - remitted;751751+ m->advertised = ADV_IDLE + in_flight;752752+ return;765753 }766754 /* All messages preceding the REMIT have been read */767755 if (m->advertised <= remitted) {···773761 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq);774762775763 m->advertised = ADV_IDLE + in_flight;764764+ grp->active_cnt--;765765+ list_del_init(&m->list);776766777767 /* Set oldest pending member to active and advertise */778768 if (list_empty(&grp->pending))
+2-1
net/wireless/nl80211.c
···1136111361 break;1136211362 case NL80211_NAN_FUNC_FOLLOW_UP:1136311363 if (!tb[NL80211_NAN_FUNC_FOLLOW_UP_ID] ||1136411364- !tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID]) {1136411364+ !tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID] ||1136511365+ !tb[NL80211_NAN_FUNC_FOLLOW_UP_DEST]) {1136511366 err = -EINVAL;1136611367 goto out;1136711368 }
+11-1
security/apparmor/mount.c
···329329 AA_BUG(!mntpath);330330 AA_BUG(!buffer);331331332332+ if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))333333+ return 0;334334+332335 error = aa_path_name(mntpath, path_flags(profile, mntpath), buffer,333336 &mntpnt, &info, profile->disconnected);334337 if (error)···382379383380 AA_BUG(!profile);384381 AA_BUG(devpath && !devbuffer);382382+383383+ if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))384384+ return 0;385385386386 if (devpath) {387387 error = aa_path_name(devpath, path_flags(profile, devpath),···564558 AA_BUG(!profile);565559 AA_BUG(!path);566560561561+ if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))562562+ return 0;563563+567564 error = aa_path_name(path, path_flags(profile, path), buffer, &name,568565 &info, profile->disconnected);569566 if (error)···622613 AA_BUG(!new_path);623614 AA_BUG(!old_path);624615625625- if (profile_unconfined(profile))616616+ if (profile_unconfined(profile) ||617617+ !PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))626618 return aa_get_newest_label(&profile->label);627619628620 error = aa_path_name(old_path, path_flags(profile, old_path),
+27-14
sound/core/oss/pcm_oss.c
···455455 v = snd_pcm_hw_param_last(pcm, params, var, dir);456456 else457457 v = snd_pcm_hw_param_first(pcm, params, var, dir);458458- snd_BUG_ON(v < 0);459458 return v;460459}461460···1334133513351336 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)13361337 return tmp;13371337- mutex_lock(&runtime->oss.params_lock);13381338 while (bytes > 0) {13391339+ if (mutex_lock_interruptible(&runtime->oss.params_lock)) {13401340+ tmp = -ERESTARTSYS;13411341+ break;13421342+ }13391343 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {13401344 tmp = bytes;13411345 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes)···13821380 xfer += tmp;13831381 if ((substream->f_flags & O_NONBLOCK) != 0 &&13841382 tmp != runtime->oss.period_bytes)13851385- break;13831383+ tmp = -EAGAIN;13861384 }13871387- }13881388- mutex_unlock(&runtime->oss.params_lock);13891389- return xfer;13901390-13911385 err:13921392- mutex_unlock(&runtime->oss.params_lock);13861386+ mutex_unlock(&runtime->oss.params_lock);13871387+ if (tmp < 0)13881388+ break;13891389+ if (signal_pending(current)) {13901390+ tmp = -ERESTARTSYS;13911391+ break;13921392+ }13931393+ tmp = 0;13941394+ }13931395 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;13941396}13951397···1441143514421436 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)14431437 return tmp;14441444- mutex_lock(&runtime->oss.params_lock);14451438 while (bytes > 0) {14391439+ if (mutex_lock_interruptible(&runtime->oss.params_lock)) {14401440+ tmp = -ERESTARTSYS;14411441+ break;14421442+ }14461443 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {14471444 if (runtime->oss.buffer_used == 0) {14481445 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);···14761467 bytes -= tmp;14771468 xfer += tmp;14781469 }14791479- }14801480- mutex_unlock(&runtime->oss.params_lock);14811481- return xfer;14821482-14831470 err:14841484- mutex_unlock(&runtime->oss.params_lock);14711471+ mutex_unlock(&runtime->oss.params_lock);14721472+ if (tmp < 0)14731473+ break;14741474+ if (signal_pending(current)) {14751475+ tmp = -ERESTARTSYS;14761476+ break;14771477+ }14781478+ tmp = 0;14791479+ }14851480 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;14861481}14871482
+11-3
sound/core/oss/pcm_plugin.c
···592592 snd_pcm_sframes_t frames = size;593593594594 plugin = snd_pcm_plug_first(plug);595595- while (plugin && frames > 0) {595595+ while (plugin) {596596+ if (frames <= 0)597597+ return frames;596598 if ((next = plugin->next) != NULL) {597599 snd_pcm_sframes_t frames1 = frames;598598- if (plugin->dst_frames)600600+ if (plugin->dst_frames) {599601 frames1 = plugin->dst_frames(plugin, frames);602602+ if (frames1 <= 0)603603+ return frames1;604604+ }600605 if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) {601606 return err;602607 }603608 if (err != frames1) {604609 frames = err;605605- if (plugin->src_frames)610610+ if (plugin->src_frames) {606611 frames = plugin->src_frames(plugin, frames1);612612+ if (frames <= 0)613613+ return frames;614614+ }607615 }608616 } else609617 dst_channels = NULL;
+2-2
sound/core/pcm_lib.c
···16321632 return changed;16331633 if (params->rmask) {16341634 int err = snd_pcm_hw_refine(pcm, params);16351635- if (snd_BUG_ON(err < 0))16351635+ if (err < 0)16361636 return err;16371637 }16381638 return snd_pcm_hw_param_value(params, var, dir);···16781678 return changed;16791679 if (params->rmask) {16801680 int err = snd_pcm_hw_refine(pcm, params);16811681- if (snd_BUG_ON(err < 0))16811681+ if (err < 0)16821682 return err;16831683 }16841684 return snd_pcm_hw_param_value(params, var, dir);
+7-2
sound/core/pcm_native.c
···25802580 return ret < 0 ? ret : frames;25812581}2582258225832583-/* decrease the appl_ptr; returns the processed frames or a negative error */25832583+/* decrease the appl_ptr; returns the processed frames or zero for error */25842584static snd_pcm_sframes_t rewind_appl_ptr(struct snd_pcm_substream *substream,25852585 snd_pcm_uframes_t frames,25862586 snd_pcm_sframes_t avail)···25972597 if (appl_ptr < 0)25982598 appl_ptr += runtime->boundary;25992599 ret = pcm_lib_apply_appl_ptr(substream, appl_ptr);26002600- return ret < 0 ? ret : frames;26002600+ /* NOTE: we return zero for errors because PulseAudio gets depressed26012601+ * upon receiving an error from rewind ioctl and stops processing26022602+ * any longer. Returning zero means that no rewind is done, so26032603+ * it's not absolutely wrong to answer like that.26042604+ */26052605+ return ret < 0 ? 0 : frames;26012606}2602260726032608static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *substream,
···474474 .result = REJECT,475475 .matches = {476476 {4, "R5=pkt(id=0,off=0,r=0,imm=0)"},477477- /* ptr & 0x40 == either 0 or 0x40 */478478- {5, "R5=inv(id=0,umax_value=64,var_off=(0x0; 0x40))"},479479- /* ptr << 2 == unknown, (4n) */480480- {7, "R5=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc))"},481481- /* (4n) + 14 == (4n+2). We blow our bounds, because482482- * the add could overflow.483483- */484484- {8, "R5=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"},485485- /* Checked s>=0 */486486- {10, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},487487- /* packet pointer + nonnegative (4n+2) */488488- {12, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},489489- {14, "R4=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},490490- /* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine.491491- * We checked the bounds, but it might have been able492492- * to overflow if the packet pointer started in the493493- * upper half of the address space.494494- * So we did not get a 'range' on R6, and the access495495- * attempt will fail.496496- */497497- {16, "R6=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc))"},477477+ /* R5 bitwise operator &= on pointer prohibited */498478 }499479 },500480 {