···66666767endif68686969-cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables7070-7169# By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok7270ifeq ($(atleast_gcc48),y)7371cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2
+1-1
arch/arc/kernel/stacktrace.c
···142142 * prelogue is setup (callee regs saved and then fp set and not other143143 * way around144144 */145145- pr_warn("CONFIG_ARC_DW2_UNWIND needs to be enabled\n");145145+ pr_warn_once("CONFIG_ARC_DW2_UNWIND needs to be enabled\n");146146 return 0;147147148148#endif
···47474848 printk(KERN_INFO "PCI: Probing PCI hardware\n");49495050- pci_io_base = ISA_IO_BASE;5150 /* For now, override phys_mem_access_prot. If we need it,g5251 * later, we may move that initialization to each ppc_md5352 */
+10
arch/powerpc/kernel/process.c
···15051505 current->thread.regs = regs - 1;15061506 }1507150715081508+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM15091509+ /*15101510+ * Clear any transactional state, we're exec()ing. The cause is15111511+ * not important as there will never be a recheckpoint so it's not15121512+ * user visible.15131513+ */15141514+ if (MSR_TM_SUSPENDED(mfmsr()))15151515+ tm_reclaim_current(0);15161516+#endif15171517+15081518 memset(regs->gpr, 0, sizeof(regs->gpr));15091519 regs->ctr = 0;15101520 regs->link = 0;
+44-17
arch/powerpc/kernel/tm.S
···110110 std r3, STK_PARAM(R3)(r1)111111 SAVE_NVGPRS(r1)112112113113- /* We need to setup MSR for VSX register save instructions. Here we114114- * also clear the MSR RI since when we do the treclaim, we won't have a115115- * valid kernel pointer for a while. We clear RI here as it avoids116116- * adding another mtmsr closer to the treclaim. This makes the region117117- * maked as non-recoverable wider than it needs to be but it saves on118118- * inserting another mtmsrd later.119119- */113113+ /* We need to setup MSR for VSX register save instructions. */120114 mfmsr r14121115 mr r15, r14122116 ori r15, r15, MSR_FP123123- li r16, MSR_RI117117+ li r16, 0124118 ori r16, r16, MSR_EE /* IRQs hard off */125119 andc r15, r15, r16126120 oris r15, r15, MSR_VEC@h···1701761: tdeqi r6, 0171177 EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0172178173173- /* The moment we treclaim, ALL of our GPRs will switch179179+ /* Clear MSR RI since we are about to change r1, EE is already off. */180180+ li r4, 0181181+ mtmsrd r4, 1182182+183183+ /*184184+ * BE CAREFUL HERE:185185+ * At this point we can't take an SLB miss since we have MSR_RI186186+ * off. Load only to/from the stack/paca which are in SLB bolted regions187187+ * until we turn MSR RI back on.188188+ *189189+ * The moment we treclaim, ALL of our GPRs will switch174190 * to user register state. (FPRs, CCR etc. also!)175191 * Use an sprg and a tm_scratch in the PACA to shuffle.176192 */···201197202198 /* Store the PPR in r11 and reset to decent value */203199 std r11, GPR11(r1) /* Temporary stash */200200+201201+ /* Reset MSR RI so we can take SLB faults again */202202+ li r11, MSR_RI203203+ mtmsrd r11, 1204204+204205 mfspr r11, SPRN_PPR205206 HMT_MEDIUM206207···406397 ld r5, THREAD_TM_DSCR(r3)407398 ld r6, THREAD_TM_PPR(r3)408399409409- /* Clear the MSR RI since we are about to change R1. EE is already off410410- */411411- li r4, 0412412- mtmsrd r4, 1413413-414400 REST_GPR(0, r7) /* GPR0 */415401 REST_2GPRS(2, r7) /* GPR2-3 */416402 REST_GPR(4, r7) /* GPR4 */···443439 ld r6, _CCR(r7)444440 mtcr r6445441446446- REST_GPR(1, r7) /* GPR1 */447447- REST_GPR(5, r7) /* GPR5-7 */448442 REST_GPR(6, r7)449449- ld r7, GPR7(r7)443443+444444+ /*445445+ * Store r1 and r5 on the stack so that we can access them446446+ * after we clear MSR RI.447447+ */448448+449449+ REST_GPR(5, r7)450450+ std r5, -8(r1)451451+ ld r5, GPR1(r7)452452+ std r5, -16(r1)453453+454454+ REST_GPR(7, r7)455455+456456+ /* Clear MSR RI since we are about to change r1. EE is already off */457457+ li r5, 0458458+ mtmsrd r5, 1459459+460460+ /*461461+ * BE CAREFUL HERE:462462+ * At this point we can't take an SLB miss since we have MSR_RI463463+ * off. Load only to/from the stack/paca which are in SLB bolted regions464464+ * until we turn MSR RI back on.465465+ */466466+467467+ ld r5, -8(r1)468468+ ld r1, -16(r1)450469451470 /* Commit register state as checkpointed state: */452471 TRECHKPT
+4
arch/powerpc/mm/hash_utils_64.c
···922922 vmemmap = (struct page *)H_VMEMMAP_BASE;923923 ioremap_bot = IOREMAP_BASE;924924925925+#ifdef CONFIG_PCI926926+ pci_io_base = ISA_IO_BASE;927927+#endif928928+925929 /* Initialize the MMU Hash table and create the linear mapping926930 * of memory. Has to be done before SLB initialization as this is927931 * currently where the page size encoding is obtained.
+5
arch/powerpc/mm/pgtable-radix.c
···328328 __vmalloc_end = RADIX_VMALLOC_END;329329 vmemmap = (struct page *)RADIX_VMEMMAP_BASE;330330 ioremap_bot = IOREMAP_BASE;331331+332332+#ifdef CONFIG_PCI333333+ pci_io_base = ISA_IO_BASE;334334+#endif335335+331336 /*332337 * For now radix also use the same frag size333338 */
···20642064 S390_lowcore.program_new_psw.addr =20652065 (unsigned long) s390_base_pgm_handler;2066206620672067- /*20682068- * Clear subchannel ID and number to signal new kernel that no CCW or20692069- * SCSI IPL has been done (for kexec and kdump)20702070- */20712071- S390_lowcore.subchannel_id = 0;20722072- S390_lowcore.subchannel_nr = 0;20732073-20742067 do_reset_calls();20752068}
+6-5
arch/x86/events/core.c
···23422342perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)23432343{23442344 struct stack_frame frame;23452345- const void __user *fp;23452345+ const unsigned long __user *fp;2346234623472347 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {23482348 /* TODO: We don't support guest os callchain now */···23552355 if (regs->flags & (X86_VM_MASK | PERF_EFLAGS_VM))23562356 return;2357235723582358- fp = (void __user *)regs->bp;23582358+ fp = (unsigned long __user *)regs->bp;2359235923602360 perf_callchain_store(entry, regs->ip);23612361···23682368 pagefault_disable();23692369 while (entry->nr < entry->max_stack) {23702370 unsigned long bytes;23712371+23712372 frame.next_frame = NULL;23722373 frame.return_address = 0;2373237423742374- if (!access_ok(VERIFY_READ, fp, 16))23752375+ if (!access_ok(VERIFY_READ, fp, sizeof(*fp) * 2))23752376 break;2376237723772377- bytes = __copy_from_user_nmi(&frame.next_frame, fp, 8);23782378+ bytes = __copy_from_user_nmi(&frame.next_frame, fp, sizeof(*fp));23782379 if (bytes != 0)23792380 break;23802380- bytes = __copy_from_user_nmi(&frame.return_address, fp+8, 8);23812381+ bytes = __copy_from_user_nmi(&frame.return_address, fp + 1, sizeof(*fp));23812382 if (bytes != 0)23822383 break;23832384
···116116 INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */117117 INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */118118119119+ /*120120+ * When HT is off these events can only run on the bottom 4 counters121121+ * When HT is on, they are impacted by the HT bug and require EXCL access122122+ */119123 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */120124 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */121125 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */···144140 INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */145141 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */146142143143+ /*144144+ * When HT is off these events can only run on the bottom 4 counters145145+ * When HT is on, they are impacted by the HT bug and require EXCL access146146+ */147147 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */148148 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */149149 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */···191183 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */192184 FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */193185 INTEL_UEVENT_CONSTRAINT(0x1c0, 0x2), /* INST_RETIRED.PREC_DIST */186186+187187+ /*188188+ * when HT is off, these can only run on the bottom 4 counters189189+ */190190+ INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_INST_RETIRED.* */191191+ INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_RETIRED.* */192192+ INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_L3_HIT_RETIRED.* */193193+ INTEL_EVENT_CONSTRAINT(0xcd, 0xf), /* MEM_TRANS_RETIRED.* */194194+ INTEL_EVENT_CONSTRAINT(0xc6, 0xf), /* FRONTEND_RETIRED.* */195195+194196 EVENT_CONSTRAINT_END195197};196198···304286 /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */305287 INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf),306288289289+ /*290290+ * When HT is off these events can only run on the bottom 4 counters291291+ * When HT is on, they are impacted by the HT bug and require EXCL access292292+ */307293 INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */308294 INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */309295 INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */···322300 FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */323301 INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */324302 INTEL_UBIT_EVENT_CONSTRAINT(0x8a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_MISS */303303+ /*304304+ * when HT is off, these can only run on the bottom 4 counters305305+ */306306+ INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_INST_RETIRED.* */307307+ INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_RETIRED.* */308308+ INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_L3_HIT_RETIRED.* */309309+ INTEL_EVENT_CONSTRAINT(0xcd, 0xf), /* MEM_TRANS_RETIRED.* */325310 EVENT_CONSTRAINT_END326311};327312
···6161u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)6262{6363 unsigned version;6464- cycle_t ret;6564 u8 flags;66656766 do {6868- version = __pvclock_read_cycles(src, &ret, &flags);6767+ version = src->version;6868+ /* Make the latest version visible */6969+ smp_rmb();7070+7171+ flags = src->flags;7272+ /* Make sure that the version double-check is last. */7373+ smp_rmb();6974 } while ((src->version & 1) || version != src->version);70757176 return flags & valid_flags;···85808681 do {8782 version = __pvclock_read_cycles(src, &ret, &flags);8383+ /* Make sure that the version double-check is last. */8484+ smp_rmb();8885 } while ((src->version & 1) || version != src->version);89869087 if (unlikely((flags & PVCLOCK_GUEST_STOPPED) != 0)) {
+2-1
arch/x86/kvm/lapic.c
···1310131013111311 /* __delay is delay_tsc whenever the hardware has TSC, thus always. */13121312 if (guest_tsc < tsc_deadline)13131313- __delay(tsc_deadline - guest_tsc);13131313+ __delay(min(tsc_deadline - guest_tsc,13141314+ nsec_to_cycles(vcpu, lapic_timer_advance_ns)));13141315}1315131613161317static void start_apic_timer(struct kvm_lapic *apic)
+11-12
arch/x86/kvm/vmx.c
···6671667166726672 /* Checks for #GP/#SS exceptions. */66736673 exn = false;66746674- if (is_protmode(vcpu)) {66746674+ if (is_long_mode(vcpu)) {66756675+ /* Long mode: #GP(0)/#SS(0) if the memory address is in a66766676+ * non-canonical form. This is the only check on the memory66776677+ * destination for long mode!66786678+ */66796679+ exn = is_noncanonical_address(*ret);66806680+ } else if (is_protmode(vcpu)) {66756681 /* Protected mode: apply checks for segment validity in the66766682 * following order:66776683 * - segment type check (#GP(0) may be thrown)···66946688 * execute-only code segment66956689 */66966690 exn = ((s.type & 0xa) == 8);66976697- }66986698- if (exn) {66996699- kvm_queue_exception_e(vcpu, GP_VECTOR, 0);67006700- return 1;67016701- }67026702- if (is_long_mode(vcpu)) {67036703- /* Long mode: #GP(0)/#SS(0) if the memory address is in a67046704- * non-canonical form. This is an only check for long mode.67056705- */67066706- exn = is_noncanonical_address(*ret);67076707- } else if (is_protmode(vcpu)) {66916691+ if (exn) {66926692+ kvm_queue_exception_e(vcpu, GP_VECTOR, 0);66936693+ return 1;66946694+ }67086695 /* Protected mode: #GP(0)/#SS(0) if the segment is unusable.67096696 */67106697 exn = (s.unusable != 0);
···928928{929929 struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);930930931931- return sprintf(buf, "0x%04x\n", be16_to_cpu(dcr->code));931931+ return sprintf(buf, "0x%04x\n", le16_to_cpu(dcr->code));932932}933933static DEVICE_ATTR_RO(format);934934···961961 continue;962962 if (nfit_dcr->dcr->code == dcr->code)963963 continue;964964- rc = sprintf(buf, "%#x\n",965965- be16_to_cpu(nfit_dcr->dcr->code));964964+ rc = sprintf(buf, "0x%04x\n",965965+ le16_to_cpu(nfit_dcr->dcr->code));966966 break;967967 }968968 if (rc != ENXIO)···1131113111321132 /*11331133 * Until standardization materializes we need to consider up to 311341134- * different command sets. Note, that checking for function0 (bit0)11351135- * tells us if any commands are reachable through this uuid.11341134+ * different command sets. Note, that checking for zero functions11351135+ * tells us if any commands might be reachable through this uuid.11361136 */11371137 for (i = NVDIMM_FAMILY_INTEL; i <= NVDIMM_FAMILY_HPE2; i++)11381138- if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 1))11381138+ if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 0))11391139 break;1140114011411141 /* limit the supported commands to those that are publicly documented */
+5-5
drivers/acpi/nfit.h
···5353};54545555/*5656- * Region format interface codes are stored as an array of bytes in the5757- * NFIT DIMM Control Region structure5656+ * Region format interface codes are stored with the interface as the5757+ * LSB and the function as the MSB.5858 */5959-#define NFIT_FIC_BYTE cpu_to_be16(0x101) /* byte-addressable energy backed */6060-#define NFIT_FIC_BLK cpu_to_be16(0x201) /* block-addressable non-energy backed */6161-#define NFIT_FIC_BYTEN cpu_to_be16(0x301) /* byte-addressable non-energy backed */5959+#define NFIT_FIC_BYTE cpu_to_le16(0x101) /* byte-addressable energy backed */6060+#define NFIT_FIC_BLK cpu_to_le16(0x201) /* block-addressable non-energy backed */6161+#define NFIT_FIC_BYTEN cpu_to_le16(0x301) /* byte-addressable non-energy backed */62626363enum {6464 NFIT_BLK_READ_FLUSH = 1,
···680680 u64 mask = 0;681681 union acpi_object *obj;682682683683- if (funcs == 0)684684- return false;685685-686683 obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);687684 if (!obj)688685 return false;···691694 for (i = 0; i < obj->buffer.length && i < 8; i++)692695 mask |= (((u64)obj->buffer.pointer[i]) << (i * 8));693696 ACPI_FREE(obj);697697+698698+ if (funcs == 0)699699+ return true;694700695701 /*696702 * Bit 0 indicates whether there's support for any functions other than
+1-1
drivers/ata/ahci_seattle.c
···137137 u32 val;138138139139 plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL);140140- if (IS_ERR(plat_data))140140+ if (!plat_data)141141 return &ahci_port_info;142142143143 plat_data->sgpio_ctrl = devm_ioremap_resource(dev,
+1-1
drivers/ata/sata_mv.c
···986986 * Looks like a lot of fuss, but it avoids an unnecessary987987 * +1 usec read-after-write delay for unaffected registers.988988 */989989- laddr = (long)addr & 0xffff;989989+ laddr = (unsigned long)addr & 0xffff;990990 if (laddr >= 0x300 && laddr <= 0x33c) {991991 laddr &= 0x000f;992992 if (laddr == 0x4 || laddr == 0xc) {
+2-2
drivers/clk/clk-oxnas.c
···144144 return -ENOMEM;145145146146 regmap = syscon_node_to_regmap(of_get_parent(np));147147- if (!regmap) {147147+ if (IS_ERR(regmap)) {148148 dev_err(&pdev->dev, "failed to have parent regmap\n");149149- return -EINVAL;149149+ return PTR_ERR(regmap);150150 }151151152152 for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) {
+2-2
drivers/clk/rockchip/clk-cpu.c
···321321 }322322323323 cclk = clk_register(NULL, &cpuclk->hw);324324- if (IS_ERR(clk)) {324324+ if (IS_ERR(cclk)) {325325 pr_err("%s: could not register cpuclk %s\n", __func__, name);326326- ret = PTR_ERR(clk);326326+ ret = PTR_ERR(cclk);327327 goto free_rate_table;328328 }329329
···5656/* proc_event_counts is used as the sequence number of the netlink message */5757static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 };58585959-static inline void get_seq(__u32 *ts, int *cpu)5959+static inline void send_msg(struct cn_msg *msg)6060{6161 preempt_disable();6262- *ts = __this_cpu_inc_return(proc_event_counts) - 1;6363- *cpu = smp_processor_id();6262+6363+ msg->seq = __this_cpu_inc_return(proc_event_counts) - 1;6464+ ((struct proc_event *)msg->data)->cpu = smp_processor_id();6565+6666+ /*6767+ * Preemption remains disabled during send to ensure the messages are6868+ * ordered according to their sequence numbers.6969+ *7070+ * If cn_netlink_send() fails, the data is not sent.7171+ */7272+ cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_NOWAIT);7373+6474 preempt_enable();6575}6676···8777 msg = buffer_to_cn_msg(buffer);8878 ev = (struct proc_event *)msg->data;8979 memset(&ev->event_data, 0, sizeof(ev->event_data));9090- get_seq(&msg->seq, &ev->cpu);9180 ev->timestamp_ns = ktime_get_ns();9281 ev->what = PROC_EVENT_FORK;9382 rcu_read_lock();···10192 msg->ack = 0; /* not used */10293 msg->len = sizeof(*ev);10394 msg->flags = 0; /* not used */104104- /* If cn_netlink_send() failed, the data is not sent */105105- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);9595+ send_msg(msg);10696}1079710898void proc_exec_connector(struct task_struct *task)···116108 msg = buffer_to_cn_msg(buffer);117109 ev = (struct proc_event *)msg->data;118110 memset(&ev->event_data, 0, sizeof(ev->event_data));119119- get_seq(&msg->seq, &ev->cpu);120111 ev->timestamp_ns = ktime_get_ns();121112 ev->what = PROC_EVENT_EXEC;122113 ev->event_data.exec.process_pid = task->pid;···125118 msg->ack = 0; /* not used */126119 msg->len = sizeof(*ev);127120 msg->flags = 0; /* not used */128128- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);121121+ send_msg(msg);129122}130123131124void proc_id_connector(struct task_struct *task, int which_id)···157150 return;158151 }159152 rcu_read_unlock();160160- get_seq(&msg->seq, &ev->cpu);161153 ev->timestamp_ns = ktime_get_ns();162154163155 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));164156 msg->ack = 0; /* not used */165157 msg->len = sizeof(*ev);166158 msg->flags = 0; /* not used */167167- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);159159+ send_msg(msg);168160}169161170162void proc_sid_connector(struct task_struct *task)···178172 msg = buffer_to_cn_msg(buffer);179173 ev = (struct proc_event *)msg->data;180174 memset(&ev->event_data, 0, sizeof(ev->event_data));181181- get_seq(&msg->seq, &ev->cpu);182175 ev->timestamp_ns = ktime_get_ns();183176 ev->what = PROC_EVENT_SID;184177 ev->event_data.sid.process_pid = task->pid;···187182 msg->ack = 0; /* not used */188183 msg->len = sizeof(*ev);189184 msg->flags = 0; /* not used */190190- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);185185+ send_msg(msg);191186}192187193188void proc_ptrace_connector(struct task_struct *task, int ptrace_id)···202197 msg = buffer_to_cn_msg(buffer);203198 ev = (struct proc_event *)msg->data;204199 memset(&ev->event_data, 0, sizeof(ev->event_data));205205- get_seq(&msg->seq, &ev->cpu);206200 ev->timestamp_ns = ktime_get_ns();207201 ev->what = PROC_EVENT_PTRACE;208202 ev->event_data.ptrace.process_pid = task->pid;···219215 msg->ack = 0; /* not used */220216 msg->len = sizeof(*ev);221217 msg->flags = 0; /* not used */222222- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);218218+ send_msg(msg);223219}224220225221void proc_comm_connector(struct task_struct *task)···234230 msg = buffer_to_cn_msg(buffer);235231 ev = (struct proc_event *)msg->data;236232 memset(&ev->event_data, 0, sizeof(ev->event_data));237237- get_seq(&msg->seq, &ev->cpu);238233 ev->timestamp_ns = ktime_get_ns();239234 ev->what = PROC_EVENT_COMM;240235 ev->event_data.comm.process_pid = task->pid;···244241 msg->ack = 0; /* not used */245242 msg->len = sizeof(*ev);246243 msg->flags = 0; /* not used */247247- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);244244+ send_msg(msg);248245}249246250247void proc_coredump_connector(struct task_struct *task)···259256 msg = buffer_to_cn_msg(buffer);260257 ev = (struct proc_event *)msg->data;261258 memset(&ev->event_data, 0, sizeof(ev->event_data));262262- get_seq(&msg->seq, &ev->cpu);263259 ev->timestamp_ns = ktime_get_ns();264260 ev->what = PROC_EVENT_COREDUMP;265261 ev->event_data.coredump.process_pid = task->pid;···268266 msg->ack = 0; /* not used */269267 msg->len = sizeof(*ev);270268 msg->flags = 0; /* not used */271271- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);269269+ send_msg(msg);272270}273271274272void proc_exit_connector(struct task_struct *task)···283281 msg = buffer_to_cn_msg(buffer);284282 ev = (struct proc_event *)msg->data;285283 memset(&ev->event_data, 0, sizeof(ev->event_data));286286- get_seq(&msg->seq, &ev->cpu);287284 ev->timestamp_ns = ktime_get_ns();288285 ev->what = PROC_EVENT_EXIT;289286 ev->event_data.exit.process_pid = task->pid;···294293 msg->ack = 0; /* not used */295294 msg->len = sizeof(*ev);296295 msg->flags = 0; /* not used */297297- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);296296+ send_msg(msg);298297}299298300299/*···326325 msg->ack = rcvd_ack + 1;327326 msg->len = sizeof(*ev);328327 msg->flags = 0; /* not used */329329- cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL);328328+ send_msg(msg);330329}331330332331/**
+4-3
drivers/cpufreq/cpufreq-dt-platdev.c
···7979static int __init cpufreq_dt_platdev_init(void)8080{8181 struct device_node *np = of_find_node_by_path("/");8282+ const struct of_device_id *match;82838384 if (!np)8485 return -ENODEV;85868686- if (!of_match_node(machines, np))8787+ match = of_match_node(machines, np);8888+ of_node_put(np);8989+ if (!match)8790 return -ENODEV;8888-8989- of_node_put(of_root);90919192 return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1,9293 NULL, 0));
+4
drivers/cpufreq/cpufreq.c
···22612261 * -> ask driver for current freq and notify governors about a change22622262 */22632263 if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {22642264+ if (cpufreq_suspended) {22652265+ ret = -EAGAIN;22662266+ goto unlock;22672267+ }22642268 new_policy.cur = cpufreq_update_current_freq(policy);22652269 if (WARN_ON(!new_policy.cur)) {22662270 ret = -EIO;
+3-2
drivers/cpufreq/intel_pstate.c
···14001400{14011401 struct cpudata *cpu = all_cpu_data[cpu_num];1402140214031403+ if (cpu->update_util_set)14041404+ return;14051405+14031406 /* Prevent intel_pstate_update_util() from using stale data. */14041407 cpu->sample.time = 0;14051408 cpufreq_add_update_util_hook(cpu_num, &cpu->update_util,···1442143914431440 if (!policy->cpuinfo.max_freq)14441441 return -ENODEV;14451445-14461446- intel_pstate_clear_update_util_hook(policy->cpu);1447144214481443 pr_debug("set_policy cpuinfo.max %u policy->max %u\n",14491444 policy->cpuinfo.max_freq, policy->max);
···141141142142# Some ABIs specify vrsave, special-purpose register #256, as reserved143143# for system use.144144-my $no_vrsave = ($flavour =~ /aix|linux64le/);144144+my $no_vrsave = ($flavour =~ /linux-ppc64le/);145145my $mtspr = sub {146146 my ($f,$idx,$ra) = @_;147147 if ($idx == 256 && $no_vrsave) {
+7-2
drivers/gpio/gpio-tegra.c
···9898 const struct tegra_gpio_soc_config *soc;9999 struct gpio_chip gc;100100 struct irq_chip ic;101101- struct lock_class_key lock_class;102101 u32 bank_count;103102};104103···546547 SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume)547548};548549550550+/*551551+ * This lock class tells lockdep that GPIO irqs are in a different category552552+ * than their parents, so it won't report false recursion.553553+ */554554+static struct lock_class_key gpio_lock_class;555555+549556static int tegra_gpio_probe(struct platform_device *pdev)550557{551558 const struct tegra_gpio_soc_config *config;···665660666661 bank = &tgi->bank_info[GPIO_BANK(gpio)];667662668668- irq_set_lockdep_class(irq, &tgi->lock_class);663663+ irq_set_lockdep_class(irq, &gpio_lock_class);669664 irq_set_chip_data(irq, bank);670665 irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq);671666 }
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
···11061106 if (fences == 0 && handles == 0) {11071107 if (adev->pm.dpm_enabled) {11081108 amdgpu_dpm_enable_uvd(adev, false);11091109+ /* just work around for uvd clock remain high even11101110+ * when uvd dpm disabled on Polaris10 */11111111+ if (adev->asic_type == CHIP_POLARIS10)11121112+ amdgpu_asic_set_uvd_clocks(adev, 0, 0);11091113 } else {11101114 amdgpu_asic_set_uvd_clocks(adev, 0, 0);11111115 }
···315315316316 uint32_t avfs_vdroop_override_setting;317317 bool apply_avfs_cks_off_voltage;318318+ uint32_t frame_time_x2;318319};319320320321/* To convert to Q8.8 format for firmware */
···84478447 tmp |= FDI_MPHY_IOSFSB_RESET_CTL;84488448 I915_WRITE(SOUTH_CHICKEN2, tmp);8449844984508450- if (wait_for_atomic_us(I915_READ(SOUTH_CHICKEN2) &84518451- FDI_MPHY_IOSFSB_RESET_STATUS, 100))84508450+ if (wait_for_us(I915_READ(SOUTH_CHICKEN2) &84518451+ FDI_MPHY_IOSFSB_RESET_STATUS, 100))84528452 DRM_ERROR("FDI mPHY reset assert timeout\n");8453845384548454 tmp = I915_READ(SOUTH_CHICKEN2);84558455 tmp &= ~FDI_MPHY_IOSFSB_RESET_CTL;84568456 I915_WRITE(SOUTH_CHICKEN2, tmp);8457845784588458- if (wait_for_atomic_us((I915_READ(SOUTH_CHICKEN2) &84598459- FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))84588458+ if (wait_for_us((I915_READ(SOUTH_CHICKEN2) &84598459+ FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))84608460 DRM_ERROR("FDI mPHY reset de-assert timeout\n");84618461}84628462···94409440 val |= LCPLL_CD_SOURCE_FCLK;94419441 I915_WRITE(LCPLL_CTL, val);9442944294439443- if (wait_for_atomic_us(I915_READ(LCPLL_CTL) &94449444- LCPLL_CD_SOURCE_FCLK_DONE, 1))94439443+ if (wait_for_us(I915_READ(LCPLL_CTL) &94449444+ LCPLL_CD_SOURCE_FCLK_DONE, 1))94459445 DRM_ERROR("Switching to FCLK failed\n");9446944694479447 val = I915_READ(LCPLL_CTL);···95149514 val &= ~LCPLL_CD_SOURCE_FCLK;95159515 I915_WRITE(LCPLL_CTL, val);9516951695179517- if (wait_for_atomic_us((I915_READ(LCPLL_CTL) &95189518- LCPLL_CD_SOURCE_FCLK_DONE) == 0, 1))95179517+ if (wait_for_us((I915_READ(LCPLL_CTL) &95189518+ LCPLL_CD_SOURCE_FCLK_DONE) == 0, 1))95199519 DRM_ERROR("Switching back to LCPLL failed\n");95209520 }95219521
+6-4
drivers/gpu/drm/i915/intel_dp.c
···663663 done = wait_event_timeout(dev_priv->gmbus_wait_queue, C,664664 msecs_to_jiffies_timeout(10));665665 else666666- done = wait_for_atomic(C, 10) == 0;666666+ done = wait_for(C, 10) == 0;667667 if (!done)668668 DRM_ERROR("dp aux hw did not signal timeout (has irq: %i)!\n",669669 has_aux_irq);···4899489949004900void intel_dp_encoder_reset(struct drm_encoder *encoder)49014901{49024902- struct intel_dp *intel_dp;49024902+ struct drm_i915_private *dev_priv = to_i915(encoder->dev);49034903+ struct intel_dp *intel_dp = enc_to_intel_dp(encoder);49044904+49054905+ if (!HAS_DDI(dev_priv))49064906+ intel_dp->DP = I915_READ(intel_dp->output_reg);4903490749044908 if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP)49054909 return;49064906-49074907- intel_dp = enc_to_intel_dp(encoder);4908491049094911 pps_lock(intel_dp);49104912
+2-2
drivers/gpu/drm/i915/intel_dpll_mgr.c
···13771377 I915_WRITE(BXT_PORT_PLL_ENABLE(port), temp);13781378 POSTING_READ(BXT_PORT_PLL_ENABLE(port));1379137913801380- if (wait_for_atomic_us((I915_READ(BXT_PORT_PLL_ENABLE(port)) &13811381- PORT_PLL_LOCK), 200))13801380+ if (wait_for_us((I915_READ(BXT_PORT_PLL_ENABLE(port)) & PORT_PLL_LOCK),13811381+ 200))13821382 DRM_ERROR("PLL %d not locked\n", port);1383138313841384 /*
+14-7
drivers/hid/hid-multitouch.c
···6161#define MT_QUIRK_ALWAYS_VALID (1 << 4)6262#define MT_QUIRK_VALID_IS_INRANGE (1 << 5)6363#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)6464+#define MT_QUIRK_CONFIDENCE (1 << 7)6465#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)6566#define MT_QUIRK_NO_AREA (1 << 9)6667#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)···7978 __s32 contactid; /* the device ContactID assigned to this slot */8079 bool touch_state; /* is the touch valid? */8180 bool inrange_state; /* is the finger in proximity of the sensor? */8181+ bool confidence_state; /* is the touch made by a finger? */8282};83838484struct mt_class {···505503 return 1;506504 case HID_DG_CONFIDENCE:507505 if (cls->name == MT_CLS_WIN_8 &&508508- field->application == HID_DG_TOUCHPAD) {509509- cls->quirks &= ~MT_QUIRK_ALWAYS_VALID;510510- cls->quirks |= MT_QUIRK_VALID_IS_CONFIDENCE;511511- }506506+ field->application == HID_DG_TOUCHPAD)507507+ cls->quirks |= MT_QUIRK_CONFIDENCE;512508 mt_store_field(usage, td, hi);513509 return 1;514510 case HID_DG_TIPSWITCH:···619619 return;620620621621 if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) {622622+ int active;622623 int slotnum = mt_compute_slot(td, input);623624 struct mt_slot *s = &td->curdata;624625 struct input_mt *mt = input->mt;···634633 return;635634 }636635636636+ if (!(td->mtclass.quirks & MT_QUIRK_CONFIDENCE))637637+ s->confidence_state = 1;638638+ active = (s->touch_state || s->inrange_state) &&639639+ s->confidence_state;640640+637641 input_mt_slot(input, slotnum);638638- input_mt_report_slot_state(input, MT_TOOL_FINGER,639639- s->touch_state || s->inrange_state);640640- if (s->touch_state || s->inrange_state) {642642+ input_mt_report_slot_state(input, MT_TOOL_FINGER, active);643643+ if (active) {641644 /* this finger is in proximity of the sensor */642645 int wide = (s->w > s->h);643646 /* divided by two to match visual scale of touch */···706701 td->curdata.touch_state = value;707702 break;708703 case HID_DG_CONFIDENCE:704704+ if (quirks & MT_QUIRK_CONFIDENCE)705705+ td->curdata.confidence_state = value;709706 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)710707 td->curvalid = value;711708 break;
+2-2
drivers/iio/accel/kxsd9.c
···81818282 mutex_lock(&st->buf_lock);8383 ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));8484- if (ret)8484+ if (ret < 0)8585 goto error_ret;8686 st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C);8787 st->tx[1] = (ret & ~KXSD9_FS_MASK) | i;···163163 break;164164 case IIO_CHAN_INFO_SCALE:165165 ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));166166- if (ret)166166+ if (ret < 0)167167 goto error_ret;168168 *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];169169 ret = IIO_VAL_INT_PLUS_MICRO;
+5-2
drivers/iio/adc/ad7266.c
···396396397397 st = iio_priv(indio_dev);398398399399- st->reg = devm_regulator_get(&spi->dev, "vref");400400- if (!IS_ERR_OR_NULL(st->reg)) {399399+ st->reg = devm_regulator_get_optional(&spi->dev, "vref");400400+ if (!IS_ERR(st->reg)) {401401 ret = regulator_enable(st->reg);402402 if (ret)403403 return ret;···408408409409 st->vref_mv = ret / 1000;410410 } else {411411+ /* Any other error indicates that the regulator does exist */412412+ if (PTR_ERR(st->reg) != -ENODEV)413413+ return PTR_ERR(st->reg);411414 /* Use internal reference */412415 st->vref_mv = 2500;413416 }
+3-2
drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
···5656 int i;5757 acpi_status status;5858 union acpi_object *cpm;5959+ int ret;59606061 status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer);6162 if (ACPI_FAILURE(status))···8382 }8483 }8584 }8686-8585+ ret = cpm->package.count;8786 kfree(buffer.pointer);88878989- return cpm->package.count;8888+ return ret;9089}91909291static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)
+21-18
drivers/input/joystick/xpad.c
···1031103110321032 case XTYPE_XBOXONE:10331033 packet->data[0] = 0x09; /* activate rumble */10341034- packet->data[1] = 0x08;10341034+ packet->data[1] = 0x00;10351035 packet->data[2] = xpad->odata_serial++;10361036- packet->data[3] = 0x08; /* continuous effect */10371037- packet->data[4] = 0x00; /* simple rumble mode */10381038- packet->data[5] = 0x03; /* L and R actuator only */10391039- packet->data[6] = 0x00; /* TODO: LT actuator */10401040- packet->data[7] = 0x00; /* TODO: RT actuator */10361036+ packet->data[3] = 0x09;10371037+ packet->data[4] = 0x00;10381038+ packet->data[5] = 0x0F;10391039+ packet->data[6] = 0x00;10401040+ packet->data[7] = 0x00;10411041 packet->data[8] = strong / 512; /* left actuator */10421042 packet->data[9] = weak / 512; /* right actuator */10431043- packet->data[10] = 0x80; /* length of pulse */10441044- packet->data[11] = 0x00; /* stop period of pulse */10431043+ packet->data[10] = 0xFF;10441044+ packet->data[11] = 0x00;10451045 packet->data[12] = 0x00;10461046 packet->len = 13;10471047 packet->pending = true;···14371437 break;14381438 }1439143914401440- if (xpad_device[i].xtype == XTYPE_XBOXONE &&14411441- intf->cur_altsetting->desc.bInterfaceNumber != 0) {14421442- /*14431443- * The Xbox One controller lists three interfaces all with the14441444- * same interface class, subclass and protocol. Differentiate by14451445- * interface number.14461446- */14471447- return -ENODEV;14481448- }14491449-14501440 xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL);14511441 if (!xpad)14521442 return -ENOMEM;···14681478 if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) {14691479 if (intf->cur_altsetting->desc.bInterfaceProtocol == 129)14701480 xpad->xtype = XTYPE_XBOX360W;14811481+ else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208)14821482+ xpad->xtype = XTYPE_XBOXONE;14711483 else14721484 xpad->xtype = XTYPE_XBOX360;14731485 } else {···14821490 xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS;14831491 if (sticks_to_null)14841492 xpad->mapping |= MAP_STICKS_TO_NULL;14931493+ }14941494+14951495+ if (xpad->xtype == XTYPE_XBOXONE &&14961496+ intf->cur_altsetting->desc.bInterfaceNumber != 0) {14971497+ /*14981498+ * The Xbox One controller lists three interfaces all with the14991499+ * same interface class, subclass and protocol. Differentiate by15001500+ * interface number.15011501+ */15021502+ error = -ENODEV;15031503+ goto err_free_in_urb;14851504 }1486150514871506 error = xpad_init_output(intf, xpad);
···46074607 if (!iommu)46084608 continue;4609460946104610- for (did = 0; did < 0xffff; did++) {46104610+ for (did = 0; did < cap_ndoms(iommu->cap); did++) {46114611 domain = get_iommu_domain(iommu, did);4612461246134613 if (!domain)
···1616config CAN_GS_USB1717 tristate "Geschwister Schneider UG interfaces"1818 ---help---1919- This driver supports the Geschwister Schneider USB/CAN devices.1919+ This driver supports the Geschwister Schneider and bytewerk.org2020+ candleLight USB CAN interfaces USB/CAN devices2021 If unsure choose N,2122 choose Y for built in support,2223 M to compile as module (module will be named: gs_usb).···4746 - Kvaser USBcan R4847 - Kvaser Leaf Light v24948 - Kvaser Mini PCI Express HS4949+ - Kvaser Mini PCI Express 2xHS5050+ - Kvaser USBcan Light 2xHS5051 - Kvaser USBcan II HS/HS5152 - Kvaser USBcan II HS/LS5253 - Kvaser USBcan Rugged ("USBcan Rev B")
+11-3
drivers/net/can/usb/gs_usb.c
···11-/* CAN driver for Geschwister Schneider USB/CAN devices.11+/* CAN driver for Geschwister Schneider USB/CAN devices22+ * and bytewerk.org candleLight USB CAN interfaces.23 *33- * Copyright (C) 2013 Geschwister Schneider Technologie-,44+ * Copyright (C) 2013-2016 Geschwister Schneider Technologie-,45 * Entwicklungs- und Vertriebs UG (Haftungsbeschränkt).66+ * Copyright (C) 2016 Hubert Denkmair57 *68 * Many thanks to all socketcan devs!79 *···3028/* Device specific constants */3129#define USB_GSUSB_1_VENDOR_ID 0x1d503230#define USB_GSUSB_1_PRODUCT_ID 0x606f3131+3232+#define USB_CANDLELIGHT_VENDOR_ID 0x12093333+#define USB_CANDLELIGHT_PRODUCT_ID 0x232333343435#define GSUSB_ENDPOINT_IN 13536#define GSUSB_ENDPOINT_OUT 2···957952static const struct usb_device_id gs_usb_table[] = {958953 { USB_DEVICE_INTERFACE_NUMBER(USB_GSUSB_1_VENDOR_ID,959954 USB_GSUSB_1_PRODUCT_ID, 0) },955955+ { USB_DEVICE_INTERFACE_NUMBER(USB_CANDLELIGHT_VENDOR_ID,956956+ USB_CANDLELIGHT_PRODUCT_ID, 0) },960957 {} /* Terminating entry */961958};962959···976969MODULE_AUTHOR("Maximilian Schneider <mws@schneidersoft.net>");977970MODULE_DESCRIPTION(978971"Socket CAN device driver for Geschwister Schneider Technologie-, "979979-"Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces.");972972+"Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces\n"973973+"and bytewerk.org candleLight USB CAN interfaces.");980974MODULE_LICENSE("GPL v2");
···509509 * on the current MAC's MII bus510510 */511511 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)512512- if (mdiobus_get_phy(aup->mii_bus, aup->phy_addr)) {513513- phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr);512512+ if (mdiobus_get_phy(aup->mii_bus, phy_addr)) {513513+ phydev = mdiobus_get_phy(aup->mii_bus, phy_addr);514514 if (!aup->phy_search_highest_addr)515515 /* break out with first one found */516516 break;
-4
drivers/net/ethernet/atheros/alx/alx.h
···9696 unsigned int rx_ringsz;9797 unsigned int rxbuf_size;98989999- struct page *rx_page;100100- unsigned int rx_page_offset;101101- unsigned int rx_frag_size;102102-10399 struct napi_struct napi;104100 struct alx_tx_queue txq;105101 struct alx_rx_queue rxq;
+14-47
drivers/net/ethernet/atheros/alx/main.c
···7070 }7171}72727373-static struct sk_buff *alx_alloc_skb(struct alx_priv *alx, gfp_t gfp)7474-{7575- struct sk_buff *skb;7676- struct page *page;7777-7878- if (alx->rx_frag_size > PAGE_SIZE)7979- return __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp);8080-8181- page = alx->rx_page;8282- if (!page) {8383- alx->rx_page = page = alloc_page(gfp);8484- if (unlikely(!page))8585- return NULL;8686- alx->rx_page_offset = 0;8787- }8888-8989- skb = build_skb(page_address(page) + alx->rx_page_offset,9090- alx->rx_frag_size);9191- if (likely(skb)) {9292- alx->rx_page_offset += alx->rx_frag_size;9393- if (alx->rx_page_offset >= PAGE_SIZE)9494- alx->rx_page = NULL;9595- else9696- get_page(page);9797- }9898- return skb;9999-}100100-101101-10273static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)10374{10475 struct alx_rx_queue *rxq = &alx->rxq;···86115 while (!cur_buf->skb && next != rxq->read_idx) {87116 struct alx_rfd *rfd = &rxq->rfd[cur];881178989- skb = alx_alloc_skb(alx, gfp);118118+ /*119119+ * When DMA RX address is set to something like120120+ * 0x....fc0, it will be very likely to cause DMA121121+ * RFD overflow issue.122122+ *123123+ * To work around it, we apply rx skb with 64 bytes124124+ * longer space, and offset the address whenever125125+ * 0x....fc0 is detected.126126+ */127127+ skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size + 64, gfp);90128 if (!skb)91129 break;130130+131131+ if (((unsigned long)skb->data & 0xfff) == 0xfc0)132132+ skb_reserve(skb, 64);133133+92134 dma = dma_map_single(&alx->hw.pdev->dev,93135 skb->data, alx->rxbuf_size,94136 DMA_FROM_DEVICE);···136152 rxq->write_idx = cur;137153 alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur);138154 }139139-140155141156 return count;142157}···605622 kfree(alx->txq.bufs);606623 kfree(alx->rxq.bufs);607624608608- if (alx->rx_page) {609609- put_page(alx->rx_page);610610- alx->rx_page = NULL;611611- }612612-613625 dma_free_coherent(&alx->hw.pdev->dev,614626 alx->descmem.size,615627 alx->descmem.virt,···659681 alx->dev->name, alx);660682 if (!err)661683 goto out;662662-663684 /* fall back to legacy interrupt */664685 pci_disable_msi(alx->hw.pdev);665686 }···702725 struct pci_dev *pdev = alx->hw.pdev;703726 struct alx_hw *hw = &alx->hw;704727 int err;705705- unsigned int head_size;706728707729 err = alx_identify_hw(alx);708730 if (err) {···717741718742 hw->smb_timer = 400;719743 hw->mtu = alx->dev->mtu;720720-721744 alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu);722722- head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +723723- SKB_DATA_ALIGN(sizeof(struct skb_shared_info));724724- alx->rx_frag_size = roundup_pow_of_two(head_size);725725-726745 alx->tx_ringsz = 256;727746 alx->rx_ringsz = 512;728747 hw->imt = 200;···819848{820849 struct alx_priv *alx = netdev_priv(netdev);821850 int max_frame = ALX_MAX_FRAME_LEN(mtu);822822- unsigned int head_size;823851824852 if ((max_frame < ALX_MIN_FRAME_SIZE) ||825853 (max_frame > ALX_MAX_FRAME_SIZE))···830860 netdev->mtu = mtu;831861 alx->hw.mtu = mtu;832862 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);833833- head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +834834- SKB_DATA_ALIGN(sizeof(struct skb_shared_info));835835- alx->rx_frag_size = roundup_pow_of_two(head_size);836863 netdev_update_features(netdev);837864 if (netif_running(netdev))838865 alx_reinit(alx);
+5-3
drivers/net/ethernet/broadcom/bgmac.c
···267267 while (ring->start != ring->end) {268268 int slot_idx = ring->start % BGMAC_TX_RING_SLOTS;269269 struct bgmac_slot_info *slot = &ring->slots[slot_idx];270270- u32 ctl1;270270+ u32 ctl0, ctl1;271271 int len;272272273273 if (slot_idx == empty_slot)274274 break;275275276276+ ctl0 = le32_to_cpu(ring->cpu_base[slot_idx].ctl0);276277 ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1);277278 len = ctl1 & BGMAC_DESC_CTL1_LEN;278278- if (ctl1 & BGMAC_DESC_CTL0_SOF)279279+ if (ctl0 & BGMAC_DESC_CTL0_SOF)279280 /* Unmap no longer used buffer */280281 dma_unmap_single(dma_dev, slot->dma_addr, len,281282 DMA_TO_DEVICE);···1313131213141313 phy_start(bgmac->phy_dev);1315131413161316- netif_carrier_on(net_dev);13151315+ netif_start_queue(net_dev);13161316+13171317 return 0;13181318}13191319
···406406 mutex_lock(&mdev->state_lock);407407 if (mdev->device_up && priv->port_up) {408408 err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);409409- if (err)409409+ if (err) {410410 en_err(priv, "Failed configuring VLAN filter\n");411411+ goto out;412412+ }411413 }412412- if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx))413413- en_dbg(HW, priv, "failed adding vlan %d\n", vid);414414- mutex_unlock(&mdev->state_lock);414414+ err = mlx4_register_vlan(mdev->dev, priv->port, vid, &idx);415415+ if (err)416416+ en_dbg(HW, priv, "Failed adding vlan %d\n", vid);415417416416- return 0;418418+out:419419+ mutex_unlock(&mdev->state_lock);420420+ return err;417421}418422419423static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev,···425421{426422 struct mlx4_en_priv *priv = netdev_priv(dev);427423 struct mlx4_en_dev *mdev = priv->mdev;428428- int err;424424+ int err = 0;429425430426 en_dbg(HW, priv, "Killing VID:%d\n", vid);431427···442438 }443439 mutex_unlock(&mdev->state_lock);444440445445- return 0;441441+ return err;446442}447443448444static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac)···20362032 return -ENOMEM;20372033}2038203420352035+static void mlx4_en_shutdown(struct net_device *dev)20362036+{20372037+ rtnl_lock();20382038+ netif_device_detach(dev);20392039+ mlx4_en_close(dev);20402040+ rtnl_unlock();20412041+}2039204220402043void mlx4_en_destroy_netdev(struct net_device *dev)20412044{20422045 struct mlx4_en_priv *priv = netdev_priv(dev);20432046 struct mlx4_en_dev *mdev = priv->mdev;20472047+ bool shutdown = mdev->dev->persist->interface_state &20482048+ MLX4_INTERFACE_STATE_SHUTDOWN;2044204920452050 en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port);20462051···20572044 if (priv->registered) {20582045 devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev,20592046 priv->port));20602060- unregister_netdev(dev);20472047+ if (shutdown)20482048+ mlx4_en_shutdown(dev);20492049+ else20502050+ unregister_netdev(dev);20612051 }2062205220632053 if (priv->allocated)···20852069 kfree(priv->tx_ring);20862070 kfree(priv->tx_cq);2087207120882088- free_netdev(dev);20722072+ if (!shutdown)20732073+ free_netdev(dev);20892074}2090207520912076static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)···24642447 * strip that feature if this is an IPv6 encapsulated frame.24652448 */24662449 if (skb->encapsulation &&24672467- (skb->ip_summed == CHECKSUM_PARTIAL) &&24682468- (ip_hdr(skb)->version != 4))24692469- features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);24502450+ (skb->ip_summed == CHECKSUM_PARTIAL)) {24512451+ struct mlx4_en_priv *priv = netdev_priv(dev);24522452+24532453+ if (!priv->vxlan_port ||24542454+ (ip_hdr(skb)->version != 4) ||24552455+ (udp_hdr(skb)->dest != priv->vxlan_port))24562456+ features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);24572457+ }2470245824712459 return features;24722460}
+5-1
drivers/net/ethernet/mellanox/mlx4/main.c
···3222322232233223 INIT_LIST_HEAD(&priv->pgdir_list);32243224 mutex_init(&priv->pgdir_mutex);32253225+ spin_lock_init(&priv->cmd.context_lock);3225322632263227 INIT_LIST_HEAD(&priv->bf_list);32273228 mutex_init(&priv->bf_mutex);···4135413441364135 mlx4_info(persist->dev, "mlx4_shutdown was called\n");41374136 mutex_lock(&persist->interface_state_mutex);41384138- if (persist->interface_state & MLX4_INTERFACE_STATE_UP)41374137+ if (persist->interface_state & MLX4_INTERFACE_STATE_UP) {41384138+ /* Notify mlx4 clients that the kernel is being shut down */41394139+ persist->interface_state |= MLX4_INTERFACE_STATE_SHUTDOWN;41394140 mlx4_unload_one(pdev);41414141+ }41404142 mutex_unlock(&persist->interface_state_mutex);41414143}41424144
···408408 }409409410410 mlxsw_sp_txhdr_construct(skb, &tx_info);411411- len = skb->len;411411+ /* TX header is consumed by HW on the way so we shouldn't count its412412+ * bytes as being sent.413413+ */414414+ len = skb->len - MLXSW_TXHDR_LEN;415415+412416 /* Due to a race we might fail here because of a full queue. In that413417 * unlikely case we simply drop the packet.414418 */
+4-1
drivers/net/ethernet/mellanox/mlxsw/switchx2.c
···316316 }317317 }318318 mlxsw_sx_txhdr_construct(skb, &tx_info);319319- len = skb->len;319319+ /* TX header is consumed by HW on the way so we shouldn't count its320320+ * bytes as being sent.321321+ */322322+ len = skb->len - MLXSW_TXHDR_LEN;320323 /* Due to a race we might fail here because of a full queue. In that321324 * unlikely case we simply drop the packet.322325 */
···213213 SET_FIELD(db.params, CORE_DB_DATA_AGG_VAL_SEL,214214 DQ_XCM_CORE_SPQ_PROD_CMD);215215 db.agg_flags = DQ_XCM_CORE_DQ_CF_CMD;216216-217217- /* validate producer is up to-date */218218- rmb();219219-220216 db.spq_prod = cpu_to_le16(qed_chain_get_prod_idx(p_chain));221217222222- /* do not reorder */223223- barrier();218218+ /* make sure the SPQE is updated before the doorbell */219219+ wmb();224220225221 DOORBELL(p_hwfn, qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db);226222227223 /* make sure doorbell is rang */228228- mmiowb();224224+ wmb();229225230226 DP_VERBOSE(p_hwfn, QED_MSG_SPQ,231227 "Doorbelled [0x%08x, CID 0x%08x] with Flags: %02x agg_params: %02x, prod: %04x\n",···610614611615 *p_en2 = *p_ent;612616613613- kfree(p_ent);617617+ /* EBLOCK responsible to free the allocated p_ent */618618+ if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK)619619+ kfree(p_ent);614620615621 p_ent = p_en2;616622 }···747749 * Thus, after gaining the answer perform the cleanup here.748750 */749751 rc = qed_spq_block(p_hwfn, p_ent, fw_return_code);752752+753753+ if (p_ent->queue == &p_spq->unlimited_pending) {754754+ /* This is an allocated p_ent which does not need to755755+ * return to pool.756756+ */757757+ kfree(p_ent);758758+ return rc;759759+ }760760+750761 if (rc)751762 goto spq_post_fail2;752763···851844 found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data,852845 fw_return_code);853846854854- if (found->comp_mode != QED_SPQ_MODE_EBLOCK)855855- /* EBLOCK is responsible for freeing its own entry */847847+ if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) ||848848+ (found->queue == &p_spq->unlimited_pending))849849+ /* EBLOCK is responsible for returning its own entry into the850850+ * free list, unless it originally added the entry into the851851+ * unlimited pending list.852852+ */856853 qed_spq_return_entry(p_hwfn, found);857854858855 /* Attempt to post pending requests */
+4-3
drivers/net/ethernet/qlogic/qede/qede_main.c
···32313231 return rc;32323232}3233323332343234-static int qede_start_queues(struct qede_dev *edev)32343234+static int qede_start_queues(struct qede_dev *edev, bool clear_stats)32353235{32363236 int rc, tc, i;32373237 int vlan_removal_en = 1;···3462346234633463enum qede_load_mode {34643464 QEDE_LOAD_NORMAL,34653465+ QEDE_LOAD_RELOAD,34653466};3466346734673468static int qede_load(struct qede_dev *edev, enum qede_load_mode mode)···35013500 goto err3;35023501 DP_INFO(edev, "Setup IRQs succeeded\n");3503350235043504- rc = qede_start_queues(edev);35033503+ rc = qede_start_queues(edev, mode != QEDE_LOAD_RELOAD);35053504 if (rc)35063505 goto err4;35073506 DP_INFO(edev, "Start VPORT, RXQ and TXQ succeeded\n");···35563555 if (func)35573556 func(edev, args);3558355735593559- qede_load(edev, QEDE_LOAD_NORMAL);35583558+ qede_load(edev, QEDE_LOAD_RELOAD);3560355935613560 mutex_lock(&edev->qede_lock);35623561 qede_config_rx_mode(edev->ndev);
+1-1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
···22202220 if (!opcode)22212221 return;2222222222232223- ring = QLCNIC_FETCH_RING_ID(qlcnic_83xx_hndl(sts_data[0]));22232223+ ring = QLCNIC_FETCH_RING_ID(sts_data[0]);22242224 qlcnic_83xx_process_rcv_diag(adapter, ring, sts_data);22252225 desc = &sds_ring->desc_head[consumer];22262226 desc->status_desc_data[0] = cpu_to_le64(STATUS_OWNER_PHANTOM);
+2-1
drivers/net/ethernet/sfc/farch.c
···104104 const struct efx_farch_register_test *regs,105105 size_t n_regs)106106{107107- unsigned address = 0, i, j;107107+ unsigned address = 0;108108+ int i, j;108109 efx_oword_t mask, imask, original, reg, buf;109110110111 for (i = 0; i < n_regs; ++i) {
-2
drivers/net/ethernet/smsc/smsc911x.c
···116116117117 struct phy_device *phy_dev;118118 struct mii_bus *mii_bus;119119- int phy_irq[PHY_MAX_ADDR];120119 unsigned int using_extphy;121120 int last_duplex;122121 int last_carrier;···10721073 pdata->mii_bus->priv = pdata;10731074 pdata->mii_bus->read = smsc911x_mii_read;10741075 pdata->mii_bus->write = smsc911x_mii_write;10751075- memcpy(pdata->mii_bus->irq, pdata->phy_irq, sizeof(pdata->mii_bus));1076107610771077 pdata->mii_bus->parent = &pdev->dev;10781078
···462462 if (unlikely((shtx->tx_flags & SKBTX_HW_TSTAMP) != 0)) {463463 struct mpipe_data *md = &mpipe_data[instance];464464 struct skb_shared_hwtstamps shhwtstamps;465465- struct timespec ts;465465+ struct timespec64 ts;466466467467 shtx->tx_flags |= SKBTX_IN_PROGRESS;468468 gxio_mpipe_get_timestamp(&md->context, &ts);···886886/* Sync mPIPE's timestamp up with Linux system time and register PTP clock. */887887static void register_ptp_clock(struct net_device *dev, struct mpipe_data *md)888888{889889- struct timespec ts;889889+ struct timespec64 ts;890890891891- getnstimeofday(&ts);891891+ ktime_get_ts64(&ts);892892 gxio_mpipe_set_timestamp(&md->context, &ts);893893894894 mutex_init(&md->ptp_lock);
+1-1
drivers/net/fddi/skfp/Makefile
···1717# projects. To keep the source common for all those drivers (and1818# thus simplify fixes to it), please do not clean it up!19192020-ccflags-y := -Idrivers/net/skfp -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes2020+ccflags-y := -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes
+15-7
drivers/net/geneve.c
···958958 dev->stats.collisions++;959959 else if (err == -ENETUNREACH)960960 dev->stats.tx_carrier_errors++;961961- else962962- dev->stats.tx_errors++;961961+962962+ dev->stats.tx_errors++;963963 return NETDEV_TX_OK;964964}965965···10481048 dev->stats.collisions++;10491049 else if (err == -ENETUNREACH)10501050 dev->stats.tx_carrier_errors++;10511051- else10521052- dev->stats.tx_errors++;10511051+10521052+ dev->stats.tx_errors++;10531053 return NETDEV_TX_OK;10541054}10551055#endif···15081508{15091509 struct nlattr *tb[IFLA_MAX + 1];15101510 struct net_device *dev;15111511+ LIST_HEAD(list_kill);15111512 int err;1512151315131514 memset(tb, 0, sizeof(tb));···15201519 err = geneve_configure(net, dev, &geneve_remote_unspec,15211520 0, 0, 0, 0, htons(dst_port), true,15221521 GENEVE_F_UDP_ZERO_CSUM6_RX);15231523- if (err)15241524- goto err;15221522+ if (err) {15231523+ free_netdev(dev);15241524+ return ERR_PTR(err);15251525+ }1525152615261527 /* openvswitch users expect packet sizes to be unrestricted,15271528 * so set the largest MTU we can.···15321529 if (err)15331530 goto err;1534153115321532+ err = rtnl_configure_link(dev, NULL);15331533+ if (err < 0)15341534+ goto err;15351535+15351536 return dev;1536153715371538 err:15381538- free_netdev(dev);15391539+ geneve_dellink(dev, &list_kill);15401540+ unregister_netdevice_many(&list_kill);15391541 return ERR_PTR(err);15401542}15411543EXPORT_SYMBOL_GPL(geneve_dev_create_fb);
···2323#include <linux/slab.h>2424#include <linux/of.h>2525#include <linux/gpio.h>2626+#include <linux/idr.h>26272728#define MII_REGS_NUM 292829···287286}288287EXPORT_SYMBOL_GPL(fixed_phy_add);289288289289+static DEFINE_IDA(phy_fixed_ida);290290+290291static void fixed_phy_del(int phy_addr)291292{292293 struct fixed_mdio_bus *fmb = &platform_fmb;···300297 if (gpio_is_valid(fp->link_gpio))301298 gpio_free(fp->link_gpio);302299 kfree(fp);300300+ ida_simple_remove(&phy_fixed_ida, phy_addr);303301 return;304302 }305303 }306304}307307-308308-static int phy_fixed_addr;309309-static DEFINE_SPINLOCK(phy_fixed_addr_lock);310305311306struct phy_device *fixed_phy_register(unsigned int irq,312307 struct fixed_phy_status *status,···320319 return ERR_PTR(-EPROBE_DEFER);321320322321 /* Get the next available PHY address, up to PHY_MAX_ADDR */323323- spin_lock(&phy_fixed_addr_lock);324324- if (phy_fixed_addr == PHY_MAX_ADDR) {325325- spin_unlock(&phy_fixed_addr_lock);326326- return ERR_PTR(-ENOSPC);327327- }328328- phy_addr = phy_fixed_addr++;329329- spin_unlock(&phy_fixed_addr_lock);322322+ phy_addr = ida_simple_get(&phy_fixed_ida, 0, PHY_MAX_ADDR, GFP_KERNEL);323323+ if (phy_addr < 0)324324+ return ERR_PTR(phy_addr);330325331326 ret = fixed_phy_add(irq, phy_addr, status, link_gpio);332332- if (ret < 0)327327+ if (ret < 0) {328328+ ida_simple_remove(&phy_fixed_ida, phy_addr);333329 return ERR_PTR(ret);330330+ }334331335332 phy = get_phy_device(fmb->mii_bus, phy_addr, false);336333 if (IS_ERR(phy)) {···433434 list_del(&fp->node);434435 kfree(fp);435436 }437437+ ida_destroy(&phy_fixed_ida);436438}437439module_exit(fixed_mdio_bus_exit);438440
+69-13
drivers/net/phy/marvell.c
···285285 return 0;286286}287287288288+static int m88e1111_config_aneg(struct phy_device *phydev)289289+{290290+ int err;291291+292292+ /* The Marvell PHY has an errata which requires293293+ * that certain registers get written in order294294+ * to restart autonegotiation295295+ */296296+ err = phy_write(phydev, MII_BMCR, BMCR_RESET);297297+298298+ err = marvell_set_polarity(phydev, phydev->mdix);299299+ if (err < 0)300300+ return err;301301+302302+ err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL,303303+ MII_M1111_PHY_LED_DIRECT);304304+ if (err < 0)305305+ return err;306306+307307+ err = genphy_config_aneg(phydev);308308+ if (err < 0)309309+ return err;310310+311311+ if (phydev->autoneg != AUTONEG_ENABLE) {312312+ int bmcr;313313+314314+ /* A write to speed/duplex bits (that is performed by315315+ * genphy_config_aneg() call above) must be followed by316316+ * a software reset. Otherwise, the write has no effect.317317+ */318318+ bmcr = phy_read(phydev, MII_BMCR);319319+ if (bmcr < 0)320320+ return bmcr;321321+322322+ err = phy_write(phydev, MII_BMCR, bmcr | BMCR_RESET);323323+ if (err < 0)324324+ return err;325325+ }326326+327327+ return 0;328328+}329329+288330#ifdef CONFIG_OF_MDIO289331/*290332 * Set and/or override some configuration registers based on the···449407 if (err < 0)450408 return err;451409452452- oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);453453-454454- phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);455455- phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);456456- phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);457457-458458- err = genphy_config_aneg(phydev);459459-460460- return err;410410+ return genphy_config_aneg(phydev);461411}462412463413static int m88e1318_config_aneg(struct phy_device *phydev)···670636 return phy_write(phydev, MII_BMCR, BMCR_RESET);671637}672638639639+static int m88e1121_config_init(struct phy_device *phydev)640640+{641641+ int err, oldpage;642642+643643+ oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);644644+645645+ err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);646646+ if (err < 0)647647+ return err;648648+649649+ /* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */650650+ err = phy_write(phydev, MII_88E1121_PHY_LED_CTRL,651651+ MII_88E1121_PHY_LED_DEF);652652+ if (err < 0)653653+ return err;654654+655655+ phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);656656+657657+ /* Set marvell,reg-init configuration from device tree */658658+ return marvell_config_init(phydev);659659+}660660+673661static int m88e1510_config_init(struct phy_device *phydev)674662{675663 int err;···724668 return err;725669 }726670727727- return marvell_config_init(phydev);671671+ return m88e1121_config_init(phydev);728672}729673730674static int m88e1118_config_aneg(struct phy_device *phydev)···12171161 .flags = PHY_HAS_INTERRUPT,12181162 .probe = marvell_probe,12191163 .config_init = &m88e1111_config_init,12201220- .config_aneg = &marvell_config_aneg,11641164+ .config_aneg = &m88e1111_config_aneg,12211165 .read_status = &marvell_read_status,12221166 .ack_interrupt = &marvell_ack_interrupt,12231167 .config_intr = &marvell_config_intr,···12521196 .features = PHY_GBIT_FEATURES,12531197 .flags = PHY_HAS_INTERRUPT,12541198 .probe = marvell_probe,12551255- .config_init = &marvell_config_init,11991199+ .config_init = &m88e1121_config_init,12561200 .config_aneg = &m88e1121_config_aneg,12571201 .read_status = &marvell_read_status,12581202 .ack_interrupt = &marvell_ack_interrupt,···12711215 .features = PHY_GBIT_FEATURES,12721216 .flags = PHY_HAS_INTERRUPT,12731217 .probe = marvell_probe,12741274- .config_init = &marvell_config_init,12181218+ .config_init = &m88e1121_config_init,12751219 .config_aneg = &m88e1318_config_aneg,12761220 .read_status = &marvell_read_status,12771221 .ack_interrupt = &marvell_ack_interrupt,
+4-13
drivers/net/phy/smsc.c
···7575 * in all capable mode before using it.7676 */7777 if ((rc & MII_LAN83C185_MODE_MASK) == MII_LAN83C185_MODE_POWERDOWN) {7878- int timeout = 50000;7979-8080- /* set "all capable" mode and reset the phy */7878+ /* set "all capable" mode */8179 rc |= MII_LAN83C185_MODE_ALL;8280 phy_write(phydev, MII_LAN83C185_SPECIAL_MODES, rc);8383- phy_write(phydev, MII_BMCR, BMCR_RESET);8484-8585- /* wait end of reset (max 500 ms) */8686- do {8787- udelay(10);8888- if (timeout-- == 0)8989- return -1;9090- rc = phy_read(phydev, MII_BMCR);9191- } while (rc & BMCR_RESET);9281 }9393- return 0;8282+8383+ /* reset the phy */8484+ return genphy_soft_reset(phydev);9485}95869687static int lan911x_config_init(struct phy_device *phydev)
···38513851 if (idx != 0)38523852 return -ENOENT;3853385338543854- if (fw_has_capa(&mvm->fw->ucode_capa,38553855- IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))38543854+ if (!fw_has_capa(&mvm->fw->ucode_capa,38553855+ IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))38563856 return -ENOENT;3857385738583858 mutex_lock(&mvm->mutex);···38983898 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);38993899 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);3900390039013901- if (fw_has_capa(&mvm->fw->ucode_capa,39023902- IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))39013901+ if (!fw_has_capa(&mvm->fw->ucode_capa,39023902+ IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))39033903 return;3904390439053905 /* if beacon filtering isn't on mac80211 does it anyway */
+3-1
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
···581581 struct iwl_rx_mpdu_desc *desc)582582{583583 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;584584- struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);584584+ struct iwl_mvm_sta *mvm_sta;585585 struct iwl_mvm_baid_data *baid_data;586586 struct iwl_mvm_reorder_buffer *buffer;587587 struct sk_buff *tail;···603603 /* no sta yet */604604 if (WARN_ON(IS_ERR_OR_NULL(sta)))605605 return false;606606+607607+ mvm_sta = iwl_mvm_sta_from_mac80211(sta);606608607609 /* not a data packet */608610 if (!ieee80211_is_data_qos(hdr->frame_control) ||
···18521852 mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {18531853 u8 sta_id = mvmvif->ap_sta_id;1854185418551855+ sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id],18561856+ lockdep_is_held(&mvm->mutex));18571857+18551858 /*18561859 * It is possible that the 'sta' parameter is NULL,18571860 * for example when a GTK is removed - the sta_id will then18581861 * be the AP ID, and no station was passed by mac80211.18591862 */18601860- return iwl_mvm_sta_from_staid_protected(mvm, sta_id);18631863+ if (IS_ERR_OR_NULL(sta))18641864+ return NULL;18651865+18661866+ return iwl_mvm_sta_from_mac80211(sta);18611867 }1862186818631869 return NULL;···19601954 } else {19611955 struct ieee80211_key_seq seq;19621956 const u8 *pn;19571957+19581958+ switch (keyconf->cipher) {19591959+ case WLAN_CIPHER_SUITE_AES_CMAC:19601960+ igtk_cmd.ctrl_flags |= cpu_to_le32(STA_KEY_FLG_CCM);19611961+ break;19621962+ default:19631963+ return -EINVAL;19641964+ }1963196519641966 memcpy(igtk_cmd.IGTK, keyconf->key, keyconf->keylen);19651967 ieee80211_get_key_rx_seq(keyconf, 0, &seq);
···209209 pin_reg = &info->pin_regs[pin_id];210210211211 if (pin_reg->mux_reg == -1) {212212- dev_err(ipctl->dev, "Pin(%s) does not support mux function\n",212212+ dev_dbg(ipctl->dev, "Pin(%s) does not support mux function\n",213213 info->pins[pin_id].name);214214- return -EINVAL;214214+ continue;215215 }216216217217 if (info->flags & SHARE_MUX_CONF_REG) {
+3-3
drivers/pinctrl/intel/pinctrl-baytrail.c
···401401static const unsigned int byt_score_plt_clk0_pins[] = { 96 };402402static const unsigned int byt_score_plt_clk1_pins[] = { 97 };403403static const unsigned int byt_score_plt_clk2_pins[] = { 98 };404404-static const unsigned int byt_score_plt_clk4_pins[] = { 99 };405405-static const unsigned int byt_score_plt_clk5_pins[] = { 100 };406406-static const unsigned int byt_score_plt_clk3_pins[] = { 101 };404404+static const unsigned int byt_score_plt_clk3_pins[] = { 99 };405405+static const unsigned int byt_score_plt_clk4_pins[] = { 100 };406406+static const unsigned int byt_score_plt_clk5_pins[] = { 101 };407407static const struct byt_simple_func_mux byt_score_plt_clk_mux[] = {408408 SIMPLE_FUNC("plt_clk", 1),409409};
···296296 if (!sreg->sel && !strcmp(sreg->name, "vddpu"))297297 sreg->sel = 22;298298299299- if (!sreg->sel) {299299+ if (!sreg->bypass && !sreg->sel) {300300 dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");301301 return -EINVAL;302302 }
+6-1
drivers/regulator/max77620-regulator.c
···123123 unsigned int val;124124 int ret;125125126126+ if (!rinfo)127127+ return 0;128128+126129 switch (fps_src) {127130 case MAX77620_FPS_SRC_0:128131 case MAX77620_FPS_SRC_1:···173170 int pu = rpdata->active_fps_pu_slot;174171 int pd = rpdata->active_fps_pd_slot;175172 int ret = 0;173173+174174+ if (!rinfo)175175+ return 0;176176177177 if (is_suspend) {178178 pu = rpdata->suspend_fps_pu_slot;···686680 RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 1550000, 12500, 0x22, SD1),687681 RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE),688682 RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE),689689- RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE),690683691684 RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000),692685 RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000),
+3-1
drivers/spi/spi-rockchip.c
···578578 struct spi_device *spi,579579 struct spi_transfer *xfer)580580{581581- int ret = 1;581581+ int ret = 0;582582 struct rockchip_spi *rs = spi_master_get_devdata(master);583583584584 WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&···627627 spi_enable_chip(rs, 1);628628 ret = rockchip_spi_prepare_dma(rs);629629 }630630+ /* successful DMA prepare means the transfer is in progress */631631+ ret = ret ? ret : 1;630632 } else {631633 spi_enable_chip(rs, 1);632634 ret = rockchip_spi_pio_transfer(rs);
+19-4
drivers/spi/spi-sun4i.c
···173173{174174 struct sun4i_spi *sspi = spi_master_get_devdata(master);175175 unsigned int mclk_rate, div, timeout;176176+ unsigned int start, end, tx_time;176177 unsigned int tx_len = 0;177178 int ret = 0;178179 u32 reg;179180180181 /* We don't support transfer larger than the FIFO */181182 if (tfr->len > SUN4I_FIFO_DEPTH)182182- return -EINVAL;183183+ return -EMSGSIZE;184184+185185+ if (tfr->tx_buf && tfr->len >= SUN4I_FIFO_DEPTH)186186+ return -EMSGSIZE;183187184188 reinit_completion(&sspi->done);185189 sspi->tx_buf = tfr->tx_buf;···273269 sun4i_spi_write(sspi, SUN4I_BURST_CNT_REG, SUN4I_BURST_CNT(tfr->len));274270 sun4i_spi_write(sspi, SUN4I_XMIT_CNT_REG, SUN4I_XMIT_CNT(tx_len));275271276276- /* Fill the TX FIFO */277277- sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH);272272+ /*273273+ * Fill the TX FIFO274274+ * Filling the FIFO fully causes timeout for some reason275275+ * at least on spi2 on A10s276276+ */277277+ sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH - 1);278278279279 /* Enable the interrupts */280280 sun4i_spi_write(sspi, SUN4I_INT_CTL_REG, SUN4I_INT_CTL_TC);···287279 reg = sun4i_spi_read(sspi, SUN4I_CTL_REG);288280 sun4i_spi_write(sspi, SUN4I_CTL_REG, reg | SUN4I_CTL_XCH);289281282282+ tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U);283283+ start = jiffies;290284 timeout = wait_for_completion_timeout(&sspi->done,291291- msecs_to_jiffies(1000));285285+ msecs_to_jiffies(tx_time));286286+ end = jiffies;292287 if (!timeout) {288288+ dev_warn(&master->dev,289289+ "%s: timeout transferring %u bytes@%iHz for %i(%i)ms",290290+ dev_name(&spi->dev), tfr->len, tfr->speed_hz,291291+ jiffies_to_msecs(end - start), tx_time);293292 ret = -ETIMEDOUT;294293 goto out;295294 }
+9-1
drivers/spi/spi-sun6i.c
···160160{161161 struct sun6i_spi *sspi = spi_master_get_devdata(master);162162 unsigned int mclk_rate, div, timeout;163163+ unsigned int start, end, tx_time;163164 unsigned int tx_len = 0;164165 int ret = 0;165166 u32 reg;···270269 reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG);271270 sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg | SUN6I_TFR_CTL_XCH);272271272272+ tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U);273273+ start = jiffies;273274 timeout = wait_for_completion_timeout(&sspi->done,274274- msecs_to_jiffies(1000));275275+ msecs_to_jiffies(tx_time));276276+ end = jiffies;275277 if (!timeout) {278278+ dev_warn(&master->dev,279279+ "%s: timeout transferring %u bytes@%iHz for %i(%i)ms",280280+ dev_name(&spi->dev), tfr->len, tfr->speed_hz,281281+ jiffies_to_msecs(end - start), tx_time);276282 ret = -ETIMEDOUT;277283 goto out;278284 }
+7
drivers/spi/spi-ti-qspi.c
···646646647647static int ti_qspi_remove(struct platform_device *pdev)648648{649649+ struct ti_qspi *qspi = platform_get_drvdata(pdev);650650+ int rc;651651+652652+ rc = spi_master_suspend(qspi->master);653653+ if (rc)654654+ return rc;655655+649656 pm_runtime_put_sync(&pdev->dev);650657 pm_runtime_disable(&pdev->dev);651658
+1-1
drivers/staging/iio/accel/sca3000_core.c
···594594 goto error_ret_mut;595595 ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);596596 mutex_unlock(&st->lock);597597- if (ret)597597+ if (ret < 0)598598 goto error_ret;599599 val = ret;600600 if (base_freq > 0)
+1-1
drivers/staging/iio/adc/ad7606_spi.c
···2121{2222 struct spi_device *spi = to_spi_device(dev);2323 int i, ret;2424- unsigned short *data;2424+ unsigned short *data = buf;2525 __be16 *bdata = buf;26262727 ret = spi_read(spi, buf, count * 2);
+3-3
drivers/staging/iio/impedance-analyzer/ad5933.c
···444444 st->settling_cycles = val;445445446446 /* 2x, 4x handling, see datasheet */447447- if (val > 511)448448- val = (val >> 1) | (1 << 9);449449- else if (val > 1022)447447+ if (val > 1022)450448 val = (val >> 2) | (3 << 9);449449+ else if (val > 511)450450+ val = (val >> 1) | (1 << 9);451451452452 dat = cpu_to_be16(val);453453 ret = ad5933_i2c_write(st->client,
···2121 * 675 Mass Ave, Cambridge, MA 02139, USA.2222 */23232424+#include <linux/module.h>2425#include <linux/kernel.h>2526#include <linux/types.h>2627#include <linux/mutex.h>···451450 return fsm->state_changed;452451}453452EXPORT_SYMBOL_GPL(otg_statemachine);453453+MODULE_LICENSE("GPL");
+7-10
drivers/usb/core/hcd.c
···25982598 * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is25992599 * deallocated.26002600 *26012601- * Make sure to only deallocate the bandwidth_mutex when the primary HCD is26022602- * freed. When hcd_release() is called for either hcd in a peer set26032603- * invalidate the peer's ->shared_hcd and ->primary_hcd pointers to26042604- * block new peering attempts26012601+ * Make sure to deallocate the bandwidth_mutex only when the last HCD is26022602+ * freed. When hcd_release() is called for either hcd in a peer set,26032603+ * invalidate the peer's ->shared_hcd and ->primary_hcd pointers.26052604 */26062605static void hcd_release(struct kref *kref)26072606{26082607 struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref);2609260826102609 mutex_lock(&usb_port_peer_mutex);26112611- if (usb_hcd_is_primary_hcd(hcd)) {26122612- kfree(hcd->address0_mutex);26132613- kfree(hcd->bandwidth_mutex);26142614- }26152610 if (hcd->shared_hcd) {26162611 struct usb_hcd *peer = hcd->shared_hcd;2617261226182613 peer->shared_hcd = NULL;26192619- if (peer->primary_hcd == hcd)26202620- peer->primary_hcd = NULL;26142614+ peer->primary_hcd = NULL;26152615+ } else {26162616+ kfree(hcd->address0_mutex);26172617+ kfree(hcd->bandwidth_mutex);26212618 }26222619 mutex_unlock(&usb_port_peer_mutex);26232620 kfree(hcd);
+4-2
drivers/usb/dwc3/dwc3-st.c
···233233 dev_vdbg(&pdev->dev, "glue-logic addr 0x%p, syscfg-reg offset 0x%x\n",234234 dwc3_data->glue_base, dwc3_data->syscfg_reg_off);235235236236- dwc3_data->rstc_pwrdn = devm_reset_control_get(dev, "powerdown");236236+ dwc3_data->rstc_pwrdn =237237+ devm_reset_control_get_exclusive(dev, "powerdown");237238 if (IS_ERR(dwc3_data->rstc_pwrdn)) {238239 dev_err(&pdev->dev, "could not get power controller\n");239240 ret = PTR_ERR(dwc3_data->rstc_pwrdn);···244243 /* Manage PowerDown */245244 reset_control_deassert(dwc3_data->rstc_pwrdn);246245247247- dwc3_data->rstc_rst = devm_reset_control_get(dev, "softreset");246246+ dwc3_data->rstc_rst =247247+ devm_reset_control_get_shared(dev, "softreset");248248 if (IS_ERR(dwc3_data->rstc_rst)) {249249 dev_err(&pdev->dev, "could not get reset controller\n");250250 ret = PTR_ERR(dwc3_data->rstc_rst);
···7474 v9fs_proto_dotu(v9ses));7575 fid = file->private_data;7676 if (!fid) {7777- fid = v9fs_fid_clone(file->f_path.dentry);7777+ fid = v9fs_fid_clone(file_dentry(file));7878 if (IS_ERR(fid))7979 return PTR_ERR(fid);8080···100100 * because we want write after unlink usecase101101 * to work.102102 */103103- fid = v9fs_writeback_fid(file->f_path.dentry);103103+ fid = v9fs_writeback_fid(file_dentry(file));104104 if (IS_ERR(fid)) {105105 err = PTR_ERR(fid);106106 mutex_unlock(&v9inode->v_mutex);···516516 * because we want write after unlink usecase517517 * to work.518518 */519519- fid = v9fs_writeback_fid(filp->f_path.dentry);519519+ fid = v9fs_writeback_fid(file_dentry(filp));520520 if (IS_ERR(fid)) {521521 retval = PTR_ERR(fid);522522 mutex_unlock(&v9inode->v_mutex);
+3-7
fs/ceph/export.c
···9595 }96969797 dentry = d_obtain_alias(inode);9898- if (IS_ERR(dentry)) {9999- iput(inode);9898+ if (IS_ERR(dentry))10099 return dentry;101101- }102100 err = ceph_init_dentry(dentry);103101 if (err < 0) {104102 dput(dentry);···165167 return ERR_PTR(-ENOENT);166168167169 dentry = d_obtain_alias(inode);168168- if (IS_ERR(dentry)) {169169- iput(inode);170170+ if (IS_ERR(dentry))170171 return dentry;171171- }172172 err = ceph_init_dentry(dentry);173173 if (err < 0) {174174 dput(dentry);···206210207211 dout("fh_to_parent %llx\n", cfh->parent_ino);208212 dentry = __get_parent(sb, NULL, cfh->ino);209209- if (IS_ERR(dentry) && PTR_ERR(dentry) == -ENOENT)213213+ if (unlikely(dentry == ERR_PTR(-ENOENT)))210214 dentry = __fh_to_dentry(sb, cfh->parent_ino);211215 return dentry;212216}
+29-4
fs/cifs/cifs_unicode.c
···101101 case SFM_SLASH:102102 *target = '\\';103103 break;104104+ case SFM_SPACE:105105+ *target = ' ';106106+ break;107107+ case SFM_PERIOD:108108+ *target = '.';109109+ break;104110 default:105111 return false;106112 }···410404 return dest_char;411405}412406413413-static __le16 convert_to_sfm_char(char src_char)407407+static __le16 convert_to_sfm_char(char src_char, bool end_of_string)414408{415409 __le16 dest_char;416410···432426 break;433427 case '|':434428 dest_char = cpu_to_le16(SFM_PIPE);429429+ break;430430+ case '.':431431+ if (end_of_string)432432+ dest_char = cpu_to_le16(SFM_PERIOD);433433+ else434434+ dest_char = 0;435435+ break;436436+ case ' ':437437+ if (end_of_string)438438+ dest_char = cpu_to_le16(SFM_SPACE);439439+ else440440+ dest_char = 0;435441 break;436442 default:437443 dest_char = 0;···487469 /* see if we must remap this char */488470 if (map_chars == SFU_MAP_UNI_RSVD)489471 dst_char = convert_to_sfu_char(src_char);490490- else if (map_chars == SFM_MAP_UNI_RSVD)491491- dst_char = convert_to_sfm_char(src_char);492492- else472472+ else if (map_chars == SFM_MAP_UNI_RSVD) {473473+ bool end_of_string;474474+475475+ if (i == srclen - 1)476476+ end_of_string = true;477477+ else478478+ end_of_string = false;479479+480480+ dst_char = convert_to_sfm_char(src_char, end_of_string);481481+ } else493482 dst_char = 0;494483 /*495484 * FIXME: We can not handle remapping backslash (UNI_SLASH)
+2
fs/cifs/cifs_unicode.h
···6464#define SFM_LESSTHAN ((__u16) 0xF023)6565#define SFM_PIPE ((__u16) 0xF027)6666#define SFM_SLASH ((__u16) 0xF026)6767+#define SFM_PERIOD ((__u16) 0xF028)6868+#define SFM_SPACE ((__u16) 0xF029)67696870/*6971 * Mapping mechanism to use when one of the seven reserved characters is
+3
fs/cifs/cifsfs.c
···8787extern mempool_t *cifs_mid_poolp;88888989struct workqueue_struct *cifsiod_wq;9090+__u32 cifs_lock_secret;90919192/*9293 * Bumps refcount for cifs super block.···12661265 spin_lock_init(&cifs_tcp_ses_lock);12671266 spin_lock_init(&cifs_file_list_lock);12681267 spin_lock_init(&GlobalMid_Lock);12681268+12691269+ get_random_bytes(&cifs_lock_secret, sizeof(cifs_lock_secret));1269127012701271 if (cifs_max_pending < 2) {12711272 cifs_max_pending = 2;
···208208 dax.addr += first;209209 size = map_len - first;210210 }211211- max = min(pos + size, end);211211+ /*212212+ * pos + size is one past the last offset for IO,213213+ * so pos + size can overflow loff_t at extreme offsets.214214+ * Cast to u64 to catch this and get the true minimum.215215+ */216216+ max = min_t(u64, pos + size, end);212217 }213218214219 if (iov_iter_rw(iter) == WRITE) {
+71-38
fs/libfs.c
···8484}8585EXPORT_SYMBOL(dcache_dir_close);86868787+/* parent is locked at least shared */8888+static struct dentry *next_positive(struct dentry *parent,8989+ struct list_head *from,9090+ int count)9191+{9292+ unsigned *seq = &parent->d_inode->i_dir_seq, n;9393+ struct dentry *res;9494+ struct list_head *p;9595+ bool skipped;9696+ int i;9797+9898+retry:9999+ i = count;100100+ skipped = false;101101+ n = smp_load_acquire(seq) & ~1;102102+ res = NULL;103103+ rcu_read_lock();104104+ for (p = from->next; p != &parent->d_subdirs; p = p->next) {105105+ struct dentry *d = list_entry(p, struct dentry, d_child);106106+ if (!simple_positive(d)) {107107+ skipped = true;108108+ } else if (!--i) {109109+ res = d;110110+ break;111111+ }112112+ }113113+ rcu_read_unlock();114114+ if (skipped) {115115+ smp_rmb();116116+ if (unlikely(*seq != n))117117+ goto retry;118118+ }119119+ return res;120120+}121121+122122+static void move_cursor(struct dentry *cursor, struct list_head *after)123123+{124124+ struct dentry *parent = cursor->d_parent;125125+ unsigned n, *seq = &parent->d_inode->i_dir_seq;126126+ spin_lock(&parent->d_lock);127127+ for (;;) {128128+ n = *seq;129129+ if (!(n & 1) && cmpxchg(seq, n, n + 1) == n)130130+ break;131131+ cpu_relax();132132+ }133133+ __list_del(cursor->d_child.prev, cursor->d_child.next);134134+ if (after)135135+ list_add(&cursor->d_child, after);136136+ else137137+ list_add_tail(&cursor->d_child, &parent->d_subdirs);138138+ smp_store_release(seq, n + 2);139139+ spin_unlock(&parent->d_lock);140140+}141141+87142loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)88143{89144 struct dentry *dentry = file->f_path.dentry;···15499 if (offset != file->f_pos) {155100 file->f_pos = offset;156101 if (file->f_pos >= 2) {157157- struct list_head *p;158102 struct dentry *cursor = file->private_data;103103+ struct dentry *to;159104 loff_t n = file->f_pos - 2;160105161161- spin_lock(&dentry->d_lock);162162- /* d_lock not required for cursor */163163- list_del(&cursor->d_child);164164- p = dentry->d_subdirs.next;165165- while (n && p != &dentry->d_subdirs) {166166- struct dentry *next;167167- next = list_entry(p, struct dentry, d_child);168168- spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);169169- if (simple_positive(next))170170- n--;171171- spin_unlock(&next->d_lock);172172- p = p->next;173173- }174174- list_add_tail(&cursor->d_child, p);175175- spin_unlock(&dentry->d_lock);106106+ inode_lock_shared(dentry->d_inode);107107+ to = next_positive(dentry, &dentry->d_subdirs, n);108108+ move_cursor(cursor, to ? &to->d_child : NULL);109109+ inode_unlock_shared(dentry->d_inode);176110 }177111 }178112 return offset;···184140{185141 struct dentry *dentry = file->f_path.dentry;186142 struct dentry *cursor = file->private_data;187187- struct list_head *p, *q = &cursor->d_child;143143+ struct list_head *p = &cursor->d_child;144144+ struct dentry *next;145145+ bool moved = false;188146189147 if (!dir_emit_dots(file, ctx))190148 return 0;191191- spin_lock(&dentry->d_lock);149149+192150 if (ctx->pos == 2)193193- list_move(q, &dentry->d_subdirs);194194-195195- for (p = q->next; p != &dentry->d_subdirs; p = p->next) {196196- struct dentry *next = list_entry(p, struct dentry, d_child);197197- spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);198198- if (!simple_positive(next)) {199199- spin_unlock(&next->d_lock);200200- continue;201201- }202202-203203- spin_unlock(&next->d_lock);204204- spin_unlock(&dentry->d_lock);151151+ p = &dentry->d_subdirs;152152+ while ((next = next_positive(dentry, p, 1)) != NULL) {205153 if (!dir_emit(ctx, next->d_name.name, next->d_name.len,206154 d_inode(next)->i_ino, dt_type(d_inode(next))))207207- return 0;208208- spin_lock(&dentry->d_lock);209209- spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);210210- /* next is still alive */211211- list_move(q, p);212212- spin_unlock(&next->d_lock);213213- p = q;155155+ break;156156+ moved = true;157157+ p = &next->d_child;214158 ctx->pos++;215159 }216216- spin_unlock(&dentry->d_lock);160160+ if (moved)161161+ move_cursor(cursor, p);217162 return 0;218163}219164EXPORT_SYMBOL(dcache_readdir);
+10-3
fs/lockd/svc.c
···335335};336336#endif337337338338-static void lockd_svc_exit_thread(void)338338+static void lockd_unregister_notifiers(void)339339{340340 unregister_inetaddr_notifier(&lockd_inetaddr_notifier);341341#if IS_ENABLED(CONFIG_IPV6)342342 unregister_inet6addr_notifier(&lockd_inet6addr_notifier);343343#endif344344+}345345+346346+static void lockd_svc_exit_thread(void)347347+{348348+ lockd_unregister_notifiers();344349 svc_exit_thread(nlmsvc_rqst);345350}346351···467462 * Note: svc_serv structures have an initial use count of 1,468463 * so we exit through here on both success and failure.469464 */470470-err_net:465465+err_put:471466 svc_destroy(serv);472467err_create:473468 mutex_unlock(&nlmsvc_mutex);···475470476471err_start:477472 lockd_down_net(serv, net);478478- goto err_net;473473+err_net:474474+ lockd_unregister_notifiers();475475+ goto err_put;479476}480477EXPORT_SYMBOL_GPL(lockd_up);481478
···353353354354 result = wait_for_completion_killable(&dreq->completion);355355356356+ if (!result) {357357+ result = dreq->count;358358+ WARN_ON_ONCE(dreq->count < 0);359359+ }356360 if (!result)357361 result = dreq->error;358358- if (!result)359359- result = dreq->count;360362361363out:362364 return (ssize_t) result;···388386389387 if (dreq->iocb) {390388 long res = (long) dreq->error;391391- if (!res)389389+ if (dreq->count != 0) {392390 res = (long) dreq->count;391391+ WARN_ON_ONCE(dreq->count < 0);392392+ }393393 dreq->iocb->ki_complete(dreq->iocb, res, 0);394394 }395395
···361361 list_del_init(&lseg->pls_list);362362 /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */363363 atomic_dec(&lo->plh_refcount);364364- if (list_empty(&lo->plh_segs))364364+ if (list_empty(&lo->plh_segs)) {365365+ set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags);365366 clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);367367+ }366368 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);367369}368370···12921290 INIT_LIST_HEAD(&lo->plh_bulk_destroy);12931291 lo->plh_inode = ino;12941292 lo->plh_lc_cred = get_rpccred(ctx->cred);12931293+ lo->plh_flags |= 1 << NFS_LAYOUT_INVALID_STID;12951294 return lo;12961295}12971296···13001297pnfs_find_alloc_layout(struct inode *ino,13011298 struct nfs_open_context *ctx,13021299 gfp_t gfp_flags)13001300+ __releases(&ino->i_lock)13011301+ __acquires(&ino->i_lock)13031302{13041303 struct nfs_inode *nfsi = NFS_I(ino);13051304 struct pnfs_layout_hdr *new = NULL;···15701565 * stateid, or it has been invalidated, then we must use the open15711566 * stateid.15721567 */15731573- if (lo->plh_stateid.seqid == 0 ||15741574- test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags)) {15681568+ if (test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags)) {1575156915761570 /*15771571 * The first layoutget for the file. Need to serialize per
+10-2
fs/nfs/pnfs_nfs.c
···247247}248248249249/* Helper function for pnfs_generic_commit_pagelist to catch an empty250250- * page list. This can happen when two commits race. */250250+ * page list. This can happen when two commits race.251251+ *252252+ * This must be called instead of nfs_init_commit - call one or the other, but253253+ * not both!254254+ */251255static bool252256pnfs_generic_commit_cancel_empty_pagelist(struct list_head *pages,253257 struct nfs_commit_data *data,···260256 if (list_empty(pages)) {261257 if (atomic_dec_and_test(&cinfo->mds->rpcs_out))262258 wake_up_atomic_t(&cinfo->mds->rpcs_out);263263- nfs_commitdata_release(data);259259+ /* don't call nfs_commitdata_release - it tries to put260260+ * the open_context which is not acquired until nfs_init_commit261261+ * which has not been called on @data */262262+ WARN_ON_ONCE(data->context);263263+ nfs_commit_free(data);264264 return true;265265 }266266
···171171static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,172172 unsigned reg_cnt, unsigned char *val)173173{174174- int ret;174174+ int ret = 0;175175 int i;176176177177 for (i = 0; i < reg_cnt; i++) {
···464464465465static inline void pwm_apply_args(struct pwm_device *pwm)466466{467467+ struct pwm_state state = { };468468+467469 /*468470 * PWM users calling pwm_apply_args() expect to have a fresh config469471 * where the polarity and period are set according to pwm_args info.···478476 * at startup (even if they are actually enabled), thus authorizing479477 * polarity setting.480478 *481481- * Instead of setting ->enabled to false, we call pwm_disable()482482- * before pwm_set_polarity() to ensure that everything is configured483483- * as expected, and the PWM is really disabled when the user request484484- * it.479479+ * To fulfill this requirement, we apply a new state which disables480480+ * the PWM device and set the reference period and polarity config.485481 *486482 * Note that PWM users requiring a smooth handover between the487483 * bootloader and the kernel (like critical regulators controlled by488484 * PWM devices) will have to switch to the atomic API and avoid calling489485 * pwm_apply_args().490486 */491491- pwm_disable(pwm);492492- pwm_set_polarity(pwm, pwm->args.polarity);487487+488488+ state.enabled = false;489489+ state.polarity = pwm->args.polarity;490490+ state.period = pwm->args.period;491491+492492+ pwm_apply_state(pwm, &state);493493}494494495495struct pwm_lookup {
···8484#endif /* CONFIG_RESET_CONTROLLER */85858686/**8787- * reset_control_get - Lookup and obtain an exclusive reference to a8888- * reset controller.8787+ * reset_control_get_exclusive - Lookup and obtain an exclusive reference8888+ * to a reset controller.8989 * @dev: device to be reset by the controller9090 * @id: reset line name9191 *···9898 *9999 * Use of id names is optional.100100 */101101-static inline struct reset_control *__must_check reset_control_get(102102- struct device *dev, const char *id)101101+static inline struct reset_control *102102+__must_check reset_control_get_exclusive(struct device *dev, const char *id)103103{104104#ifndef CONFIG_RESET_CONTROLLER105105 WARN_ON(1);106106#endif107107- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);108108-}109109-110110-static inline struct reset_control *reset_control_get_optional(111111- struct device *dev, const char *id)112112-{113107 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);114108}115109···135141 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);136142}137143144144+static inline struct reset_control *reset_control_get_optional_exclusive(145145+ struct device *dev, const char *id)146146+{147147+ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);148148+}149149+150150+static inline struct reset_control *reset_control_get_optional_shared(151151+ struct device *dev, const char *id)152152+{153153+ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);154154+}155155+138156/**139139- * of_reset_control_get - Lookup and obtain an exclusive reference to a140140- * reset controller.157157+ * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference158158+ * to a reset controller.141159 * @node: device to be reset by the controller142160 * @id: reset line name143161 *···157151 *158152 * Use of id names is optional.159153 */160160-static inline struct reset_control *of_reset_control_get(154154+static inline struct reset_control *of_reset_control_get_exclusive(161155 struct device_node *node, const char *id)162156{163157 return __of_reset_control_get(node, id, 0, 0);164158}165159166160/**167167- * of_reset_control_get_by_index - Lookup and obtain an exclusive reference to168168- * a reset controller by index.161161+ * of_reset_control_get_shared - Lookup and obtain an shared reference162162+ * to a reset controller.163163+ * @node: device to be reset by the controller164164+ * @id: reset line name165165+ *166166+ * When a reset-control is shared, the behavior of reset_control_assert /167167+ * deassert is changed, the reset-core will keep track of a deassert_count168168+ * and only (re-)assert the reset after reset_control_assert has been called169169+ * as many times as reset_control_deassert was called. Also see the remark170170+ * about shared reset-controls in the reset_control_assert docs.171171+ *172172+ * Calling reset_control_assert without first calling reset_control_deassert173173+ * is not allowed on a shared reset control. Calling reset_control_reset is174174+ * also not allowed on a shared reset control.175175+ * Returns a struct reset_control or IS_ERR() condition containing errno.176176+ *177177+ * Use of id names is optional.178178+ */179179+static inline struct reset_control *of_reset_control_get_shared(180180+ struct device_node *node, const char *id)181181+{182182+ return __of_reset_control_get(node, id, 0, 1);183183+}184184+185185+/**186186+ * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive187187+ * reference to a reset controller188188+ * by index.169189 * @node: device to be reset by the controller170190 * @index: index of the reset controller171191 *···199167 * in whatever order. Returns a struct reset_control or IS_ERR() condition200168 * containing errno.201169 */202202-static inline struct reset_control *of_reset_control_get_by_index(170170+static inline struct reset_control *of_reset_control_get_exclusive_by_index(203171 struct device_node *node, int index)204172{205173 return __of_reset_control_get(node, NULL, index, 0);206174}207175208176/**209209- * devm_reset_control_get - resource managed reset_control_get()177177+ * of_reset_control_get_shared_by_index - Lookup and obtain an shared178178+ * reference to a reset controller179179+ * by index.180180+ * @node: device to be reset by the controller181181+ * @index: index of the reset controller182182+ *183183+ * When a reset-control is shared, the behavior of reset_control_assert /184184+ * deassert is changed, the reset-core will keep track of a deassert_count185185+ * and only (re-)assert the reset after reset_control_assert has been called186186+ * as many times as reset_control_deassert was called. Also see the remark187187+ * about shared reset-controls in the reset_control_assert docs.188188+ *189189+ * Calling reset_control_assert without first calling reset_control_deassert190190+ * is not allowed on a shared reset control. Calling reset_control_reset is191191+ * also not allowed on a shared reset control.192192+ * Returns a struct reset_control or IS_ERR() condition containing errno.193193+ *194194+ * This is to be used to perform a list of resets for a device or power domain195195+ * in whatever order. Returns a struct reset_control or IS_ERR() condition196196+ * containing errno.197197+ */198198+static inline struct reset_control *of_reset_control_get_shared_by_index(199199+ struct device_node *node, int index)200200+{201201+ return __of_reset_control_get(node, NULL, index, 1);202202+}203203+204204+/**205205+ * devm_reset_control_get_exclusive - resource managed206206+ * reset_control_get_exclusive()210207 * @dev: device to be reset by the controller211208 * @id: reset line name212209 *213213- * Managed reset_control_get(). For reset controllers returned from this214214- * function, reset_control_put() is called automatically on driver detach.215215- * See reset_control_get() for more information.210210+ * Managed reset_control_get_exclusive(). For reset controllers returned211211+ * from this function, reset_control_put() is called automatically on driver212212+ * detach.213213+ *214214+ * See reset_control_get_exclusive() for more information.216215 */217217-static inline struct reset_control *__must_check devm_reset_control_get(218218- struct device *dev, const char *id)216216+static inline struct reset_control *217217+__must_check devm_reset_control_get_exclusive(struct device *dev,218218+ const char *id)219219{220220#ifndef CONFIG_RESET_CONTROLLER221221 WARN_ON(1);222222#endif223223 return __devm_reset_control_get(dev, id, 0, 0);224224-}225225-226226-static inline struct reset_control *devm_reset_control_get_optional(227227- struct device *dev, const char *id)228228-{229229- return __devm_reset_control_get(dev, id, 0, 0);230230-}231231-232232-/**233233- * devm_reset_control_get_by_index - resource managed reset_control_get234234- * @dev: device to be reset by the controller235235- * @index: index of the reset controller236236- *237237- * Managed reset_control_get(). For reset controllers returned from this238238- * function, reset_control_put() is called automatically on driver detach.239239- * See reset_control_get() for more information.240240- */241241-static inline struct reset_control *devm_reset_control_get_by_index(242242- struct device *dev, int index)243243-{244244- return __devm_reset_control_get(dev, NULL, index, 0);245224}246225247226/**···270227 return __devm_reset_control_get(dev, id, 0, 1);271228}272229230230+static inline struct reset_control *devm_reset_control_get_optional_exclusive(231231+ struct device *dev, const char *id)232232+{233233+ return __devm_reset_control_get(dev, id, 0, 0);234234+}235235+236236+static inline struct reset_control *devm_reset_control_get_optional_shared(237237+ struct device *dev, const char *id)238238+{239239+ return __devm_reset_control_get(dev, id, 0, 1);240240+}241241+242242+/**243243+ * devm_reset_control_get_exclusive_by_index - resource managed244244+ * reset_control_get_exclusive()245245+ * @dev: device to be reset by the controller246246+ * @index: index of the reset controller247247+ *248248+ * Managed reset_control_get_exclusive(). For reset controllers returned from249249+ * this function, reset_control_put() is called automatically on driver250250+ * detach.251251+ *252252+ * See reset_control_get_exclusive() for more information.253253+ */254254+static inline struct reset_control *255255+devm_reset_control_get_exclusive_by_index(struct device *dev, int index)256256+{257257+ return __devm_reset_control_get(dev, NULL, index, 0);258258+}259259+273260/**274261 * devm_reset_control_get_shared_by_index - resource managed275262 * reset_control_get_shared···310237 * this function, reset_control_put() is called automatically on driver detach.311238 * See reset_control_get_shared() for more information.312239 */313313-static inline struct reset_control *devm_reset_control_get_shared_by_index(314314- struct device *dev, int index)240240+static inline struct reset_control *241241+devm_reset_control_get_shared_by_index(struct device *dev, int index)315242{316243 return __devm_reset_control_get(dev, NULL, index, 1);317244}318245246246+/*247247+ * TEMPORARY calls to use during transition:248248+ *249249+ * of_reset_control_get() => of_reset_control_get_exclusive()250250+ *251251+ * These inline function calls will be removed once all consumers252252+ * have been moved over to the new explicit API.253253+ */254254+static inline struct reset_control *reset_control_get(255255+ struct device *dev, const char *id)256256+{257257+ return reset_control_get_exclusive(dev, id);258258+}259259+260260+static inline struct reset_control *reset_control_get_optional(261261+ struct device *dev, const char *id)262262+{263263+ return reset_control_get_optional_exclusive(dev, id);264264+}265265+266266+static inline struct reset_control *of_reset_control_get(267267+ struct device_node *node, const char *id)268268+{269269+ return of_reset_control_get_exclusive(node, id);270270+}271271+272272+static inline struct reset_control *of_reset_control_get_by_index(273273+ struct device_node *node, int index)274274+{275275+ return of_reset_control_get_exclusive_by_index(node, index);276276+}277277+278278+static inline struct reset_control *devm_reset_control_get(279279+ struct device *dev, const char *id)280280+{281281+ return devm_reset_control_get_exclusive(dev, id);282282+}283283+284284+static inline struct reset_control *devm_reset_control_get_optional(285285+ struct device *dev, const char *id)286286+{287287+ return devm_reset_control_get_optional_exclusive(dev, id);288288+289289+}290290+291291+static inline struct reset_control *devm_reset_control_get_by_index(292292+ struct device *dev, int index)293293+{294294+ return devm_reset_control_get_exclusive_by_index(dev, index);295295+}319296#endif
+6
include/linux/sock_diag.h
···3636{3737 switch (sk->sk_family) {3838 case AF_INET:3939+ if (sk->sk_type == SOCK_RAW)4040+ return SKNLGRP_NONE;4141+3942 switch (sk->sk_protocol) {4043 case IPPROTO_TCP:4144 return SKNLGRP_INET_TCP_DESTROY;···4845 return SKNLGRP_NONE;4946 }5047 case AF_INET6:4848+ if (sk->sk_type == SOCK_RAW)4949+ return SKNLGRP_NONE;5050+5151 switch (sk->sk_protocol) {5252 case IPPROTO_TCP:5353 return SKNLGRP_INET6_TCP_DESTROY;
···611611#define KEY_KBDINPUTASSIST_ACCEPT 0x264612612#define KEY_KBDINPUTASSIST_CANCEL 0x265613613614614+/* Diagonal movement keys */615615+#define KEY_RIGHT_UP 0x266616616+#define KEY_RIGHT_DOWN 0x267617617+#define KEY_LEFT_UP 0x268618618+#define KEY_LEFT_DOWN 0x269619619+620620+#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */621621+/* Show Top Menu of the Media (e.g. DVD) */622622+#define KEY_MEDIA_TOP_MENU 0x26b623623+#define KEY_NUMERIC_11 0x26c624624+#define KEY_NUMERIC_12 0x26d625625+/*626626+ * Toggle Audio Description: refers to an audio service that helps blind and627627+ * visually impaired consumers understand the action in a program. Note: in628628+ * some countries this is referred to as "Video Description".629629+ */630630+#define KEY_AUDIO_DESC 0x26e631631+#define KEY_3D_MODE 0x26f632632+#define KEY_NEXT_FAVORITE 0x270633633+#define KEY_STOP_RECORD 0x271634634+#define KEY_PAUSE_RECORD 0x272635635+#define KEY_VOD 0x273 /* Video on Demand */636636+#define KEY_UNMUTE 0x274637637+#define KEY_FASTREVERSE 0x275638638+#define KEY_SLOWREVERSE 0x276639639+/*640640+ * Control a data application associated with the currently viewed channel,641641+ * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.)642642+ */643643+#define KEY_DATA 0x275644644+614645#define BTN_TRIGGER_HAPPY 0x2c0615646#define BTN_TRIGGER_HAPPY1 0x2c0616647#define BTN_TRIGGER_HAPPY2 0x2c1
···2323#include <linux/audit.h>2424#include <linux/skbuff.h>2525#include <uapi/linux/mqueue.h>2626+#include <linux/tty.h>26272728/* AUDIT_NAMES is the number of slots we reserve in the audit_context2829 * for saving names from getname(). If we get more names we will allocate···262261263262extern void audit_log_d_path_exe(struct audit_buffer *ab,264263 struct mm_struct *mm);264264+265265+extern struct tty_struct *audit_get_tty(struct task_struct *tsk);266266+extern void audit_put_tty(struct tty_struct *tty);265267266268/* audit watch functions */267269#ifdef CONFIG_AUDIT_WATCH
···126126 * are set to NOT_INIT to indicate that they are no longer readable.127127 */128128129129-/* types of values stored in eBPF registers */130130-enum bpf_reg_type {131131- NOT_INIT = 0, /* nothing was written into register */132132- UNKNOWN_VALUE, /* reg doesn't contain a valid pointer */133133- PTR_TO_CTX, /* reg points to bpf_context */134134- CONST_PTR_TO_MAP, /* reg points to struct bpf_map */135135- PTR_TO_MAP_VALUE, /* reg points to map element value */136136- PTR_TO_MAP_VALUE_OR_NULL,/* points to map elem value or NULL */137137- FRAME_PTR, /* reg == frame_pointer */138138- PTR_TO_STACK, /* reg == frame_pointer + imm */139139- CONST_IMM, /* constant integer value */140140-141141- /* PTR_TO_PACKET represents:142142- * skb->data143143- * skb->data + imm144144- * skb->data + (u16) var145145- * skb->data + (u16) var + imm146146- * if (range > 0) then [ptr, ptr + range - off) is safe to access147147- * if (id > 0) means that some 'var' was added148148- * if (off > 0) menas that 'imm' was added149149- */150150- PTR_TO_PACKET,151151- PTR_TO_PACKET_END, /* skb->data + headlen */152152-};153153-154129struct reg_state {155130 enum bpf_reg_type type;156131 union {···670695671696/* check access to 'struct bpf_context' fields */672697static int check_ctx_access(struct verifier_env *env, int off, int size,673673- enum bpf_access_type t)698698+ enum bpf_access_type t, enum bpf_reg_type *reg_type)674699{675700 if (env->prog->aux->ops->is_valid_access &&676676- env->prog->aux->ops->is_valid_access(off, size, t)) {701701+ env->prog->aux->ops->is_valid_access(off, size, t, reg_type)) {677702 /* remember the offset of last byte accessed in ctx */678703 if (env->prog->aux->max_ctx_offset < off + size)679704 env->prog->aux->max_ctx_offset = off + size;···773798 mark_reg_unknown_value(state->regs, value_regno);774799775800 } else if (reg->type == PTR_TO_CTX) {801801+ enum bpf_reg_type reg_type = UNKNOWN_VALUE;802802+776803 if (t == BPF_WRITE && value_regno >= 0 &&777804 is_pointer_value(env, value_regno)) {778805 verbose("R%d leaks addr into ctx\n", value_regno);779806 return -EACCES;780807 }781781- err = check_ctx_access(env, off, size, t);808808+ err = check_ctx_access(env, off, size, t, ®_type);782809 if (!err && t == BPF_READ && value_regno >= 0) {783810 mark_reg_unknown_value(state->regs, value_regno);784784- if (off == offsetof(struct __sk_buff, data) &&785785- env->allow_ptr_leaks)811811+ if (env->allow_ptr_leaks)786812 /* note that reg.[id|off|range] == 0 */787787- state->regs[value_regno].type = PTR_TO_PACKET;788788- else if (off == offsetof(struct __sk_buff, data_end) &&789789- env->allow_ptr_leaks)790790- state->regs[value_regno].type = PTR_TO_PACKET_END;813813+ state->regs[value_regno].type = reg_type;791814 }792815793816 } else if (reg->type == FRAME_PTR || reg->type == PTR_TO_STACK) {
+76-72
kernel/cgroup.c
···837837838838static void put_css_set(struct css_set *cset)839839{840840+ unsigned long flags;841841+840842 /*841843 * Ensure that the refcount doesn't hit zero while any readers842844 * can see it. Similar to atomic_dec_and_lock(), but for an···847845 if (atomic_add_unless(&cset->refcount, -1, 1))848846 return;849847850850- spin_lock_bh(&css_set_lock);848848+ spin_lock_irqsave(&css_set_lock, flags);851849 put_css_set_locked(cset);852852- spin_unlock_bh(&css_set_lock);850850+ spin_unlock_irqrestore(&css_set_lock, flags);853851}854852855853/*···1072107010731071 /* First see if we already have a cgroup group that matches10741072 * the desired set */10751075- spin_lock_bh(&css_set_lock);10731073+ spin_lock_irq(&css_set_lock);10761074 cset = find_existing_css_set(old_cset, cgrp, template);10771075 if (cset)10781076 get_css_set(cset);10791079- spin_unlock_bh(&css_set_lock);10771077+ spin_unlock_irq(&css_set_lock);1080107810811079 if (cset)10821080 return cset;···11041102 * find_existing_css_set() */11051103 memcpy(cset->subsys, template, sizeof(cset->subsys));1106110411071107- spin_lock_bh(&css_set_lock);11051105+ spin_lock_irq(&css_set_lock);11081106 /* Add reference counts and links from the new css_set. */11091107 list_for_each_entry(link, &old_cset->cgrp_links, cgrp_link) {11101108 struct cgroup *c = link->cgrp;···11301128 css_get(css);11311129 }1132113011331133- spin_unlock_bh(&css_set_lock);11311131+ spin_unlock_irq(&css_set_lock);1134113211351133 return cset;11361134}···11941192 * Release all the links from cset_links to this hierarchy's11951193 * root cgroup11961194 */11971197- spin_lock_bh(&css_set_lock);11951195+ spin_lock_irq(&css_set_lock);1198119611991197 list_for_each_entry_safe(link, tmp_link, &cgrp->cset_links, cset_link) {12001198 list_del(&link->cset_link);···12021200 kfree(link);12031201 }1204120212051205- spin_unlock_bh(&css_set_lock);12031203+ spin_unlock_irq(&css_set_lock);1206120412071205 if (!list_empty(&root->root_list)) {12081206 list_del(&root->root_list);···16021600 ss->root = dst_root;16031601 css->cgroup = dcgrp;1604160216051605- spin_lock_bh(&css_set_lock);16031603+ spin_lock_irq(&css_set_lock);16061604 hash_for_each(css_set_table, i, cset, hlist)16071605 list_move_tail(&cset->e_cset_node[ss->id],16081606 &dcgrp->e_csets[ss->id]);16091609- spin_unlock_bh(&css_set_lock);16071607+ spin_unlock_irq(&css_set_lock);1610160816111609 /* default hierarchy doesn't enable controllers by default */16121610 dst_root->subsys_mask |= 1 << ssid;···16421640 if (!buf)16431641 return -ENOMEM;1644164216451645- spin_lock_bh(&css_set_lock);16431643+ spin_lock_irq(&css_set_lock);16461644 ns_cgroup = current_cgns_cgroup_from_root(kf_cgroot);16471645 len = kernfs_path_from_node(kf_node, ns_cgroup->kn, buf, PATH_MAX);16481648- spin_unlock_bh(&css_set_lock);16461646+ spin_unlock_irq(&css_set_lock);1649164716501648 if (len >= PATH_MAX)16511649 len = -ERANGE;···18991897{19001898 struct task_struct *p, *g;1901189919021902- spin_lock_bh(&css_set_lock);19001900+ spin_lock_irq(&css_set_lock);1903190119041902 if (use_task_css_set_links)19051903 goto out_unlock;···19241922 * entry won't be deleted though the process has exited.19251923 * Do it while holding siglock so that we don't end up19261924 * racing against cgroup_exit().19251925+ *19261926+ * Interrupts were already disabled while acquiring19271927+ * the css_set_lock, so we do not need to disable it19281928+ * again when acquiring the sighand->siglock here.19271929 */19281928- spin_lock_irq(&p->sighand->siglock);19301930+ spin_lock(&p->sighand->siglock);19291931 if (!(p->flags & PF_EXITING)) {19301932 struct css_set *cset = task_css_set(p);19311933···19381932 list_add_tail(&p->cg_list, &cset->tasks);19391933 get_css_set(cset);19401934 }19411941- spin_unlock_irq(&p->sighand->siglock);19351935+ spin_unlock(&p->sighand->siglock);19421936 } while_each_thread(g, p);19431937 read_unlock(&tasklist_lock);19441938out_unlock:19451945- spin_unlock_bh(&css_set_lock);19391939+ spin_unlock_irq(&css_set_lock);19461940}1947194119481942static void init_cgroup_housekeeping(struct cgroup *cgrp)···20492043 * Link the root cgroup in this hierarchy into all the css_set20502044 * objects.20512045 */20522052- spin_lock_bh(&css_set_lock);20462046+ spin_lock_irq(&css_set_lock);20532047 hash_for_each(css_set_table, i, cset, hlist) {20542048 link_css_set(&tmp_links, cset, root_cgrp);20552049 if (css_set_populated(cset))20562050 cgroup_update_populated(root_cgrp, true);20572051 }20582058- spin_unlock_bh(&css_set_lock);20522052+ spin_unlock_irq(&css_set_lock);2059205320602054 BUG_ON(!list_empty(&root_cgrp->self.children));20612055 BUG_ON(atomic_read(&root->nr_cgrps) != 1);···22622256 struct cgroup *cgrp;2263225722642258 mutex_lock(&cgroup_mutex);22652265- spin_lock_bh(&css_set_lock);22592259+ spin_lock_irq(&css_set_lock);2266226022672261 cgrp = cset_cgroup_from_root(ns->root_cset, root);2268226222692269- spin_unlock_bh(&css_set_lock);22632263+ spin_unlock_irq(&css_set_lock);22702264 mutex_unlock(&cgroup_mutex);2271226522722266 nsdentry = kernfs_node_dentry(cgrp->kn, dentry->d_sb);···23432337 char *ret;2344233823452339 mutex_lock(&cgroup_mutex);23462346- spin_lock_bh(&css_set_lock);23402340+ spin_lock_irq(&css_set_lock);2347234123482342 ret = cgroup_path_ns_locked(cgrp, buf, buflen, ns);2349234323502350- spin_unlock_bh(&css_set_lock);23442344+ spin_unlock_irq(&css_set_lock);23512345 mutex_unlock(&cgroup_mutex);2352234623532347 return ret;···23752369 char *path = NULL;2376237023772371 mutex_lock(&cgroup_mutex);23782378- spin_lock_bh(&css_set_lock);23722372+ spin_lock_irq(&css_set_lock);2379237323802374 root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id);23812375···23882382 path = buf;23892383 }2390238423912391- spin_unlock_bh(&css_set_lock);23852385+ spin_unlock_irq(&css_set_lock);23922386 mutex_unlock(&cgroup_mutex);23932387 return path;23942388}···25632557 * the new cgroup. There are no failure cases after here, so this25642558 * is the commit point.25652559 */25662566- spin_lock_bh(&css_set_lock);25602560+ spin_lock_irq(&css_set_lock);25672561 list_for_each_entry(cset, &tset->src_csets, mg_node) {25682562 list_for_each_entry_safe(task, tmp_task, &cset->mg_tasks, cg_list) {25692563 struct css_set *from_cset = task_css_set(task);···25742568 put_css_set_locked(from_cset);25752569 }25762570 }25772577- spin_unlock_bh(&css_set_lock);25712571+ spin_unlock_irq(&css_set_lock);2578257225792573 /*25802574 * Migration is committed, all target tasks are now on dst_csets.···26032597 }26042598 } while_each_subsys_mask();26052599out_release_tset:26062606- spin_lock_bh(&css_set_lock);26002600+ spin_lock_irq(&css_set_lock);26072601 list_splice_init(&tset->dst_csets, &tset->src_csets);26082602 list_for_each_entry_safe(cset, tmp_cset, &tset->src_csets, mg_node) {26092603 list_splice_tail_init(&cset->mg_tasks, &cset->tasks);26102604 list_del_init(&cset->mg_node);26112605 }26122612- spin_unlock_bh(&css_set_lock);26062606+ spin_unlock_irq(&css_set_lock);26132607 return ret;26142608}26152609···2640263426412635 lockdep_assert_held(&cgroup_mutex);2642263626432643- spin_lock_bh(&css_set_lock);26372637+ spin_lock_irq(&css_set_lock);26442638 list_for_each_entry_safe(cset, tmp_cset, preloaded_csets, mg_preload_node) {26452639 cset->mg_src_cgrp = NULL;26462640 cset->mg_dst_cgrp = NULL;···26482642 list_del_init(&cset->mg_preload_node);26492643 put_css_set_locked(cset);26502644 }26512651- spin_unlock_bh(&css_set_lock);26452645+ spin_unlock_irq(&css_set_lock);26522646}2653264726542648/**···27892783 * already PF_EXITING could be freed from underneath us unless we27902784 * take an rcu_read_lock.27912785 */27922792- spin_lock_bh(&css_set_lock);27862786+ spin_lock_irq(&css_set_lock);27932787 rcu_read_lock();27942788 task = leader;27952789 do {···27982792 break;27992793 } while_each_thread(leader, task);28002794 rcu_read_unlock();28012801- spin_unlock_bh(&css_set_lock);27952795+ spin_unlock_irq(&css_set_lock);2802279628032797 return cgroup_taskset_migrate(&tset, root);28042798}···28222816 return -EBUSY;2823281728242818 /* look up all src csets */28252825- spin_lock_bh(&css_set_lock);28192819+ spin_lock_irq(&css_set_lock);28262820 rcu_read_lock();28272821 task = leader;28282822 do {···28322826 break;28332827 } while_each_thread(leader, task);28342828 rcu_read_unlock();28352835- spin_unlock_bh(&css_set_lock);28292829+ spin_unlock_irq(&css_set_lock);2836283028372831 /* prepare dst csets and commit */28382832 ret = cgroup_migrate_prepare_dst(&preloaded_csets);···28652859 struct cgroup *cgrp;28662860 struct inode *inode;2867286128682868- spin_lock_bh(&css_set_lock);28622862+ spin_lock_irq(&css_set_lock);28692863 cgrp = task_cgroup_from_root(task, &cgrp_dfl_root);28702870- spin_unlock_bh(&css_set_lock);28642864+ spin_unlock_irq(&css_set_lock);2871286528722866 while (!cgroup_is_descendant(dst_cgrp, cgrp))28732867 cgrp = cgroup_parent(cgrp);···29682962 if (root == &cgrp_dfl_root)29692963 continue;2970296429712971- spin_lock_bh(&css_set_lock);29652965+ spin_lock_irq(&css_set_lock);29722966 from_cgrp = task_cgroup_from_root(from, root);29732973- spin_unlock_bh(&css_set_lock);29672967+ spin_unlock_irq(&css_set_lock);2974296829752969 retval = cgroup_attach_task(from_cgrp, tsk, false);29762970 if (retval)···30863080 percpu_down_write(&cgroup_threadgroup_rwsem);3087308130883082 /* look up all csses currently attached to @cgrp's subtree */30893089- spin_lock_bh(&css_set_lock);30833083+ spin_lock_irq(&css_set_lock);30903084 cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) {30913085 struct cgrp_cset_link *link;30923086···30943088 cgroup_migrate_add_src(link->cset, dsct,30953089 &preloaded_csets);30963090 }30973097- spin_unlock_bh(&css_set_lock);30913091+ spin_unlock_irq(&css_set_lock);3098309230993093 /* NULL dst indicates self on default hierarchy */31003094 ret = cgroup_migrate_prepare_dst(&preloaded_csets);31013095 if (ret)31023096 goto out_finish;3103309731043104- spin_lock_bh(&css_set_lock);30983098+ spin_lock_irq(&css_set_lock);31053099 list_for_each_entry(src_cset, &preloaded_csets, mg_preload_node) {31063100 struct task_struct *task, *ntask;31073101···31133107 list_for_each_entry_safe(task, ntask, &src_cset->tasks, cg_list)31143108 cgroup_taskset_add(task, &tset);31153109 }31163116- spin_unlock_bh(&css_set_lock);31103110+ spin_unlock_irq(&css_set_lock);3117311131183112 ret = cgroup_taskset_migrate(&tset, cgrp->root);31193113out_finish:···39143908 int count = 0;39153909 struct cgrp_cset_link *link;3916391039173917- spin_lock_bh(&css_set_lock);39113911+ spin_lock_irq(&css_set_lock);39183912 list_for_each_entry(link, &cgrp->cset_links, cset_link)39193913 count += atomic_read(&link->cset->refcount);39203920- spin_unlock_bh(&css_set_lock);39143914+ spin_unlock_irq(&css_set_lock);39213915 return count;39223916}39233917···4255424942564250 memset(it, 0, sizeof(*it));4257425142584258- spin_lock_bh(&css_set_lock);42524252+ spin_lock_irq(&css_set_lock);4259425342604254 it->ss = css->ss;42614255···4268426242694263 css_task_iter_advance_css_set(it);4270426442714271- spin_unlock_bh(&css_set_lock);42654265+ spin_unlock_irq(&css_set_lock);42724266}4273426742744268/**···42864280 it->cur_task = NULL;42874281 }4288428242894289- spin_lock_bh(&css_set_lock);42834283+ spin_lock_irq(&css_set_lock);4290428442914285 if (it->task_pos) {42924286 it->cur_task = list_entry(it->task_pos, struct task_struct,···42954289 css_task_iter_advance(it);42964290 }4297429142984298- spin_unlock_bh(&css_set_lock);42924292+ spin_unlock_irq(&css_set_lock);4299429343004294 return it->cur_task;43014295}···43094303void css_task_iter_end(struct css_task_iter *it)43104304{43114305 if (it->cur_cset) {43124312- spin_lock_bh(&css_set_lock);43064306+ spin_lock_irq(&css_set_lock);43134307 list_del(&it->iters_node);43144308 put_css_set_locked(it->cur_cset);43154315- spin_unlock_bh(&css_set_lock);43094309+ spin_unlock_irq(&css_set_lock);43164310 }4317431143184312 if (it->cur_task)···43444338 mutex_lock(&cgroup_mutex);4345433943464340 /* all tasks in @from are being moved, all csets are source */43474347- spin_lock_bh(&css_set_lock);43414341+ spin_lock_irq(&css_set_lock);43484342 list_for_each_entry(link, &from->cset_links, cset_link)43494343 cgroup_migrate_add_src(link->cset, to, &preloaded_csets);43504350- spin_unlock_bh(&css_set_lock);43444344+ spin_unlock_irq(&css_set_lock);4351434543524346 ret = cgroup_migrate_prepare_dst(&preloaded_csets);43534347 if (ret)···50695063 memset(css, 0, sizeof(*css));50705064 css->cgroup = cgrp;50715065 css->ss = ss;50665066+ css->id = -1;50725067 INIT_LIST_HEAD(&css->sibling);50735068 INIT_LIST_HEAD(&css->children);50745069 css->serial_nr = css_serial_nr_next++;···5157515051585151 err = cgroup_idr_alloc(&ss->css_idr, NULL, 2, 0, GFP_KERNEL);51595152 if (err < 0)51605160- goto err_free_percpu_ref;51535153+ goto err_free_css;51615154 css->id = err;5162515551635156 /* @css is ready to be brought online now, make it visible */···5181517451825175err_list_del:51835176 list_del_rcu(&css->sibling);51845184- cgroup_idr_remove(&ss->css_idr, css->id);51855185-err_free_percpu_ref:51865186- percpu_ref_exit(&css->refcnt);51875177err_free_css:51885178 call_rcu(&css->rcu_head, css_free_rcu_fn);51895179 return ERR_PTR(err);···54555451 */54565452 cgrp->self.flags &= ~CSS_ONLINE;5457545354585458- spin_lock_bh(&css_set_lock);54545454+ spin_lock_irq(&css_set_lock);54595455 list_for_each_entry(link, &cgrp->cset_links, cset_link)54605456 link->cset->dead = true;54615461- spin_unlock_bh(&css_set_lock);54575457+ spin_unlock_irq(&css_set_lock);5462545854635459 /* initiate massacre of all css's */54645460 for_each_css(css, ssid, cgrp)···57295725 goto out;5730572657315727 mutex_lock(&cgroup_mutex);57325732- spin_lock_bh(&css_set_lock);57285728+ spin_lock_irq(&css_set_lock);5733572957345730 for_each_root(root) {57355731 struct cgroup_subsys *ss;···5782577857835779 retval = 0;57845780out_unlock:57855785- spin_unlock_bh(&css_set_lock);57815781+ spin_unlock_irq(&css_set_lock);57865782 mutex_unlock(&cgroup_mutex);57875783 kfree(buf);57885784out:···59275923 if (use_task_css_set_links) {59285924 struct css_set *cset;5929592559305930- spin_lock_bh(&css_set_lock);59265926+ spin_lock_irq(&css_set_lock);59315927 cset = task_css_set(current);59325928 if (list_empty(&child->cg_list)) {59335929 get_css_set(cset);59345930 css_set_move_task(child, NULL, cset, false);59355931 }59365936- spin_unlock_bh(&css_set_lock);59325932+ spin_unlock_irq(&css_set_lock);59375933 }5938593459395935 /*···59785974 cset = task_css_set(tsk);5979597559805976 if (!list_empty(&tsk->cg_list)) {59815981- spin_lock_bh(&css_set_lock);59775977+ spin_lock_irq(&css_set_lock);59825978 css_set_move_task(tsk, cset, NULL, false);59835983- spin_unlock_bh(&css_set_lock);59795979+ spin_unlock_irq(&css_set_lock);59845980 } else {59855981 get_css_set(cset);59865982 }···60486044 if (!pathbuf || !agentbuf)60496045 goto out;6050604660516051- spin_lock_bh(&css_set_lock);60476047+ spin_lock_irq(&css_set_lock);60526048 path = cgroup_path_ns_locked(cgrp, pathbuf, PATH_MAX, &init_cgroup_ns);60536053- spin_unlock_bh(&css_set_lock);60496049+ spin_unlock_irq(&css_set_lock);60546050 if (!path)60556051 goto out;60566052···63106306 return ERR_PTR(-EPERM);6311630763126308 mutex_lock(&cgroup_mutex);63136313- spin_lock_bh(&css_set_lock);63096309+ spin_lock_irq(&css_set_lock);6314631063156311 cset = task_css_set(current);63166312 get_css_set(cset);6317631363186318- spin_unlock_bh(&css_set_lock);63146314+ spin_unlock_irq(&css_set_lock);63196315 mutex_unlock(&cgroup_mutex);6320631663216317 new_ns = alloc_cgroup_ns();···64396435 if (!name_buf)64406436 return -ENOMEM;6441643764426442- spin_lock_bh(&css_set_lock);64386438+ spin_lock_irq(&css_set_lock);64436439 rcu_read_lock();64446440 cset = rcu_dereference(current->cgroups);64456441 list_for_each_entry(link, &cset->cgrp_links, cgrp_link) {···64506446 c->root->hierarchy_id, name_buf);64516447 }64526448 rcu_read_unlock();64536453- spin_unlock_bh(&css_set_lock);64496449+ spin_unlock_irq(&css_set_lock);64546450 kfree(name_buf);64556451 return 0;64566452}···64616457 struct cgroup_subsys_state *css = seq_css(seq);64626458 struct cgrp_cset_link *link;6463645964646464- spin_lock_bh(&css_set_lock);64606460+ spin_lock_irq(&css_set_lock);64656461 list_for_each_entry(link, &css->cgroup->cset_links, cset_link) {64666462 struct css_set *cset = link->cset;64676463 struct task_struct *task;···64846480 overflow:64856481 seq_puts(seq, " ...\n");64866482 }64876487- spin_unlock_bh(&css_set_lock);64836483+ spin_unlock_irq(&css_set_lock);64886484 return 0;64896485}64906486
+23-2
kernel/events/core.c
···16861686 return event->state == PERF_EVENT_STATE_DEAD;16871687}1688168816891689-static inline int pmu_filter_match(struct perf_event *event)16891689+static inline int __pmu_filter_match(struct perf_event *event)16901690{16911691 struct pmu *pmu = event->pmu;16921692 return pmu->filter_match ? pmu->filter_match(event) : 1;16931693+}16941694+16951695+/*16961696+ * Check whether we should attempt to schedule an event group based on16971697+ * PMU-specific filtering. An event group can consist of HW and SW events,16981698+ * potentially with a SW leader, so we must check all the filters, to16991699+ * determine whether a group is schedulable:17001700+ */17011701+static inline int pmu_filter_match(struct perf_event *event)17021702+{17031703+ struct perf_event *child;17041704+17051705+ if (!__pmu_filter_match(event))17061706+ return 0;17071707+17081708+ list_for_each_entry(child, &event->sibling_list, group_entry) {17091709+ if (!__pmu_filter_match(child))17101710+ return 0;17111711+ }17121712+17131713+ return 1;16931714}1694171516951716static inline int···75967575 prog = event->tp_event->prog;75977576 if (prog) {75987577 event->tp_event->prog = NULL;75997599- bpf_prog_put(prog);75787578+ bpf_prog_put_rcu(prog);76007579 }76017580}76027581
+8-2
kernel/trace/bpf_trace.c
···209209 event->pmu->count)210210 return -EINVAL;211211212212+ if (unlikely(event->attr.type != PERF_TYPE_HARDWARE &&213213+ event->attr.type != PERF_TYPE_RAW))214214+ return -EINVAL;215215+212216 /*213217 * we don't know if the function is run successfully by the214218 * return value. It can be judged in other places, such as···353349}354350355351/* bpf+kprobe programs can access fields of 'struct pt_regs' */356356-static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type type)352352+static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type type,353353+ enum bpf_reg_type *reg_type)357354{358355 /* check bounds */359356 if (off < 0 || off >= sizeof(struct pt_regs))···432427 }433428}434429435435-static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type)430430+static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type,431431+ enum bpf_reg_type *reg_type)436432{437433 if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE)438434 return false;
+2-1
net/ax25/af_ax25.c
···976976 release_sock(sk);977977 ax25_disconnect(ax25, 0);978978 lock_sock(sk);979979- ax25_destroy_socket(ax25);979979+ if (!sock_flag(ax25->sk, SOCK_DESTROY))980980+ ax25_destroy_socket(ax25);980981 break;981982982983 case AX25_STATE_3:
+4-1
net/ax25/ax25_ds_timer.c
···102102 switch (ax25->state) {103103104104 case AX25_STATE_0:105105+ case AX25_STATE_2:105106 /* Magic here: If we listen() and a new link dies before it106107 is accepted() it isn't 'dead' so doesn't get removed. */107108 if (!sk || sock_flag(sk, SOCK_DESTROY) ||···112111 sock_hold(sk);113112 ax25_destroy_socket(ax25);114113 bh_unlock_sock(sk);114114+ /* Ungrab socket and destroy it */115115 sock_put(sk);116116 } else117117 ax25_destroy_socket(ax25);···215213 case AX25_STATE_2:216214 if (ax25->n2count == ax25->n2) {217215 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);218218- ax25_disconnect(ax25, ETIMEDOUT);216216+ if (!sock_flag(ax25->sk, SOCK_DESTROY))217217+ ax25_disconnect(ax25, ETIMEDOUT);219218 return;220219 } else {221220 ax25->n2count++;
+4-1
net/ax25/ax25_std_timer.c
···38383939 switch (ax25->state) {4040 case AX25_STATE_0:4141+ case AX25_STATE_2:4142 /* Magic here: If we listen() and a new link dies before it4243 is accepted() it isn't 'dead' so doesn't get removed. */4344 if (!sk || sock_flag(sk, SOCK_DESTROY) ||···4847 sock_hold(sk);4948 ax25_destroy_socket(ax25);5049 bh_unlock_sock(sk);5050+ /* Ungrab socket and destroy it */5151 sock_put(sk);5252 } else5353 ax25_destroy_socket(ax25);···146144 case AX25_STATE_2:147145 if (ax25->n2count == ax25->n2) {148146 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);149149- ax25_disconnect(ax25, ETIMEDOUT);147147+ if (!sock_flag(ax25->sk, SOCK_DESTROY))148148+ ax25_disconnect(ax25, ETIMEDOUT);150149 return;151150 } else {152151 ax25->n2count++;
+2-1
net/ax25/ax25_subr.c
···264264{265265 ax25_clear_queues(ax25);266266267267- ax25_stop_heartbeat(ax25);267267+ if (!sock_flag(ax25->sk, SOCK_DESTROY))268268+ ax25_stop_heartbeat(ax25);268269 ax25_stop_t1timer(ax25);269270 ax25_stop_t2timer(ax25);270271 ax25_stop_t3timer(ax25);
···650650651651 /* increase the refcounter of the related vlan */652652 vlan = batadv_softif_vlan_get(bat_priv, vid);653653- if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",654654- addr, BATADV_PRINT_VID(vid))) {653653+ if (!vlan) {654654+ net_ratelimited_function(batadv_info, soft_iface,655655+ "adding TT local entry %pM to non-existent VLAN %d\n",656656+ addr, BATADV_PRINT_VID(vid));655657 kfree(tt_local);656658 tt_local = NULL;657659 goto out;···693691 if (unlikely(hash_added != 0)) {694692 /* remove the reference for the hash */695693 batadv_tt_local_entry_put(tt_local);696696- batadv_softif_vlan_put(vlan);697694 goto out;698695 }699696···22702269 return crc;22712270}2272227122722272+/**22732273+ * batadv_tt_req_node_release - free tt_req node entry22742274+ * @ref: kref pointer of the tt req_node entry22752275+ */22762276+static void batadv_tt_req_node_release(struct kref *ref)22772277+{22782278+ struct batadv_tt_req_node *tt_req_node;22792279+22802280+ tt_req_node = container_of(ref, struct batadv_tt_req_node, refcount);22812281+22822282+ kfree(tt_req_node);22832283+}22842284+22852285+/**22862286+ * batadv_tt_req_node_put - decrement the tt_req_node refcounter and22872287+ * possibly release it22882288+ * @tt_req_node: tt_req_node to be free'd22892289+ */22902290+static void batadv_tt_req_node_put(struct batadv_tt_req_node *tt_req_node)22912291+{22922292+ kref_put(&tt_req_node->refcount, batadv_tt_req_node_release);22932293+}22942294+22732295static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)22742296{22752297 struct batadv_tt_req_node *node;···2302227823032279 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {23042280 hlist_del_init(&node->list);23052305- kfree(node);22812281+ batadv_tt_req_node_put(node);23062282 }2307228323082284 spin_unlock_bh(&bat_priv->tt.req_list_lock);···23392315 if (batadv_has_timed_out(node->issued_at,23402316 BATADV_TT_REQUEST_TIMEOUT)) {23412317 hlist_del_init(&node->list);23422342- kfree(node);23182318+ batadv_tt_req_node_put(node);23432319 }23442320 }23452321 spin_unlock_bh(&bat_priv->tt.req_list_lock);···23712347 if (!tt_req_node)23722348 goto unlock;2373234923502350+ kref_init(&tt_req_node->refcount);23742351 ether_addr_copy(tt_req_node->addr, orig_node->orig);23752352 tt_req_node->issued_at = jiffies;2376235323542354+ kref_get(&tt_req_node->refcount);23772355 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);23782356unlock:23792357 spin_unlock_bh(&bat_priv->tt.req_list_lock);···26392613out:26402614 if (primary_if)26412615 batadv_hardif_put(primary_if);26162616+26422617 if (ret && tt_req_node) {26432618 spin_lock_bh(&bat_priv->tt.req_list_lock);26442644- /* hlist_del_init() verifies tt_req_node still is in the list */26452645- hlist_del_init(&tt_req_node->list);26192619+ if (!hlist_unhashed(&tt_req_node->list)) {26202620+ hlist_del_init(&tt_req_node->list);26212621+ batadv_tt_req_node_put(tt_req_node);26222622+ }26462623 spin_unlock_bh(&bat_priv->tt.req_list_lock);26472647- kfree(tt_req_node);26482624 }26252625+26262626+ if (tt_req_node)26272627+ batadv_tt_req_node_put(tt_req_node);26282628+26492629 kfree(tvlv_tt_data);26502630 return ret;26512631}···30873055 if (!batadv_compare_eth(node->addr, resp_src))30883056 continue;30893057 hlist_del_init(&node->list);30903090- kfree(node);30583058+ batadv_tt_req_node_put(node);30913059 }3092306030933061 spin_unlock_bh(&bat_priv->tt.req_list_lock);
+2
net/batman-adv/types.h
···11371137 * struct batadv_tt_req_node - data to keep track of the tt requests in flight11381138 * @addr: mac address address of the originator this request was sent to11391139 * @issued_at: timestamp used for purging stale tt requests11401140+ * @refcount: number of contexts the object is used by11401141 * @list: list node for batadv_priv_tt::req_list11411142 */11421143struct batadv_tt_req_node {11431144 u8 addr[ETH_ALEN];11441145 unsigned long issued_at;11461146+ struct kref refcount;11451147 struct hlist_node list;11461148};11471149
+12-3
net/bridge/br_input.c
···213213}214214EXPORT_SYMBOL_GPL(br_handle_frame_finish);215215216216-/* note: already called with rcu_read_lock */217217-static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)216216+static void __br_handle_local_finish(struct sk_buff *skb)218217{219218 struct net_bridge_port *p = br_port_get_rcu(skb->dev);220219 u16 vid = 0;···221222 /* check if vlan is allowed, to avoid spoofing */222223 if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid))223224 br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false);225225+}226226+227227+/* note: already called with rcu_read_lock */228228+static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)229229+{230230+ struct net_bridge_port *p = br_port_get_rcu(skb->dev);231231+232232+ __br_handle_local_finish(skb);224233225234 BR_INPUT_SKB_CB(skb)->brdev = p->br->dev;226235 br_pass_frame_up(skb);···281274 if (p->br->stp_enabled == BR_NO_STP ||282275 fwd_mask & (1u << dest[5]))283276 goto forward;284284- break;277277+ *pskb = skb;278278+ __br_handle_local_finish(skb);279279+ return RX_HANDLER_PASS;285280286281 case 0x01: /* IEEE MAC (Pause) */287282 goto drop;
···62626363/* Fills in tpi and returns header length to be pulled. */6464int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,6565- bool *csum_err, __be16 proto)6565+ bool *csum_err, __be16 proto, int nhs)6666{6767 const struct gre_base_hdr *greh;6868 __be32 *options;6969 int hdr_len;70707171- if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))7171+ if (unlikely(!pskb_may_pull(skb, nhs + sizeof(struct gre_base_hdr))))7272 return -EINVAL;73737474- greh = (struct gre_base_hdr *)skb_transport_header(skb);7474+ greh = (struct gre_base_hdr *)(skb->data + nhs);7575 if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))7676 return -EINVAL;77777878 tpi->flags = gre_flags_to_tnl_flags(greh->flags);7979 hdr_len = gre_calc_hlen(tpi->flags);80808181- if (!pskb_may_pull(skb, hdr_len))8181+ if (!pskb_may_pull(skb, nhs + hdr_len))8282 return -EINVAL;83838484- greh = (struct gre_base_hdr *)skb_transport_header(skb);8484+ greh = (struct gre_base_hdr *)(skb->data + nhs);8585 tpi->proto = greh->protocol;86868787 options = (__be32 *)(greh + 1);
+15-11
net/ipv4/ip_gre.c
···4949#include <net/gre.h>5050#include <net/dst_metadata.h>51515252-#if IS_ENABLED(CONFIG_IPV6)5353-#include <net/ipv6.h>5454-#include <net/ip6_fib.h>5555-#include <net/ip6_route.h>5656-#endif5757-5852/*5953 Problems & solutions6054 --------------------···211217 * by themselves???212218 */213219220220+ const struct iphdr *iph = (struct iphdr *)skb->data;214221 const int type = icmp_hdr(skb)->type;215222 const int code = icmp_hdr(skb)->code;216223 struct tnl_ptk_info tpi;217224 bool csum_err = false;218225219219- if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP)) < 0) {226226+ if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP),227227+ iph->ihl * 4) < 0) {220228 if (!csum_err) /* ignore csum errors. */221229 return;222230 }···334338 }335339#endif336340337337- hdr_len = gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP));341341+ hdr_len = gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP), 0);338342 if (hdr_len < 0)339343 goto drop;340344···11171121{11181122 struct nlattr *tb[IFLA_MAX + 1];11191123 struct net_device *dev;11241124+ LIST_HEAD(list_kill);11201125 struct ip_tunnel *t;11211126 int err;11221127···11331136 t->collect_md = true;1134113711351138 err = ipgre_newlink(net, dev, tb, NULL);11361136- if (err < 0)11371137- goto out;11391139+ if (err < 0) {11401140+ free_netdev(dev);11411141+ return ERR_PTR(err);11421142+ }1138114311391144 /* openvswitch users expect packet sizes to be unrestricted,11401145 * so set the largest MTU we can.···11451146 if (err)11461147 goto out;1147114811491149+ err = rtnl_configure_link(dev, NULL);11501150+ if (err < 0)11511151+ goto out;11521152+11481153 return dev;11491154out:11501150- free_netdev(dev);11551155+ ip_tunnel_dellink(dev, &list_kill);11561156+ unregister_netdevice_many(&list_kill);11511157 return ERR_PTR(err);11521158}11531159EXPORT_SYMBOL_GPL(gretap_fb_dev_create);
+3-1
net/ipv4/ipconfig.c
···127127static __be32 ic_netmask = NONE; /* Netmask for local subnet */128128__be32 ic_gateway = NONE; /* Gateway IP address */129129130130-__be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */130130+#ifdef IPCONFIG_DYNAMIC131131+static __be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */132132+#endif131133132134__be32 ic_servaddr = NONE; /* Boot server IP address */133135
···27512751 struct tcp_sock *tp = tcp_sk(sk);27522752 struct sk_buff *skb;27532753 struct sk_buff *hole = NULL;27542754- u32 last_lost;27542754+ u32 max_segs, last_lost;27552755 int mib_idx;27562756 int fwd_rexmitting = 0;27572757···27712771 last_lost = tp->snd_una;27722772 }2773277327742774+ max_segs = tcp_tso_autosize(sk, tcp_current_mss(sk));27742775 tcp_for_write_queue_from(skb, sk) {27752776 __u8 sacked = TCP_SKB_CB(skb)->sacked;27762777 int segs;···27852784 segs = tp->snd_cwnd - tcp_packets_in_flight(tp);27862785 if (segs <= 0)27872786 return;27872787+ /* In case tcp_shift_skb_data() have aggregated large skbs,27882788+ * we need to make sure not sending too bigs TSO packets27892789+ */27902790+ segs = min_t(int, segs, max_segs);2788279127892792 if (fwd_rexmitting) {27902793begin_fwd:
+21-59
net/ipv4/udp.c
···391391 return udp_lib_get_port(sk, snum, ipv4_rcv_saddr_equal, hash2_nulladdr);392392}393393394394-static inline int compute_score(struct sock *sk, struct net *net,395395- __be32 saddr, unsigned short hnum, __be16 sport,396396- __be32 daddr, __be16 dport, int dif)394394+static int compute_score(struct sock *sk, struct net *net,395395+ __be32 saddr, __be16 sport,396396+ __be32 daddr, unsigned short hnum, int dif)397397{398398 int score;399399 struct inet_sock *inet;···434434 return score;435435}436436437437-/*438438- * In this second variant, we check (daddr, dport) matches (inet_rcv_sadd, inet_num)439439- */440440-static inline int compute_score2(struct sock *sk, struct net *net,441441- __be32 saddr, __be16 sport,442442- __be32 daddr, unsigned int hnum, int dif)443443-{444444- int score;445445- struct inet_sock *inet;446446-447447- if (!net_eq(sock_net(sk), net) ||448448- ipv6_only_sock(sk))449449- return -1;450450-451451- inet = inet_sk(sk);452452-453453- if (inet->inet_rcv_saddr != daddr ||454454- inet->inet_num != hnum)455455- return -1;456456-457457- score = (sk->sk_family == PF_INET) ? 2 : 1;458458-459459- if (inet->inet_daddr) {460460- if (inet->inet_daddr != saddr)461461- return -1;462462- score += 4;463463- }464464-465465- if (inet->inet_dport) {466466- if (inet->inet_dport != sport)467467- return -1;468468- score += 4;469469- }470470-471471- if (sk->sk_bound_dev_if) {472472- if (sk->sk_bound_dev_if != dif)473473- return -1;474474- score += 4;475475- }476476-477477- if (sk->sk_incoming_cpu == raw_smp_processor_id())478478- score++;479479-480480- return score;481481-}482482-483437static u32 udp_ehashfn(const struct net *net, const __be32 laddr,484438 const __u16 lport, const __be32 faddr,485439 const __be16 fport)···446492 udp_ehash_secret + net_hash_mix(net));447493}448494449449-/* called with read_rcu_lock() */495495+/* called with rcu_read_lock() */450496static struct sock *udp4_lib_lookup2(struct net *net,451497 __be32 saddr, __be16 sport,452498 __be32 daddr, unsigned int hnum, int dif,453453- struct udp_hslot *hslot2, unsigned int slot2,499499+ struct udp_hslot *hslot2,454500 struct sk_buff *skb)455501{456502 struct sock *sk, *result;···460506 result = NULL;461507 badness = 0;462508 udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) {463463- score = compute_score2(sk, net, saddr, sport,509509+ score = compute_score(sk, net, saddr, sport,464510 daddr, hnum, dif);465511 if (score > badness) {466512 reuseport = sk->sk_reuseport;···508554509555 result = udp4_lib_lookup2(net, saddr, sport,510556 daddr, hnum, dif,511511- hslot2, slot2, skb);557557+ hslot2, skb);512558 if (!result) {559559+ unsigned int old_slot2 = slot2;513560 hash2 = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum);514561 slot2 = hash2 & udptable->mask;562562+ /* avoid searching the same slot again. */563563+ if (unlikely(slot2 == old_slot2))564564+ return result;565565+515566 hslot2 = &udptable->hash2[slot2];516567 if (hslot->count < hslot2->count)517568 goto begin;518569519570 result = udp4_lib_lookup2(net, saddr, sport,520520- htonl(INADDR_ANY), hnum, dif,521521- hslot2, slot2, skb);571571+ daddr, hnum, dif,572572+ hslot2, skb);522573 }523574 return result;524575 }···531572 result = NULL;532573 badness = 0;533574 sk_for_each_rcu(sk, &hslot->head) {534534- score = compute_score(sk, net, saddr, hnum, sport,535535- daddr, dport, dif);575575+ score = compute_score(sk, net, saddr, sport,576576+ daddr, hnum, dif);536577 if (score > badness) {537578 reuseport = sk->sk_reuseport;538579 if (reuseport) {···17141755 return err;17151756 }1716175717171717- return skb_checksum_init_zero_check(skb, proto, uh->check,17181718- inet_compute_pseudo);17581758+ /* Note, we are only interested in != 0 or == 0, thus the17591759+ * force to int.17601760+ */17611761+ return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,17621762+ inet_compute_pseudo);17191763}1720176417211765/*
+1-1
net/ipv6/icmp.c
···98989999 if (!(type & ICMPV6_INFOMSG_MASK))100100 if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)101101- ping_err(skb, offset, info);101101+ ping_err(skb, offset, ntohl(info));102102}103103104104static int icmpv6_rcv(struct sk_buff *skb);
+5-2
net/ipv6/ip6_checksum.c
···7878 * we accept a checksum of zero here. When we find the socket7979 * for the UDP packet we'll check if that socket allows zero checksum8080 * for IPv6 (set by socket option).8181+ *8282+ * Note, we are only interested in != 0 or == 0, thus the8383+ * force to int.8184 */8282- return skb_checksum_init_zero_check(skb, proto, uh->check,8383- ip6_compute_pseudo);8585+ return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,8686+ ip6_compute_pseudo);8487}8588EXPORT_SYMBOL(udp6_csum_init);8689
···148148void mesh_sta_cleanup(struct sta_info *sta)149149{150150 struct ieee80211_sub_if_data *sdata = sta->sdata;151151- u32 changed;151151+ u32 changed = 0;152152153153 /*154154 * maybe userspace handles peer allocation and peering, but in either155155 * case the beacon is still generated by the kernel and we might need156156 * an update.157157 */158158- changed = mesh_accept_plinks_update(sdata);158158+ if (sdata->u.mesh.user_mpm &&159159+ sta->mesh->plink_state == NL80211_PLINK_ESTAB)160160+ changed |= mesh_plink_dec_estab_count(sdata);161161+ changed |= mesh_accept_plinks_update(sdata);159162 if (!sdata->u.mesh.user_mpm) {160163 changed |= mesh_plink_deactivate(sta);161164 del_timer_sync(&sta->mesh->plink_timer);
···143143 list_for_each_entry_continue_rcu(rule, &chain->rules, list) {144144145145 /* This rule is not active, skip. */146146- if (unlikely(rule->genmask & (1 << gencursor)))146146+ if (unlikely(rule->genmask & gencursor))147147 continue;148148149149 rulenum++;
+1-2
net/netfilter/nft_hash.c
···189189 struct nft_hash_elem *he;190190 struct rhashtable_iter hti;191191 struct nft_set_elem elem;192192- u8 genmask = nft_genmask_cur(read_pnet(&set->pnet));193192 int err;194193195194 err = rhashtable_walk_init(&priv->ht, &hti, GFP_KERNEL);···217218 goto cont;218219 if (nft_set_elem_expired(&he->ext))219220 goto cont;220220- if (!nft_set_elem_active(&he->ext, genmask))221221+ if (!nft_set_elem_active(&he->ext, iter->genmask))221222 goto cont;222223223224 elem.priv = he;
···111111 }112112 }113113114114- if (conn->c_version < RDS_PROTOCOL(3,1)) {114114+ if (conn->c_version < RDS_PROTOCOL(3, 1)) {115115 printk(KERN_NOTICE "RDS/IB: Connection to %pI4 version %u.%u failed,"116116 " no longer supported\n",117117 &conn->c_faddr,
+3-2
net/rds/loop.c
···9595 */9696static void rds_loop_inc_free(struct rds_incoming *inc)9797{9898- struct rds_message *rm = container_of(inc, struct rds_message, m_inc);9999- rds_message_put(rm);9898+ struct rds_message *rm = container_of(inc, struct rds_message, m_inc);9999+100100+ rds_message_put(rm);100101}101102102103/* we need to at least give the thread something to succeed */
···8383void rds_tcp_xmit_prepare(struct rds_connection *conn);8484void rds_tcp_xmit_complete(struct rds_connection *conn);8585int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,8686- unsigned int hdr_off, unsigned int sg, unsigned int off);8686+ unsigned int hdr_off, unsigned int sg, unsigned int off);8787void rds_tcp_write_space(struct sock *sk);88888989/* tcp_stats.c */
+13-13
net/rds/tcp_connect.c
···54545555 rdsdebug("sock %p state_change to %d\n", tc->t_sock, sk->sk_state);56565757- switch(sk->sk_state) {5858- /* ignore connecting sockets as they make progress */5959- case TCP_SYN_SENT:6060- case TCP_SYN_RECV:6161- break;6262- case TCP_ESTABLISHED:6363- rds_connect_path_complete(conn, RDS_CONN_CONNECTING);6464- break;6565- case TCP_CLOSE_WAIT:6666- case TCP_CLOSE:6767- rds_conn_drop(conn);6868- default:6969- break;5757+ switch (sk->sk_state) {5858+ /* ignore connecting sockets as they make progress */5959+ case TCP_SYN_SENT:6060+ case TCP_SYN_RECV:6161+ break;6262+ case TCP_ESTABLISHED:6363+ rds_connect_path_complete(conn, RDS_CONN_CONNECTING);6464+ break;6565+ case TCP_CLOSE_WAIT:6666+ case TCP_CLOSE:6767+ rds_conn_drop(conn);6868+ default:6969+ break;7070 }7171out:7272 read_unlock_bh(&sk->sk_callback_lock);
···171171 while (left) {172172 if (!tinc) {173173 tinc = kmem_cache_alloc(rds_tcp_incoming_slab,174174- arg->gfp);174174+ arg->gfp);175175 if (!tinc) {176176 desc->error = -ENOMEM;177177 goto out;
+7-7
net/rds/tcp_send.c
···6666static int rds_tcp_sendmsg(struct socket *sock, void *data, unsigned int len)6767{6868 struct kvec vec = {6969- .iov_base = data,7070- .iov_len = len,6969+ .iov_base = data,7070+ .iov_len = len,7171 };7272- struct msghdr msg = {7373- .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,7474- };7272+ struct msghdr msg = {7373+ .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,7474+ };75757676 return kernel_sendmsg(sock, &msg, &vec, 1, vec.iov_len);7777}78787979/* the core send_sem serializes this with other xmit and shutdown */8080int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,8181- unsigned int hdr_off, unsigned int sg, unsigned int off)8181+ unsigned int hdr_off, unsigned int sg, unsigned int off)8282{8383 struct rds_tcp_connection *tc = conn->c_transport_data;8484 int done = 0;···196196 tc->t_last_seen_una = rds_tcp_snd_una(tc);197197 rds_send_drop_acked(conn, rds_tcp_snd_una(tc), rds_tcp_is_acked);198198199199- if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf)199199+ if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf)200200 queue_delayed_work(rds_wq, &conn->c_send_w, 0);201201202202out:
+1-2
net/rds/transport.c
···140140 rds_info_iter_unmap(iter);141141 down_read(&rds_trans_sem);142142143143- for (i = 0; i < RDS_TRANS_COUNT; i++)144144- {143143+ for (i = 0; i < RDS_TRANS_COUNT; i++) {145144 trans = transports[i];146145 if (!trans || !trans->stats_info_copy)147146 continue;
···106106}107107EXPORT_SYMBOL_GPL(ife_get_meta_u16);108108109109-int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval)109109+int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval, gfp_t gfp)110110{111111- mi->metaval = kmemdup(metaval, sizeof(u32), GFP_KERNEL);111111+ mi->metaval = kmemdup(metaval, sizeof(u32), gfp);112112 if (!mi->metaval)113113 return -ENOMEM;114114···116116}117117EXPORT_SYMBOL_GPL(ife_alloc_meta_u32);118118119119-int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval)119119+int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval, gfp_t gfp)120120{121121- mi->metaval = kmemdup(metaval, sizeof(u16), GFP_KERNEL);121121+ mi->metaval = kmemdup(metaval, sizeof(u16), gfp);122122 if (!mi->metaval)123123 return -ENOMEM;124124···240240}241241242242/* called when adding new meta information243243- * under ife->tcf_lock243243+ * under ife->tcf_lock for existing action244244*/245245static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,246246- void *val, int len)246246+ void *val, int len, bool exists)247247{248248 struct tcf_meta_ops *ops = find_ife_oplist(metaid);249249 int ret = 0;···251251 if (!ops) {252252 ret = -ENOENT;253253#ifdef CONFIG_MODULES254254- spin_unlock_bh(&ife->tcf_lock);254254+ if (exists)255255+ spin_unlock_bh(&ife->tcf_lock);255256 rtnl_unlock();256257 request_module("ifemeta%u", metaid);257258 rtnl_lock();258258- spin_lock_bh(&ife->tcf_lock);259259+ if (exists)260260+ spin_lock_bh(&ife->tcf_lock);259261 ops = find_ife_oplist(metaid);260262#endif261263 }···274272}275273276274/* called when adding new meta information277277- * under ife->tcf_lock275275+ * under ife->tcf_lock for existing action278276*/279277static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,280280- int len)278278+ int len, bool atomic)281279{282280 struct tcf_meta_info *mi = NULL;283281 struct tcf_meta_ops *ops = find_ife_oplist(metaid);···286284 if (!ops)287285 return -ENOENT;288286289289- mi = kzalloc(sizeof(*mi), GFP_KERNEL);287287+ mi = kzalloc(sizeof(*mi), atomic ? GFP_ATOMIC : GFP_KERNEL);290288 if (!mi) {291289 /*put back what find_ife_oplist took */292290 module_put(ops->owner);···296294 mi->metaid = metaid;297295 mi->ops = ops;298296 if (len > 0) {299299- ret = ops->alloc(mi, metaval);297297+ ret = ops->alloc(mi, metaval, atomic ? GFP_ATOMIC : GFP_KERNEL);300298 if (ret != 0) {301299 kfree(mi);302300 module_put(ops->owner);···315313 int rc = 0;316314 int installed = 0;317315316316+ read_lock(&ife_mod_lock);318317 list_for_each_entry(o, &ifeoplist, list) {319319- rc = add_metainfo(ife, o->metaid, NULL, 0);318318+ rc = add_metainfo(ife, o->metaid, NULL, 0, true);320319 if (rc == 0)321320 installed += 1;322321 }322322+ read_unlock(&ife_mod_lock);323323324324 if (installed)325325 return 0;···389385 spin_unlock_bh(&ife->tcf_lock);390386}391387392392-/* under ife->tcf_lock */393393-static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb)388388+/* under ife->tcf_lock for existing action */389389+static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,390390+ bool exists)394391{395392 int len = 0;396393 int rc = 0;···403398 val = nla_data(tb[i]);404399 len = nla_len(tb[i]);405400406406- rc = load_metaops_and_vet(ife, i, val, len);401401+ rc = load_metaops_and_vet(ife, i, val, len, exists);407402 if (rc != 0)408403 return rc;409404410410- rc = add_metainfo(ife, i, val, len);405405+ rc = add_metainfo(ife, i, val, len, exists);411406 if (rc)412407 return rc;413408 }···479474 saddr = nla_data(tb[TCA_IFE_SMAC]);480475 }481476482482- spin_lock_bh(&ife->tcf_lock);477477+ if (exists)478478+ spin_lock_bh(&ife->tcf_lock);483479 ife->tcf_action = parm->action;484480485481 if (parm->flags & IFE_ENCODE) {···510504 if (ret == ACT_P_CREATED)511505 _tcf_ife_cleanup(a, bind);512506513513- spin_unlock_bh(&ife->tcf_lock);507507+ if (exists)508508+ spin_unlock_bh(&ife->tcf_lock);514509 return err;515510 }516511517517- err = populate_metalist(ife, tb2);512512+ err = populate_metalist(ife, tb2, exists);518513 if (err)519514 goto metadata_parse_err;520515···530523 if (ret == ACT_P_CREATED)531524 _tcf_ife_cleanup(a, bind);532525533533- spin_unlock_bh(&ife->tcf_lock);526526+ if (exists)527527+ spin_unlock_bh(&ife->tcf_lock);534528 return err;535529 }536530 }537531538538- spin_unlock_bh(&ife->tcf_lock);532532+ if (exists)533533+ spin_unlock_bh(&ife->tcf_lock);539534540535 if (ret == ACT_P_CREATED)541536 tcf_hash_insert(tn, a);
+5-2
net/sched/act_ipt.c
···121121 }122122123123 td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);124124- if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size)124124+ if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {125125+ if (exists)126126+ tcf_hash_release(a, bind);125127 return -EINVAL;128128+ }126129127127- if (!tcf_hash_check(tn, index, a, bind)) {130130+ if (!exists) {128131 ret = tcf_hash_create(tn, index, est, a, sizeof(*ipt), bind,129132 false);130133 if (ret)
+4
net/sched/sch_fifo.c
···37373838static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch)3939{4040+ unsigned int prev_backlog;4141+4042 if (likely(skb_queue_len(&sch->q) < sch->limit))4143 return qdisc_enqueue_tail(skb, sch);42444545+ prev_backlog = sch->qstats.backlog;4346 /* queue full, remove one skb to fulfill the limit */4447 __qdisc_queue_drop_head(sch, &sch->q);4548 qdisc_qstats_drop(sch);4649 qdisc_enqueue_tail(skb, sch);47505151+ qdisc_tree_reduce_backlog(sch, 0, prev_backlog - sch->qstats.backlog);4852 return NET_XMIT_CN;4953}5054
···405405 return 0;406406407407 /* Send RESET message even if bearer is detached from device */408408- tipc_ptr = rtnl_dereference(dev->tipc_ptr);408408+ tipc_ptr = rcu_dereference_rtnl(dev->tipc_ptr);409409 if (unlikely(!tipc_ptr && !msg_is_reset(buf_msg(skb))))410410 goto drop;411411
+2-1
net/tipc/link.c
···704704 */705705int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq)706706{707707- int mtyp, rc = 0;707707+ int mtyp = 0;708708+ int rc = 0;708709 bool state = false;709710 bool probe = false;710711 bool setup = false;
+6
net/tipc/msg.c
···4141#include "name_table.h"42424343#define MAX_FORWARD_SIZE 10244444+#define BUF_HEADROOM (LL_MAX_HEADER + 48)4545+#define BUF_TAILROOM 1644464547static unsigned int align(unsigned int i)4648{···506504 memcpy(hdr, &ohdr, BASIC_H_SIZE);507505 msg_set_hdr_sz(hdr, BASIC_H_SIZE);508506 }507507+508508+ if (skb_cloned(_skb) &&509509+ pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL))510510+ goto exit;509511510512 /* Now reverse the concerned fields */511513 msg_set_errcode(hdr, err);
-11
net/tipc/msg.h
···94949595#define TIPC_MEDIA_INFO_OFFSET 596969797-/**9898- * TIPC message buffer code9999- *100100- * TIPC message buffer headroom reserves space for the worst-case101101- * link-level device header (in case the message is sent off-node).102102- *103103- * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields104104- * are word aligned for quicker access105105- */106106-#define BUF_HEADROOM (LL_MAX_HEADER + 48)107107-10897struct tipc_skb_cb {10998 void *handle;11099 struct sk_buff *tail;
+42-12
net/tipc/socket.c
···796796 * @tsk: receiving socket797797 * @skb: pointer to message buffer.798798 */799799-static void tipc_sk_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb)799799+static void tipc_sk_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb,800800+ struct sk_buff_head *xmitq)800801{801802 struct sock *sk = &tsk->sk;803803+ u32 onode = tsk_own_node(tsk);802804 struct tipc_msg *hdr = buf_msg(skb);803805 int mtyp = msg_type(hdr);804806 bool conn_cong;···813811814812 if (mtyp == CONN_PROBE) {815813 msg_set_type(hdr, CONN_PROBE_REPLY);816816- tipc_sk_respond(sk, skb, TIPC_OK);814814+ if (tipc_msg_reverse(onode, &skb, TIPC_OK))815815+ __skb_queue_tail(xmitq, skb);817816 return;818817 } else if (mtyp == CONN_ACK) {819818 conn_cong = tsk_conn_cong(tsk);···16891686 *16901687 * Returns true if message was added to socket receive queue, otherwise false16911688 */16921692-static bool filter_rcv(struct sock *sk, struct sk_buff *skb)16891689+static bool filter_rcv(struct sock *sk, struct sk_buff *skb,16901690+ struct sk_buff_head *xmitq)16931691{16941692 struct socket *sock = sk->sk_socket;16951693 struct tipc_sock *tsk = tipc_sk(sk);···17001696 int usr = msg_user(hdr);1701169717021698 if (unlikely(msg_user(hdr) == CONN_MANAGER)) {17031703- tipc_sk_proto_rcv(tsk, skb);16991699+ tipc_sk_proto_rcv(tsk, skb, xmitq);17041700 return false;17051701 }17061702···17431739 return true;1744174017451741reject:17461746- tipc_sk_respond(sk, skb, err);17421742+ if (tipc_msg_reverse(tsk_own_node(tsk), &skb, err))17431743+ __skb_queue_tail(xmitq, skb);17471744 return false;17481745}17491746···17601755static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb)17611756{17621757 unsigned int truesize = skb->truesize;17581758+ struct sk_buff_head xmitq;17591759+ u32 dnode, selector;1763176017641764- if (likely(filter_rcv(sk, skb)))17611761+ __skb_queue_head_init(&xmitq);17621762+17631763+ if (likely(filter_rcv(sk, skb, &xmitq))) {17651764 atomic_add(truesize, &tipc_sk(sk)->dupl_rcvcnt);17651765+ return 0;17661766+ }17671767+17681768+ if (skb_queue_empty(&xmitq))17691769+ return 0;17701770+17711771+ /* Send response/rejected message */17721772+ skb = __skb_dequeue(&xmitq);17731773+ dnode = msg_destnode(buf_msg(skb));17741774+ selector = msg_origport(buf_msg(skb));17751775+ tipc_node_xmit_skb(sock_net(sk), skb, dnode, selector);17661776 return 0;17671777}17681778···17911771 * Caller must hold socket lock17921772 */17931773static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,17941794- u32 dport)17741774+ u32 dport, struct sk_buff_head *xmitq)17951775{17761776+ unsigned long time_limit = jiffies + 2;17771777+ struct sk_buff *skb;17961778 unsigned int lim;17971779 atomic_t *dcnt;17981798- struct sk_buff *skb;17991799- unsigned long time_limit = jiffies + 2;17801780+ u32 onode;1800178118011782 while (skb_queue_len(inputq)) {18021783 if (unlikely(time_after_eq(jiffies, time_limit)))···1809178818101789 /* Add message directly to receive queue if possible */18111790 if (!sock_owned_by_user(sk)) {18121812- filter_rcv(sk, skb);17911791+ filter_rcv(sk, skb, xmitq);18131792 continue;18141793 }18151794···18221801 continue;1823180218241803 /* Overload => reject message back to sender */18251825- tipc_sk_respond(sk, skb, TIPC_ERR_OVERLOAD);18041804+ onode = tipc_own_addr(sock_net(sk));18051805+ if (tipc_msg_reverse(onode, &skb, TIPC_ERR_OVERLOAD))18061806+ __skb_queue_tail(xmitq, skb);18261807 break;18271808 }18281809}···18371814 */18381815void tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq)18391816{18171817+ struct sk_buff_head xmitq;18401818 u32 dnode, dport = 0;18411819 int err;18421820 struct tipc_sock *tsk;18431821 struct sock *sk;18441822 struct sk_buff *skb;1845182318241824+ __skb_queue_head_init(&xmitq);18461825 while (skb_queue_len(inputq)) {18471826 dport = tipc_skb_peek_port(inputq, dport);18481827 tsk = tipc_sk_lookup(net, dport);···18521827 if (likely(tsk)) {18531828 sk = &tsk->sk;18541829 if (likely(spin_trylock_bh(&sk->sk_lock.slock))) {18551855- tipc_sk_enqueue(inputq, sk, dport);18301830+ tipc_sk_enqueue(inputq, sk, dport, &xmitq);18561831 spin_unlock_bh(&sk->sk_lock.slock);18321832+ }18331833+ /* Send pending response/rejected messages, if any */18341834+ while ((skb = __skb_dequeue(&xmitq))) {18351835+ dnode = msg_destnode(buf_msg(skb));18361836+ tipc_node_xmit_skb(net, skb, dnode, dport);18571837 }18581838 sock_put(sk);18591839 continue;
+10-2
net/vmw_vsock/af_vsock.c
···6161 * function will also cleanup rejected sockets, those that reach the connected6262 * state but leave it before they have been accepted.6363 *6464+ * - Lock ordering for pending or accept queue sockets is:6565+ *6666+ * lock_sock(listener);6767+ * lock_sock_nested(pending, SINGLE_DEPTH_NESTING);6868+ *6969+ * Using explicit nested locking keeps lockdep happy since normally only one7070+ * lock of a given class may be taken at a time.7171+ *6472 * - Sockets created by user action will be cleaned up when the user process6573 * calls close(2), causing our release implementation to be called. Our release6674 * implementation will perform some cleanup then drop the last reference so our···451443 cleanup = true;452444453445 lock_sock(listener);454454- lock_sock(sk);446446+ lock_sock_nested(sk, SINGLE_DEPTH_NESTING);455447456448 if (vsock_is_pending(sk)) {457449 vsock_remove_pending(listener, sk);···13001292 if (connected) {13011293 listener->sk_ack_backlog--;1302129413031303- lock_sock(connected);12951295+ lock_sock_nested(connected, SINGLE_DEPTH_NESTING);13041296 vconnected = vsock_sk(connected);1305129713061298 /* If the listener socket has received an error, then we should