Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

+375 -254
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 0 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc7 5 + EXTRAVERSION = -rc8 6 6 NAME = Shy Crocodile 7 7 8 8 # *DOCUMENTATION*
+2 -1
arch/arm/crypto/sha256-armv4.pl
··· 212 212 .global sha256_block_data_order 213 213 .type sha256_block_data_order,%function 214 214 sha256_block_data_order: 215 + .Lsha256_block_data_order: 215 216 #if __ARM_ARCH__<7 216 217 sub r3,pc,#8 @ sha256_block_data_order 217 218 #else 218 - adr r3,sha256_block_data_order 219 + adr r3,.Lsha256_block_data_order 219 220 #endif 220 221 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) 221 222 ldr r12,.LOPENSSL_armcap
+2 -1
arch/arm/crypto/sha256-core.S_shipped
··· 93 93 .global sha256_block_data_order 94 94 .type sha256_block_data_order,%function 95 95 sha256_block_data_order: 96 + .Lsha256_block_data_order: 96 97 #if __ARM_ARCH__<7 97 98 sub r3,pc,#8 @ sha256_block_data_order 98 99 #else 99 - adr r3,sha256_block_data_order 100 + adr r3,.Lsha256_block_data_order 100 101 #endif 101 102 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) 102 103 ldr r12,.LOPENSSL_armcap
+2 -1
arch/arm/crypto/sha512-armv4.pl
··· 274 274 .global sha512_block_data_order 275 275 .type sha512_block_data_order,%function 276 276 sha512_block_data_order: 277 + .Lsha512_block_data_order: 277 278 #if __ARM_ARCH__<7 278 279 sub r3,pc,#8 @ sha512_block_data_order 279 280 #else 280 - adr r3,sha512_block_data_order 281 + adr r3,.Lsha512_block_data_order 281 282 #endif 282 283 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) 283 284 ldr r12,.LOPENSSL_armcap
+2 -1
arch/arm/crypto/sha512-core.S_shipped
··· 141 141 .global sha512_block_data_order 142 142 .type sha512_block_data_order,%function 143 143 sha512_block_data_order: 144 + .Lsha512_block_data_order: 144 145 #if __ARM_ARCH__<7 145 146 sub r3,pc,#8 @ sha512_block_data_order 146 147 #else 147 - adr r3,sha512_block_data_order 148 + adr r3,.Lsha512_block_data_order 148 149 #endif 149 150 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__) 150 151 ldr r12,.LOPENSSL_armcap
+18 -2
arch/arm64/crypto/chacha-neon-core.S
··· 158 158 mov w3, w2 159 159 bl chacha_permute 160 160 161 - st1 {v0.16b}, [x1], #16 162 - st1 {v3.16b}, [x1] 161 + st1 {v0.4s}, [x1], #16 162 + st1 {v3.4s}, [x1] 163 163 164 164 ldp x29, x30, [sp], #16 165 165 ret ··· 532 532 add v3.4s, v3.4s, v19.4s 533 533 add a2, a2, w8 534 534 add a3, a3, w9 535 + CPU_BE( rev a0, a0 ) 536 + CPU_BE( rev a1, a1 ) 537 + CPU_BE( rev a2, a2 ) 538 + CPU_BE( rev a3, a3 ) 535 539 536 540 ld4r {v24.4s-v27.4s}, [x0], #16 537 541 ld4r {v28.4s-v31.4s}, [x0] ··· 556 552 add v7.4s, v7.4s, v23.4s 557 553 add a6, a6, w8 558 554 add a7, a7, w9 555 + CPU_BE( rev a4, a4 ) 556 + CPU_BE( rev a5, a5 ) 557 + CPU_BE( rev a6, a6 ) 558 + CPU_BE( rev a7, a7 ) 559 559 560 560 // x8[0-3] += s2[0] 561 561 // x9[0-3] += s2[1] ··· 577 569 add v11.4s, v11.4s, v27.4s 578 570 add a10, a10, w8 579 571 add a11, a11, w9 572 + CPU_BE( rev a8, a8 ) 573 + CPU_BE( rev a9, a9 ) 574 + CPU_BE( rev a10, a10 ) 575 + CPU_BE( rev a11, a11 ) 580 576 581 577 // x12[0-3] += s3[0] 582 578 // x13[0-3] += s3[1] ··· 598 586 add v15.4s, v15.4s, v31.4s 599 587 add a14, a14, w8 600 588 add a15, a15, w9 589 + CPU_BE( rev a12, a12 ) 590 + CPU_BE( rev a13, a13 ) 591 + CPU_BE( rev a14, a14 ) 592 + CPU_BE( rev a15, a15 ) 601 593 602 594 // interleave 32-bit words in state n, n+1 603 595 ldp w6, w7, [x2], #64
+8
arch/mips/bcm63xx/dev-enet.c
··· 70 70 71 71 static int shared_device_registered; 72 72 73 + static u64 enet_dmamask = DMA_BIT_MASK(32); 74 + 73 75 static struct resource enet0_res[] = { 74 76 { 75 77 .start = -1, /* filled at runtime */ ··· 101 99 .resource = enet0_res, 102 100 .dev = { 103 101 .platform_data = &enet0_pd, 102 + .dma_mask = &enet_dmamask, 103 + .coherent_dma_mask = DMA_BIT_MASK(32), 104 104 }, 105 105 }; 106 106 ··· 135 131 .resource = enet1_res, 136 132 .dev = { 137 133 .platform_data = &enet1_pd, 134 + .dma_mask = &enet_dmamask, 135 + .coherent_dma_mask = DMA_BIT_MASK(32), 138 136 }, 139 137 }; 140 138 ··· 163 157 .resource = enetsw_res, 164 158 .dev = { 165 159 .platform_data = &enetsw_pd, 160 + .dma_mask = &enet_dmamask, 161 + .coherent_dma_mask = DMA_BIT_MASK(32), 166 162 }, 167 163 }; 168 164
+1 -2
arch/mips/kernel/cmpxchg.c
··· 54 54 unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old, 55 55 unsigned long new, unsigned int size) 56 56 { 57 - u32 mask, old32, new32, load32; 57 + u32 mask, old32, new32, load32, load; 58 58 volatile u32 *ptr32; 59 59 unsigned int shift; 60 - u8 load; 61 60 62 61 /* Check that ptr is naturally aligned */ 63 62 WARN_ON((unsigned long)ptr & (size - 1));
+2 -1
arch/mips/kernel/setup.c
··· 384 384 init_initrd(); 385 385 reserved_end = (unsigned long) PFN_UP(__pa_symbol(&_end)); 386 386 387 - memblock_reserve(PHYS_OFFSET, reserved_end << PAGE_SHIFT); 387 + memblock_reserve(PHYS_OFFSET, 388 + (reserved_end << PAGE_SHIFT) - PHYS_OFFSET); 388 389 389 390 /* 390 391 * max_low_pfn is not a number of pages. The number of pages
+2 -2
arch/mips/lantiq/xway/vmmc.c
··· 31 31 dma_addr_t dma; 32 32 33 33 cp1_base = 34 - (void *) CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, 35 - &dma, GFP_ATOMIC)); 34 + (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE, 35 + &dma, GFP_KERNEL)); 36 36 37 37 gpio_count = of_gpio_count(pdev->dev.of_node); 38 38 while (gpio_count > 0) {
+1 -1
arch/x86/include/asm/hyperv-tlfs.h
··· 841 841 * count is equal with how many entries of union hv_gpa_page_range can 842 842 * be populated into the input parameter page. 843 843 */ 844 - #define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) / \ 844 + #define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) / \ 845 845 sizeof(union hv_gpa_page_range)) 846 846 847 847 struct hv_guest_mapping_flush_list {
+4 -2
arch/x86/include/asm/uaccess.h
··· 284 284 __put_user_goto(x, ptr, "l", "k", "ir", label); \ 285 285 break; \ 286 286 case 8: \ 287 - __put_user_goto_u64((__typeof__(*ptr))(x), ptr, label); \ 287 + __put_user_goto_u64(x, ptr, label); \ 288 288 break; \ 289 289 default: \ 290 290 __put_user_bad(); \ ··· 431 431 ({ \ 432 432 __label__ __pu_label; \ 433 433 int __pu_err = -EFAULT; \ 434 + __typeof__(*(ptr)) __pu_val; \ 435 + __pu_val = x; \ 434 436 __uaccess_begin(); \ 435 - __put_user_size((x), (ptr), (size), __pu_label); \ 437 + __put_user_size(__pu_val, (ptr), (size), __pu_label); \ 436 438 __pu_err = 0; \ 437 439 __pu_label: \ 438 440 __uaccess_end(); \
-58
arch/x86/mm/extable.c
··· 117 117 } 118 118 EXPORT_SYMBOL_GPL(ex_handler_fprestore); 119 119 120 - /* Helper to check whether a uaccess fault indicates a kernel bug. */ 121 - static bool bogus_uaccess(struct pt_regs *regs, int trapnr, 122 - unsigned long fault_addr) 123 - { 124 - /* This is the normal case: #PF with a fault address in userspace. */ 125 - if (trapnr == X86_TRAP_PF && fault_addr < TASK_SIZE_MAX) 126 - return false; 127 - 128 - /* 129 - * This code can be reached for machine checks, but only if the #MC 130 - * handler has already decided that it looks like a candidate for fixup. 131 - * This e.g. happens when attempting to access userspace memory which 132 - * the CPU can't access because of uncorrectable bad memory. 133 - */ 134 - if (trapnr == X86_TRAP_MC) 135 - return false; 136 - 137 - /* 138 - * There are two remaining exception types we might encounter here: 139 - * - #PF for faulting accesses to kernel addresses 140 - * - #GP for faulting accesses to noncanonical addresses 141 - * Complain about anything else. 142 - */ 143 - if (trapnr != X86_TRAP_PF && trapnr != X86_TRAP_GP) { 144 - WARN(1, "unexpected trap %d in uaccess\n", trapnr); 145 - return false; 146 - } 147 - 148 - /* 149 - * This is a faulting memory access in kernel space, on a kernel 150 - * address, in a usercopy function. This can e.g. be caused by improper 151 - * use of helpers like __put_user and by improper attempts to access 152 - * userspace addresses in KERNEL_DS regions. 153 - * The one (semi-)legitimate exception are probe_kernel_{read,write}(), 154 - * which can be invoked from places like kgdb, /dev/mem (for reading) 155 - * and privileged BPF code (for reading). 156 - * The probe_kernel_*() functions set the kernel_uaccess_faults_ok flag 157 - * to tell us that faulting on kernel addresses, and even noncanonical 158 - * addresses, in a userspace accessor does not necessarily imply a 159 - * kernel bug, root might just be doing weird stuff. 160 - */ 161 - if (current->kernel_uaccess_faults_ok) 162 - return false; 163 - 164 - /* This is bad. Refuse the fixup so that we go into die(). */ 165 - if (trapnr == X86_TRAP_PF) { 166 - pr_emerg("BUG: pagefault on kernel address 0x%lx in non-whitelisted uaccess\n", 167 - fault_addr); 168 - } else { 169 - pr_emerg("BUG: GPF in non-whitelisted uaccess (non-canonical address?)\n"); 170 - } 171 - return true; 172 - } 173 - 174 120 __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup, 175 121 struct pt_regs *regs, int trapnr, 176 122 unsigned long error_code, 177 123 unsigned long fault_addr) 178 124 { 179 - if (bogus_uaccess(regs, trapnr, fault_addr)) 180 - return false; 181 125 regs->ip = ex_fixup_addr(fixup); 182 126 return true; 183 127 } ··· 132 188 unsigned long error_code, 133 189 unsigned long fault_addr) 134 190 { 135 - if (bogus_uaccess(regs, trapnr, fault_addr)) 136 - return false; 137 191 /* Special hack for uaccess_err */ 138 192 current->thread.uaccess_err = 1; 139 193 regs->ip = ex_fixup_addr(fixup);
+1 -1
drivers/crypto/ccree/cc_pm.h
··· 30 30 return 0; 31 31 } 32 32 33 - static void cc_pm_go(struct cc_drvdata *drvdata) {} 33 + static inline void cc_pm_go(struct cc_drvdata *drvdata) {} 34 34 35 35 static inline void cc_pm_fini(struct cc_drvdata *drvdata) {} 36 36
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
··· 405 405 struct amdgpu_flip_work *pflip_works; 406 406 enum amdgpu_flip_status pflip_status; 407 407 int deferred_flip_completion; 408 + u64 last_flip_vblank; 408 409 /* pll sharing */ 409 410 struct amdgpu_atom_ss ss; 410 411 bool ss_enabled;
+23 -4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 303 303 return; 304 304 } 305 305 306 + /* Update to correct count(s) if racing with vblank irq */ 307 + amdgpu_crtc->last_flip_vblank = drm_crtc_accurate_vblank_count(&amdgpu_crtc->base); 306 308 307 309 /* wake up userspace */ 308 310 if (amdgpu_crtc->event) { 309 - /* Update to correct count(s) if racing with vblank irq */ 310 - drm_crtc_accurate_vblank_count(&amdgpu_crtc->base); 311 - 312 311 drm_crtc_send_vblank_event(&amdgpu_crtc->base, amdgpu_crtc->event); 313 312 314 313 /* page flip completed. clean up */ ··· 4827 4828 to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc)); 4828 4829 int planes_count = 0; 4829 4830 unsigned long flags; 4831 + u64 last_flip_vblank; 4832 + bool vrr_active = acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE; 4830 4833 4831 4834 /* update planes when needed */ 4832 4835 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { ··· 4860 4859 /* In commit tail framework this cannot happen */ 4861 4860 WARN_ON(1); 4862 4861 } 4862 + 4863 + /* For variable refresh rate mode only: 4864 + * Get vblank of last completed flip to avoid > 1 vrr flips per 4865 + * video frame by use of throttling, but allow flip programming 4866 + * anywhere in the possibly large variable vrr vblank interval 4867 + * for fine-grained flip timing control and more opportunity to 4868 + * avoid stutter on late submission of amdgpu_dm_do_flip() calls. 4869 + */ 4870 + last_flip_vblank = acrtc_attach->last_flip_vblank; 4871 + 4863 4872 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 4864 4873 4865 4874 if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) { ··· 4893 4882 if (plane->type == DRM_PLANE_TYPE_PRIMARY) 4894 4883 drm_crtc_vblank_get(crtc); 4895 4884 4885 + /* Use old throttling in non-vrr fixed refresh rate mode 4886 + * to keep flip scheduling based on target vblank counts 4887 + * working in a backwards compatible way, e.g., clients 4888 + * using GLX_OML_sync_control extension. 4889 + */ 4890 + if (!vrr_active) 4891 + last_flip_vblank = drm_crtc_vblank_count(crtc); 4892 + 4896 4893 amdgpu_dm_do_flip( 4897 4894 crtc, 4898 4895 fb, 4899 - (uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank, 4896 + (uint32_t) last_flip_vblank + *wait_for_vblank, 4900 4897 dc_state); 4901 4898 } 4902 4899
+4
drivers/gpu/drm/bochs/bochs_drv.c
··· 154 154 if (IS_ERR(dev)) 155 155 return PTR_ERR(dev); 156 156 157 + ret = pci_enable_device(pdev); 158 + if (ret) 159 + goto err_free_dev; 160 + 157 161 dev->pdev = pdev; 158 162 pci_set_drvdata(pdev, dev); 159 163
+9
drivers/gpu/drm/drm_atomic_helper.c
··· 1602 1602 old_plane_state->crtc != new_plane_state->crtc) 1603 1603 return -EINVAL; 1604 1604 1605 + /* 1606 + * FIXME: Since prepare_fb and cleanup_fb are always called on 1607 + * the new_plane_state for async updates we need to block framebuffer 1608 + * changes. This prevents use of a fb that's been cleaned up and 1609 + * double cleanups from occuring. 1610 + */ 1611 + if (old_plane_state->fb != new_plane_state->fb) 1612 + return -EINVAL; 1613 + 1605 1614 funcs = plane->helper_private; 1606 1615 if (!funcs->atomic_async_update) 1607 1616 return -EINVAL;
+1 -1
drivers/iommu/dmar.c
··· 144 144 for (tmp = dev; tmp; tmp = tmp->bus->self) 145 145 level++; 146 146 147 - size = sizeof(*info) + level * sizeof(struct acpi_dmar_pci_path); 147 + size = sizeof(*info) + level * sizeof(info->path[0]); 148 148 if (size <= sizeof(dmar_pci_notify_info_buf)) { 149 149 info = (struct dmar_pci_notify_info *)dmar_pci_notify_info_buf; 150 150 } else {
-6
drivers/mmc/core/block.c
··· 2380 2380 snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), 2381 2381 "mmcblk%u%s", card->host->index, subname ? subname : ""); 2382 2382 2383 - if (mmc_card_mmc(card)) 2384 - blk_queue_logical_block_size(md->queue.queue, 2385 - card->ext_csd.data_sector_size); 2386 - else 2387 - blk_queue_logical_block_size(md->queue.queue, 512); 2388 - 2389 2383 set_capacity(md->disk, size); 2390 2384 2391 2385 if (mmc_host_cmd23(card->host)) {
+1 -1
drivers/mmc/core/core.c
··· 95 95 if (!data) 96 96 return; 97 97 98 - if (cmd->error || data->error || 98 + if ((cmd && cmd->error) || data->error || 99 99 !should_fail(&host->fail_mmc_request, data->blksz * data->blocks)) 100 100 return; 101 101
+8 -1
drivers/mmc/core/queue.c
··· 355 355 { 356 356 struct mmc_host *host = card->host; 357 357 u64 limit = BLK_BOUNCE_HIGH; 358 + unsigned block_size = 512; 358 359 359 360 if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) 360 361 limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT; ··· 369 368 blk_queue_max_hw_sectors(mq->queue, 370 369 min(host->max_blk_count, host->max_req_size / 512)); 371 370 blk_queue_max_segments(mq->queue, host->max_segs); 372 - blk_queue_max_segment_size(mq->queue, host->max_seg_size); 371 + 372 + if (mmc_card_mmc(card)) 373 + block_size = card->ext_csd.data_sector_size; 374 + 375 + blk_queue_logical_block_size(mq->queue, block_size); 376 + blk_queue_max_segment_size(mq->queue, 377 + round_down(host->max_seg_size, block_size)); 373 378 374 379 INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler); 375 380 INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work);
+11 -2
drivers/mmc/host/cqhci.c
··· 201 201 cq_host->desc_size = cq_host->slot_sz * cq_host->num_slots; 202 202 203 203 cq_host->data_size = cq_host->trans_desc_len * cq_host->mmc->max_segs * 204 - (cq_host->num_slots - 1); 204 + cq_host->mmc->cqe_qdepth; 205 205 206 206 pr_debug("%s: cqhci: desc_size: %zu data_sz: %zu slot-sz: %d\n", 207 207 mmc_hostname(cq_host->mmc), cq_host->desc_size, cq_host->data_size, ··· 217 217 cq_host->desc_size, 218 218 &cq_host->desc_dma_base, 219 219 GFP_KERNEL); 220 + if (!cq_host->desc_base) 221 + return -ENOMEM; 222 + 220 223 cq_host->trans_desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc), 221 224 cq_host->data_size, 222 225 &cq_host->trans_desc_dma_base, 223 226 GFP_KERNEL); 224 - if (!cq_host->desc_base || !cq_host->trans_desc_base) 227 + if (!cq_host->trans_desc_base) { 228 + dmam_free_coherent(mmc_dev(cq_host->mmc), cq_host->desc_size, 229 + cq_host->desc_base, 230 + cq_host->desc_dma_base); 231 + cq_host->desc_base = NULL; 232 + cq_host->desc_dma_base = 0; 225 233 return -ENOMEM; 234 + } 226 235 227 236 pr_debug("%s: cqhci: desc-base: 0x%p trans-base: 0x%p\n desc_dma 0x%llx trans_dma: 0x%llx\n", 228 237 mmc_hostname(cq_host->mmc), cq_host->desc_base, cq_host->trans_desc_base,
+1
drivers/mmc/host/mmc_spi.c
··· 1450 1450 mmc->caps &= ~MMC_CAP_NEEDS_POLL; 1451 1451 mmc_gpiod_request_cd_irq(mmc); 1452 1452 } 1453 + mmc_detect_change(mmc, 0); 1453 1454 1454 1455 /* Index 1 is write protect/read only */ 1455 1456 status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL);
+1
drivers/mmc/host/renesas_sdhi_sys_dmac.c
··· 65 65 .scc_offset = 0x0300, 66 66 .taps = rcar_gen2_scc_taps, 67 67 .taps_num = ARRAY_SIZE(rcar_gen2_scc_taps), 68 + .max_blk_count = 0xffffffff, 68 69 }; 69 70 70 71 /* Definitions for sampling clocks */
+5 -4
drivers/mmc/host/sdhci-esdhc-imx.c
··· 1095 1095 writel(readl(host->ioaddr + SDHCI_HOST_CONTROL) 1096 1096 | ESDHC_BURST_LEN_EN_INCR, 1097 1097 host->ioaddr + SDHCI_HOST_CONTROL); 1098 + 1098 1099 /* 1099 - * erratum ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL 1100 - * TO1.1, it's harmless for MX6SL 1101 - */ 1102 - writel(readl(host->ioaddr + 0x6c) | BIT(7), 1100 + * erratum ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL 1101 + * TO1.1, it's harmless for MX6SL 1102 + */ 1103 + writel(readl(host->ioaddr + 0x6c) & ~BIT(7), 1103 1104 host->ioaddr + 0x6c); 1104 1105 1105 1106 /* disable DLL_CTRL delay line settings */
+5
drivers/mmc/host/tmio_mmc.h
··· 277 277 iowrite16(val >> 16, host->ctl + ((addr + 2) << host->bus_shift)); 278 278 } 279 279 280 + static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val) 281 + { 282 + iowrite32(val, host->ctl + (addr << host->bus_shift)); 283 + } 284 + 280 285 static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr, 281 286 const u32 *buf, int count) 282 287 {
+12 -5
drivers/mmc/host/tmio_mmc_core.c
··· 43 43 #include <linux/regulator/consumer.h> 44 44 #include <linux/mmc/sdio.h> 45 45 #include <linux/scatterlist.h> 46 + #include <linux/sizes.h> 46 47 #include <linux/spinlock.h> 47 48 #include <linux/swiotlb.h> 48 49 #include <linux/workqueue.h> ··· 630 629 return false; 631 630 } 632 631 633 - static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host) 632 + static bool __tmio_mmc_sdio_irq(struct tmio_mmc_host *host) 634 633 { 635 634 struct mmc_host *mmc = host->mmc; 636 635 struct tmio_mmc_data *pdata = host->pdata; ··· 638 637 unsigned int sdio_status; 639 638 640 639 if (!(pdata->flags & TMIO_MMC_SDIO_IRQ)) 641 - return; 640 + return false; 642 641 643 642 status = sd_ctrl_read16(host, CTL_SDIO_STATUS); 644 643 ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdio_irq_mask; ··· 651 650 652 651 if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ) 653 652 mmc_signal_sdio_irq(mmc); 653 + 654 + return ireg; 654 655 } 655 656 656 657 irqreturn_t tmio_mmc_irq(int irq, void *devid) ··· 671 668 if (__tmio_mmc_sdcard_irq(host, ireg, status)) 672 669 return IRQ_HANDLED; 673 670 674 - __tmio_mmc_sdio_irq(host); 671 + if (__tmio_mmc_sdio_irq(host)) 672 + return IRQ_HANDLED; 675 673 676 - return IRQ_HANDLED; 674 + return IRQ_NONE; 677 675 } 678 676 EXPORT_SYMBOL_GPL(tmio_mmc_irq); 679 677 ··· 704 700 705 701 /* Set transfer length / blocksize */ 706 702 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); 707 - sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks); 703 + if (host->mmc->max_blk_count >= SZ_64K) 704 + sd_ctrl_write32(host, CTL_XFER_BLK_COUNT, data->blocks); 705 + else 706 + sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks); 708 707 709 708 tmio_mmc_start_dma(host, data); 710 709
+6 -6
drivers/net/dsa/mv88e6xxx/chip.c
··· 4247 4247 .name = "Marvell 88E6190", 4248 4248 .num_databases = 4096, 4249 4249 .num_ports = 11, /* 10 + Z80 */ 4250 - .num_internal_phys = 11, 4250 + .num_internal_phys = 9, 4251 4251 .num_gpio = 16, 4252 4252 .max_vid = 8191, 4253 4253 .port_base_addr = 0x0, ··· 4270 4270 .name = "Marvell 88E6190X", 4271 4271 .num_databases = 4096, 4272 4272 .num_ports = 11, /* 10 + Z80 */ 4273 - .num_internal_phys = 11, 4273 + .num_internal_phys = 9, 4274 4274 .num_gpio = 16, 4275 4275 .max_vid = 8191, 4276 4276 .port_base_addr = 0x0, ··· 4293 4293 .name = "Marvell 88E6191", 4294 4294 .num_databases = 4096, 4295 4295 .num_ports = 11, /* 10 + Z80 */ 4296 - .num_internal_phys = 11, 4296 + .num_internal_phys = 9, 4297 4297 .max_vid = 8191, 4298 4298 .port_base_addr = 0x0, 4299 4299 .phy_base_addr = 0x0, ··· 4340 4340 .name = "Marvell 88E6290", 4341 4341 .num_databases = 4096, 4342 4342 .num_ports = 11, /* 10 + Z80 */ 4343 - .num_internal_phys = 11, 4343 + .num_internal_phys = 9, 4344 4344 .num_gpio = 16, 4345 4345 .max_vid = 8191, 4346 4346 .port_base_addr = 0x0, ··· 4502 4502 .name = "Marvell 88E6390", 4503 4503 .num_databases = 4096, 4504 4504 .num_ports = 11, /* 10 + Z80 */ 4505 - .num_internal_phys = 11, 4505 + .num_internal_phys = 9, 4506 4506 .num_gpio = 16, 4507 4507 .max_vid = 8191, 4508 4508 .port_base_addr = 0x0, ··· 4525 4525 .name = "Marvell 88E6390X", 4526 4526 .num_databases = 4096, 4527 4527 .num_ports = 11, /* 10 + Z80 */ 4528 - .num_internal_phys = 11, 4528 + .num_internal_phys = 9, 4529 4529 .num_gpio = 16, 4530 4530 .max_vid = 8191, 4531 4531 .port_base_addr = 0x0,
+1 -1
drivers/net/dsa/mv88e6xxx/port.c
··· 190 190 /* normal duplex detection */ 191 191 break; 192 192 default: 193 - return -EINVAL; 193 + return -EOPNOTSUPP; 194 194 } 195 195 196 196 err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg);
+11 -3
drivers/net/ethernet/mscc/ocelot_board.c
··· 267 267 struct phy *serdes; 268 268 void __iomem *regs; 269 269 char res_name[8]; 270 + int phy_mode; 270 271 u32 port; 271 272 272 273 if (of_property_read_u32(portnp, "reg", &port)) ··· 293 292 if (err) 294 293 return err; 295 294 296 - err = of_get_phy_mode(portnp); 297 - if (err < 0) 295 + phy_mode = of_get_phy_mode(portnp); 296 + if (phy_mode < 0) 298 297 ocelot->ports[port]->phy_mode = PHY_INTERFACE_MODE_NA; 299 298 else 300 - ocelot->ports[port]->phy_mode = err; 299 + ocelot->ports[port]->phy_mode = phy_mode; 301 300 302 301 switch (ocelot->ports[port]->phy_mode) { 303 302 case PHY_INTERFACE_MODE_NA: ··· 305 304 case PHY_INTERFACE_MODE_SGMII: 306 305 break; 307 306 case PHY_INTERFACE_MODE_QSGMII: 307 + /* Ensure clock signals and speed is set on all 308 + * QSGMII links 309 + */ 310 + ocelot_port_writel(ocelot->ports[port], 311 + DEV_CLOCK_CFG_LINK_SPEED 312 + (OCELOT_SPEED_1000), 313 + DEV_CLOCK_CFG); 308 314 break; 309 315 default: 310 316 dev_err(ocelot->dev,
+18 -8
drivers/net/usb/qmi_wwan.c
··· 976 976 0xff), 977 977 .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, 978 978 }, 979 + { /* Quectel EG12/EM12 */ 980 + USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512, 981 + USB_CLASS_VENDOR_SPEC, 982 + USB_SUBCLASS_VENDOR_SPEC, 983 + 0xff), 984 + .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, 985 + }, 979 986 980 987 /* 3. Combined interface devices matching on interface number */ 981 988 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ ··· 1350 1343 return false; 1351 1344 } 1352 1345 1353 - static bool quectel_ep06_diag_detected(struct usb_interface *intf) 1346 + static bool quectel_diag_detected(struct usb_interface *intf) 1354 1347 { 1355 1348 struct usb_device *dev = interface_to_usbdev(intf); 1356 1349 struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc; 1350 + u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor); 1351 + u16 id_product = le16_to_cpu(dev->descriptor.idProduct); 1357 1352 1358 - if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c && 1359 - le16_to_cpu(dev->descriptor.idProduct) == 0x0306 && 1360 - intf_desc.bNumEndpoints == 2) 1353 + if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2) 1354 + return false; 1355 + 1356 + if (id_product == 0x0306 || id_product == 0x0512) 1361 1357 return true; 1362 - 1363 - return false; 1358 + else 1359 + return false; 1364 1360 } 1365 1361 1366 1362 static int qmi_wwan_probe(struct usb_interface *intf, ··· 1400 1390 return -ENODEV; 1401 1391 } 1402 1392 1403 - /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so 1393 + /* Several Quectel modems supports dynamic interface configuration, so 1404 1394 * we need to match on class/subclass/protocol. These values are 1405 1395 * identical for the diagnostic- and QMI-interface, but bNumEndpoints is 1406 1396 * different. Ignore the current interface if the number of endpoints 1407 1397 * the number for the diag interface (two). 1408 1398 */ 1409 - if (quectel_ep06_diag_detected(intf)) 1399 + if (quectel_diag_detected(intf)) 1410 1400 return -ENODEV; 1411 1401 1412 1402 return usbnet_probe(intf, id);
+9 -5
drivers/scsi/3w-9xxx.c
··· 2009 2009 struct Scsi_Host *host = NULL; 2010 2010 TW_Device_Extension *tw_dev; 2011 2011 unsigned long mem_addr, mem_len; 2012 - int retval = -ENODEV; 2012 + int retval; 2013 2013 2014 2014 retval = pci_enable_device(pdev); 2015 2015 if (retval) { ··· 2020 2020 pci_set_master(pdev); 2021 2021 pci_try_set_mwi(pdev); 2022 2022 2023 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2024 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2023 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2024 + if (retval) 2025 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2026 + if (retval) { 2025 2027 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); 2026 2028 retval = -ENODEV; 2027 2029 goto out_disable_device; ··· 2242 2240 pci_set_master(pdev); 2243 2241 pci_try_set_mwi(pdev); 2244 2242 2245 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2246 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2243 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2244 + if (retval) 2245 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2246 + if (retval) { 2247 2247 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); 2248 2248 retval = -ENODEV; 2249 2249 goto out_disable_device;
+8 -4
drivers/scsi/3w-sas.c
··· 1573 1573 pci_set_master(pdev); 1574 1574 pci_try_set_mwi(pdev); 1575 1575 1576 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1577 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1576 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 1577 + if (retval) 1578 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1579 + if (retval) { 1578 1580 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); 1579 1581 retval = -ENODEV; 1580 1582 goto out_disable_device; ··· 1807 1805 pci_set_master(pdev); 1808 1806 pci_try_set_mwi(pdev); 1809 1807 1810 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 1811 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 1808 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 1809 + if (retval) 1810 + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 1811 + if (retval) { 1812 1812 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); 1813 1813 retval = -ENODEV; 1814 1814 goto out_disable_device;
+5 -3
drivers/scsi/aic94xx/aic94xx_init.c
··· 769 769 if (err) 770 770 goto Err_remove; 771 771 772 - err = -ENODEV; 773 - if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) || 774 - dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) { 772 + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)); 773 + if (err) 774 + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); 775 + if (err) { 776 + err = -ENODEV; 775 777 asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); 776 778 goto Err_remove; 777 779 }
+13 -5
drivers/scsi/bfa/bfad.c
··· 727 727 int 728 728 bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) 729 729 { 730 - int rc = -ENODEV; 730 + int rc = -ENODEV; 731 731 732 732 if (pci_enable_device(pdev)) { 733 733 printk(KERN_ERR "pci_enable_device fail %p\n", pdev); ··· 739 739 740 740 pci_set_master(pdev); 741 741 742 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 743 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 742 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 743 + if (rc) 744 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 745 + 746 + if (rc) { 747 + rc = -ENODEV; 744 748 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); 745 749 goto out_release_region; 746 750 } ··· 1538 1534 { 1539 1535 struct bfad_s *bfad = pci_get_drvdata(pdev); 1540 1536 u8 byte; 1537 + int rc; 1541 1538 1542 1539 dev_printk(KERN_ERR, &pdev->dev, 1543 1540 "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); ··· 1566 1561 pci_save_state(pdev); 1567 1562 pci_set_master(pdev); 1568 1563 1569 - if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) || 1570 - dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32))) 1564 + rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)); 1565 + if (rc) 1566 + rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, 1567 + DMA_BIT_MASK(32)); 1568 + if (rc) 1571 1569 goto out_disable_device; 1572 1570 1573 1571 if (restart_bfa(bfad) == -1)
+5 -2
drivers/scsi/csiostor/csio_init.c
··· 210 210 pci_set_master(pdev); 211 211 pci_try_set_mwi(pdev); 212 212 213 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 214 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 213 + rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 214 + if (rv) 215 + rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 216 + if (rv) { 217 + rv = -ENODEV; 215 218 dev_err(&pdev->dev, "No suitable DMA available.\n"); 216 219 goto err_release_regions; 217 220 }
+6 -2
drivers/scsi/hisi_sas/hisi_sas_main.c
··· 2323 2323 struct Scsi_Host *shost; 2324 2324 struct hisi_hba *hisi_hba; 2325 2325 struct device *dev = &pdev->dev; 2326 + int error; 2326 2327 2327 2328 shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba)); 2328 2329 if (!shost) { ··· 2344 2343 if (hisi_sas_get_fw_info(hisi_hba) < 0) 2345 2344 goto err_out; 2346 2345 2347 - if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) && 2348 - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) { 2346 + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); 2347 + if (error) 2348 + error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 2349 + 2350 + if (error) { 2349 2351 dev_err(dev, "No usable DMA addressing method\n"); 2350 2352 goto err_out; 2351 2353 }
+5 -3
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 2447 2447 if (rc) 2448 2448 goto err_out_disable_device; 2449 2449 2450 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 2451 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { 2450 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 2451 + if (rc) 2452 + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2453 + if (rc) { 2452 2454 dev_err(dev, "No usable DMA addressing method\n"); 2453 - rc = -EIO; 2455 + rc = -ENODEV; 2454 2456 goto err_out_regions; 2455 2457 } 2456 2458
+7 -3
drivers/scsi/hptiop.c
··· 1292 1292 dma_addr_t start_phy; 1293 1293 void *start_virt; 1294 1294 u32 offset, i, req_size; 1295 + int rc; 1295 1296 1296 1297 dprintk("hptiop_probe(%p)\n", pcidev); 1297 1298 ··· 1309 1308 1310 1309 /* Enable 64bit DMA if possible */ 1311 1310 iop_ops = (struct hptiop_adapter_ops *)id->driver_data; 1312 - if (dma_set_mask(&pcidev->dev, 1313 - DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) || 1314 - dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) { 1311 + rc = dma_set_mask(&pcidev->dev, 1312 + DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)); 1313 + if (rc) 1314 + rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32)); 1315 + 1316 + if (rc) { 1315 1317 printk(KERN_ERR "hptiop: fail to set dma_mask\n"); 1316 1318 goto disable_pci_device; 1317 1319 }
+12 -7
drivers/scsi/lpfc/lpfc_init.c
··· 7361 7361 unsigned long bar0map_len, bar2map_len; 7362 7362 int i, hbq_count; 7363 7363 void *ptr; 7364 - int error = -ENODEV; 7364 + int error; 7365 7365 7366 7366 if (!pdev) 7367 - return error; 7367 + return -ENODEV; 7368 7368 7369 7369 /* Set the device DMA mask size */ 7370 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 7371 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 7370 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 7371 + if (error) 7372 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 7373 + if (error) 7372 7374 return error; 7375 + error = -ENODEV; 7373 7376 7374 7377 /* Get the bus address of Bar0 and Bar2 and the number of bytes 7375 7378 * required by each mapping. ··· 9745 9742 uint32_t if_type; 9746 9743 9747 9744 if (!pdev) 9748 - return error; 9745 + return -ENODEV; 9749 9746 9750 9747 /* Set the device DMA mask size */ 9751 - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || 9752 - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) 9748 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 9749 + if (error) 9750 + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 9751 + if (error) 9753 9752 return error; 9754 9753 9755 9754 /*
-1
drivers/scsi/scsi_lib.c
··· 2598 2598 * device deleted during suspend) 2599 2599 */ 2600 2600 mutex_lock(&sdev->state_mutex); 2601 - WARN_ON_ONCE(!sdev->quiesced_by); 2602 2601 sdev->quiesced_by = NULL; 2603 2602 blk_clear_pm_only(sdev->request_queue); 2604 2603 if (sdev->sdev_state == SDEV_QUIESCE)
+1
fs/afs/cell.c
··· 173 173 174 174 rcu_assign_pointer(cell->vl_servers, vllist); 175 175 cell->dns_expiry = TIME64_MAX; 176 + __clear_bit(AFS_CELL_FL_NO_LOOKUP_YET, &cell->flags); 176 177 } else { 177 178 cell->dns_expiry = ktime_get_real_seconds(); 178 179 }
+12
fs/hugetlbfs/inode.c
··· 859 859 rc = migrate_huge_page_move_mapping(mapping, newpage, page); 860 860 if (rc != MIGRATEPAGE_SUCCESS) 861 861 return rc; 862 + 863 + /* 864 + * page_private is subpool pointer in hugetlb pages. Transfer to 865 + * new page. PagePrivate is not associated with page_private for 866 + * hugetlb pages and can not be set here as only page_huge_active 867 + * pages can be migrated. 868 + */ 869 + if (page_private(page)) { 870 + set_page_private(newpage, page_private(page)); 871 + set_page_private(page, 0); 872 + } 873 + 862 874 if (mode != MIGRATE_SYNC_NO_COPY) 863 875 migrate_page_copy(newpage, page); 864 876 else
-2
fs/namespace.c
··· 2698 2698 if (!access_ok(from, n)) 2699 2699 return n; 2700 2700 2701 - current->kernel_uaccess_faults_ok++; 2702 2701 while (n) { 2703 2702 if (__get_user(c, f)) { 2704 2703 memset(t, 0, n); ··· 2707 2708 f++; 2708 2709 n--; 2709 2710 } 2710 - current->kernel_uaccess_faults_ok--; 2711 2711 return n; 2712 2712 } 2713 2713
-4
fs/orangefs/file.c
··· 398 398 loff_t pos = iocb->ki_pos; 399 399 ssize_t rc = 0; 400 400 401 - BUG_ON(iocb->private); 402 - 403 401 gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_read_iter\n"); 404 402 405 403 orangefs_stats.reads++; ··· 413 415 struct file *file = iocb->ki_filp; 414 416 loff_t pos; 415 417 ssize_t rc; 416 - 417 - BUG_ON(iocb->private); 418 418 419 419 gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_write_iter\n"); 420 420
+1 -1
include/linux/atalk.h
··· 158 158 extern int sysctl_aarp_resolve_time; 159 159 160 160 #ifdef CONFIG_SYSCTL 161 - extern void atalk_register_sysctl(void); 161 + extern int atalk_register_sysctl(void); 162 162 extern void atalk_unregister_sysctl(void); 163 163 #else 164 164 #define atalk_register_sysctl() do { } while(0)
-6
include/linux/sched.h
··· 739 739 unsigned use_memdelay:1; 740 740 #endif 741 741 742 - /* 743 - * May usercopy functions fault on kernel addresses? 744 - * This is not just a single bit because this can potentially nest. 745 - */ 746 - unsigned int kernel_uaccess_faults_ok; 747 - 748 742 unsigned long atomic_flags; /* Flags requiring atomic access. */ 749 743 750 744 struct restart_block restart_block;
+13 -18
include/net/sch_generic.h
··· 52 52 struct qdisc_skb_head { 53 53 struct sk_buff *head; 54 54 struct sk_buff *tail; 55 - __u32 qlen; 55 + union { 56 + u32 qlen; 57 + atomic_t atomic_qlen; 58 + }; 56 59 spinlock_t lock; 57 60 }; 58 61 ··· 469 466 BUILD_BUG_ON(sizeof(qcb->data) < sz); 470 467 } 471 468 472 - static inline int qdisc_qlen_cpu(const struct Qdisc *q) 473 - { 474 - return this_cpu_ptr(q->cpu_qstats)->qlen; 475 - } 476 - 477 469 static inline int qdisc_qlen(const struct Qdisc *q) 478 470 { 479 471 return q->q.qlen; 480 472 } 481 473 482 - static inline int qdisc_qlen_sum(const struct Qdisc *q) 474 + static inline u32 qdisc_qlen_sum(const struct Qdisc *q) 483 475 { 484 - __u32 qlen = q->qstats.qlen; 485 - int i; 476 + u32 qlen = q->qstats.qlen; 486 477 487 - if (q->flags & TCQ_F_NOLOCK) { 488 - for_each_possible_cpu(i) 489 - qlen += per_cpu_ptr(q->cpu_qstats, i)->qlen; 490 - } else { 478 + if (q->flags & TCQ_F_NOLOCK) 479 + qlen += atomic_read(&q->q.atomic_qlen); 480 + else 491 481 qlen += q->q.qlen; 492 - } 493 482 494 483 return qlen; 495 484 } ··· 877 882 this_cpu_add(sch->cpu_qstats->backlog, qdisc_pkt_len(skb)); 878 883 } 879 884 880 - static inline void qdisc_qstats_cpu_qlen_inc(struct Qdisc *sch) 885 + static inline void qdisc_qstats_atomic_qlen_inc(struct Qdisc *sch) 881 886 { 882 - this_cpu_inc(sch->cpu_qstats->qlen); 887 + atomic_inc(&sch->q.atomic_qlen); 883 888 } 884 889 885 - static inline void qdisc_qstats_cpu_qlen_dec(struct Qdisc *sch) 890 + static inline void qdisc_qstats_atomic_qlen_dec(struct Qdisc *sch) 886 891 { 887 - this_cpu_dec(sch->cpu_qstats->qlen); 892 + atomic_dec(&sch->q.atomic_qlen); 888 893 } 889 894 890 895 static inline void qdisc_qstats_cpu_requeues_inc(struct Qdisc *sch)
+22
lib/Kconfig.kasan
··· 113 113 114 114 endchoice 115 115 116 + config KASAN_STACK_ENABLE 117 + bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST 118 + default !(CLANG_VERSION < 90000) 119 + depends on KASAN 120 + help 121 + The LLVM stack address sanitizer has a know problem that 122 + causes excessive stack usage in a lot of functions, see 123 + https://bugs.llvm.org/show_bug.cgi?id=38809 124 + Disabling asan-stack makes it safe to run kernels build 125 + with clang-8 with KASAN enabled, though it loses some of 126 + the functionality. 127 + This feature is always disabled when compile-testing with clang-8 128 + or earlier to avoid cluttering the output in stack overflow 129 + warnings, but clang-8 users can still enable it for builds without 130 + CONFIG_COMPILE_TEST. On gcc and later clang versions it is 131 + assumed to always be safe to use and enabled by default. 132 + 133 + config KASAN_STACK 134 + int 135 + default 1 if KASAN_STACK_ENABLE || CC_IS_GCC 136 + default 0 137 + 116 138 config KASAN_S390_4_LEVEL_PAGING 117 139 bool "KASan: use 4-level paging" 118 140 depends on KASAN && S390
+13 -3
mm/hugetlb.c
··· 3624 3624 copy_user_huge_page(new_page, old_page, address, vma, 3625 3625 pages_per_huge_page(h)); 3626 3626 __SetPageUptodate(new_page); 3627 - set_page_huge_active(new_page); 3628 3627 3629 3628 mmu_notifier_range_init(&range, mm, haddr, haddr + huge_page_size(h)); 3630 3629 mmu_notifier_invalidate_range_start(&range); ··· 3644 3645 make_huge_pte(vma, new_page, 1)); 3645 3646 page_remove_rmap(old_page, true); 3646 3647 hugepage_add_new_anon_rmap(new_page, vma, haddr); 3648 + set_page_huge_active(new_page); 3647 3649 /* Make the old page be freed below */ 3648 3650 new_page = old_page; 3649 3651 } ··· 3729 3729 pte_t new_pte; 3730 3730 spinlock_t *ptl; 3731 3731 unsigned long haddr = address & huge_page_mask(h); 3732 + bool new_page = false; 3732 3733 3733 3734 /* 3734 3735 * Currently, we are forced to kill the process in the event the ··· 3791 3790 } 3792 3791 clear_huge_page(page, address, pages_per_huge_page(h)); 3793 3792 __SetPageUptodate(page); 3794 - set_page_huge_active(page); 3793 + new_page = true; 3795 3794 3796 3795 if (vma->vm_flags & VM_MAYSHARE) { 3797 3796 int err = huge_add_to_page_cache(page, mapping, idx); ··· 3862 3861 } 3863 3862 3864 3863 spin_unlock(ptl); 3864 + 3865 + /* 3866 + * Only make newly allocated pages active. Existing pages found 3867 + * in the pagecache could be !page_huge_active() if they have been 3868 + * isolated for migration. 3869 + */ 3870 + if (new_page) 3871 + set_page_huge_active(page); 3872 + 3865 3873 unlock_page(page); 3866 3874 out: 3867 3875 return ret; ··· 4105 4095 * the set_pte_at() write. 4106 4096 */ 4107 4097 __SetPageUptodate(page); 4108 - set_page_huge_active(page); 4109 4098 4110 4099 mapping = dst_vma->vm_file->f_mapping; 4111 4100 idx = vma_hugecache_offset(h, dst_vma, dst_addr); ··· 4172 4163 update_mmu_cache(dst_vma, dst_addr, dst_pte); 4173 4164 4174 4165 spin_unlock(ptl); 4166 + set_page_huge_active(page); 4175 4167 if (vm_shared) 4176 4168 unlock_page(page); 4177 4169 ret = 0;
-6
mm/maccess.c
··· 30 30 31 31 set_fs(KERNEL_DS); 32 32 pagefault_disable(); 33 - current->kernel_uaccess_faults_ok++; 34 33 ret = __copy_from_user_inatomic(dst, 35 34 (__force const void __user *)src, size); 36 - current->kernel_uaccess_faults_ok--; 37 35 pagefault_enable(); 38 36 set_fs(old_fs); 39 37 ··· 58 60 59 61 set_fs(KERNEL_DS); 60 62 pagefault_disable(); 61 - current->kernel_uaccess_faults_ok++; 62 63 ret = __copy_to_user_inatomic((__force void __user *)dst, src, size); 63 - current->kernel_uaccess_faults_ok--; 64 64 pagefault_enable(); 65 65 set_fs(old_fs); 66 66 ··· 94 98 95 99 set_fs(KERNEL_DS); 96 100 pagefault_disable(); 97 - current->kernel_uaccess_faults_ok++; 98 101 99 102 do { 100 103 ret = __get_user(*dst++, (const char __user __force *)src++); 101 104 } while (dst[-1] && ret == 0 && src - unsafe_addr < count); 102 105 103 - current->kernel_uaccess_faults_ok--; 104 106 dst[-1] = '\0'; 105 107 pagefault_enable(); 106 108 set_fs(old_fs);
+11
mm/migrate.c
··· 1315 1315 lock_page(hpage); 1316 1316 } 1317 1317 1318 + /* 1319 + * Check for pages which are in the process of being freed. Without 1320 + * page_mapping() set, hugetlbfs specific move page routine will not 1321 + * be called and we could leak usage counts for subpools. 1322 + */ 1323 + if (page_private(hpage) && !page_mapping(hpage)) { 1324 + rc = -EBUSY; 1325 + goto out_unlock; 1326 + } 1327 + 1318 1328 if (PageAnon(hpage)) 1319 1329 anon_vma = page_get_anon_vma(hpage); 1320 1330 ··· 1355 1345 put_new_page = NULL; 1356 1346 } 1357 1347 1348 + out_unlock: 1358 1349 unlock_page(hpage); 1359 1350 out: 1360 1351 if (rc != -EAGAIN)
+3 -4
mm/mmap.c
··· 2426 2426 { 2427 2427 struct mm_struct *mm = vma->vm_mm; 2428 2428 struct vm_area_struct *prev; 2429 - int error; 2429 + int error = 0; 2430 2430 2431 2431 address &= PAGE_MASK; 2432 - error = security_mmap_addr(address); 2433 - if (error) 2434 - return error; 2432 + if (address < mmap_min_addr) 2433 + return -EPERM; 2435 2434 2436 2435 /* Enforce stack_guard_gap */ 2437 2436 prev = vma->vm_prev;
+1 -1
mm/shmem.c
··· 2848 2848 static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 2849 2849 { 2850 2850 struct inode *inode = d_inode(old_dentry); 2851 - int ret; 2851 + int ret = 0; 2852 2852 2853 2853 /* 2854 2854 * No ordinary (disk based) filesystem counts links as inodes;
+18 -40
net/appletalk/atalk_proc.c
··· 210 210 .show = atalk_seq_socket_show, 211 211 }; 212 212 213 - static struct proc_dir_entry *atalk_proc_dir; 214 - 215 213 int __init atalk_proc_init(void) 216 214 { 217 - struct proc_dir_entry *p; 218 - int rc = -ENOMEM; 215 + if (!proc_mkdir("atalk", init_net.proc_net)) 216 + return -ENOMEM; 219 217 220 - atalk_proc_dir = proc_mkdir("atalk", init_net.proc_net); 221 - if (!atalk_proc_dir) 218 + if (!proc_create_seq("atalk/interface", 0444, init_net.proc_net, 219 + &atalk_seq_interface_ops)) 222 220 goto out; 223 221 224 - p = proc_create_seq("interface", 0444, atalk_proc_dir, 225 - &atalk_seq_interface_ops); 226 - if (!p) 227 - goto out_interface; 222 + if (!proc_create_seq("atalk/route", 0444, init_net.proc_net, 223 + &atalk_seq_route_ops)) 224 + goto out; 228 225 229 - p = proc_create_seq("route", 0444, atalk_proc_dir, 230 - &atalk_seq_route_ops); 231 - if (!p) 232 - goto out_route; 226 + if (!proc_create_seq("atalk/socket", 0444, init_net.proc_net, 227 + &atalk_seq_socket_ops)) 228 + goto out; 233 229 234 - p = proc_create_seq("socket", 0444, atalk_proc_dir, 235 - &atalk_seq_socket_ops); 236 - if (!p) 237 - goto out_socket; 230 + if (!proc_create_seq_private("atalk/arp", 0444, init_net.proc_net, 231 + &aarp_seq_ops, 232 + sizeof(struct aarp_iter_state), NULL)) 233 + goto out; 238 234 239 - p = proc_create_seq_private("arp", 0444, atalk_proc_dir, &aarp_seq_ops, 240 - sizeof(struct aarp_iter_state), NULL); 241 - if (!p) 242 - goto out_arp; 243 - 244 - rc = 0; 245 235 out: 246 - return rc; 247 - out_arp: 248 - remove_proc_entry("socket", atalk_proc_dir); 249 - out_socket: 250 - remove_proc_entry("route", atalk_proc_dir); 251 - out_route: 252 - remove_proc_entry("interface", atalk_proc_dir); 253 - out_interface: 254 - remove_proc_entry("atalk", init_net.proc_net); 255 - goto out; 236 + remove_proc_subtree("atalk", init_net.proc_net); 237 + return -ENOMEM; 256 238 } 257 239 258 - void __exit atalk_proc_exit(void) 240 + void atalk_proc_exit(void) 259 241 { 260 - remove_proc_entry("interface", atalk_proc_dir); 261 - remove_proc_entry("route", atalk_proc_dir); 262 - remove_proc_entry("socket", atalk_proc_dir); 263 - remove_proc_entry("arp", atalk_proc_dir); 264 - remove_proc_entry("atalk", init_net.proc_net); 242 + remove_proc_subtree("atalk", init_net.proc_net); 265 243 }
+31 -6
net/appletalk/ddp.c
··· 1910 1910 /* Called by proto.c on kernel start up */ 1911 1911 static int __init atalk_init(void) 1912 1912 { 1913 - int rc = proto_register(&ddp_proto, 0); 1913 + int rc; 1914 1914 1915 - if (rc != 0) 1915 + rc = proto_register(&ddp_proto, 0); 1916 + if (rc) 1916 1917 goto out; 1917 1918 1918 - (void)sock_register(&atalk_family_ops); 1919 + rc = sock_register(&atalk_family_ops); 1920 + if (rc) 1921 + goto out_proto; 1922 + 1919 1923 ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv); 1920 1924 if (!ddp_dl) 1921 1925 printk(atalk_err_snap); ··· 1927 1923 dev_add_pack(&ltalk_packet_type); 1928 1924 dev_add_pack(&ppptalk_packet_type); 1929 1925 1930 - register_netdevice_notifier(&ddp_notifier); 1926 + rc = register_netdevice_notifier(&ddp_notifier); 1927 + if (rc) 1928 + goto out_sock; 1929 + 1931 1930 aarp_proto_init(); 1932 - atalk_proc_init(); 1933 - atalk_register_sysctl(); 1931 + rc = atalk_proc_init(); 1932 + if (rc) 1933 + goto out_aarp; 1934 + 1935 + rc = atalk_register_sysctl(); 1936 + if (rc) 1937 + goto out_proc; 1934 1938 out: 1935 1939 return rc; 1940 + out_proc: 1941 + atalk_proc_exit(); 1942 + out_aarp: 1943 + aarp_cleanup_module(); 1944 + unregister_netdevice_notifier(&ddp_notifier); 1945 + out_sock: 1946 + dev_remove_pack(&ppptalk_packet_type); 1947 + dev_remove_pack(&ltalk_packet_type); 1948 + unregister_snap_client(ddp_dl); 1949 + sock_unregister(PF_APPLETALK); 1950 + out_proto: 1951 + proto_unregister(&ddp_proto); 1952 + goto out; 1936 1953 } 1937 1954 module_init(atalk_init); 1938 1955
+4 -1
net/appletalk/sysctl_net_atalk.c
··· 45 45 46 46 static struct ctl_table_header *atalk_table_header; 47 47 48 - void atalk_register_sysctl(void) 48 + int __init atalk_register_sysctl(void) 49 49 { 50 50 atalk_table_header = register_net_sysctl(&init_net, "net/appletalk", atalk_table); 51 + if (!atalk_table_header) 52 + return -ENOMEM; 53 + return 0; 51 54 } 52 55 53 56 void atalk_unregister_sysctl(void)
-2
net/core/gen_stats.c
··· 291 291 for_each_possible_cpu(i) { 292 292 const struct gnet_stats_queue *qcpu = per_cpu_ptr(q, i); 293 293 294 - qstats->qlen = 0; 295 294 qstats->backlog += qcpu->backlog; 296 295 qstats->drops += qcpu->drops; 297 296 qstats->requeues += qcpu->requeues; ··· 306 307 if (cpu) { 307 308 __gnet_stats_copy_queue_cpu(qstats, cpu); 308 309 } else { 309 - qstats->qlen = q->qlen; 310 310 qstats->backlog = q->backlog; 311 311 qstats->drops = q->drops; 312 312 qstats->requeues = q->requeues;
+3
net/core/net-sysfs.c
··· 1539 1539 error: 1540 1540 netdev_queue_update_kobjects(dev, txq, 0); 1541 1541 net_rx_queue_update_kobjects(dev, rxq, 0); 1542 + #ifdef CONFIG_SYSFS 1543 + kset_unregister(dev->queues_kset); 1544 + #endif 1542 1545 return error; 1543 1546 } 1544 1547
+6 -7
net/sched/sch_generic.c
··· 68 68 skb = __skb_dequeue(&q->skb_bad_txq); 69 69 if (qdisc_is_percpu_stats(q)) { 70 70 qdisc_qstats_cpu_backlog_dec(q, skb); 71 - qdisc_qstats_cpu_qlen_dec(q); 71 + qdisc_qstats_atomic_qlen_dec(q); 72 72 } else { 73 73 qdisc_qstats_backlog_dec(q, skb); 74 74 q->q.qlen--; ··· 108 108 109 109 if (qdisc_is_percpu_stats(q)) { 110 110 qdisc_qstats_cpu_backlog_inc(q, skb); 111 - qdisc_qstats_cpu_qlen_inc(q); 111 + qdisc_qstats_atomic_qlen_inc(q); 112 112 } else { 113 113 qdisc_qstats_backlog_inc(q, skb); 114 114 q->q.qlen++; ··· 147 147 148 148 qdisc_qstats_cpu_requeues_inc(q); 149 149 qdisc_qstats_cpu_backlog_inc(q, skb); 150 - qdisc_qstats_cpu_qlen_inc(q); 150 + qdisc_qstats_atomic_qlen_inc(q); 151 151 152 152 skb = next; 153 153 } ··· 252 252 skb = __skb_dequeue(&q->gso_skb); 253 253 if (qdisc_is_percpu_stats(q)) { 254 254 qdisc_qstats_cpu_backlog_dec(q, skb); 255 - qdisc_qstats_cpu_qlen_dec(q); 255 + qdisc_qstats_atomic_qlen_dec(q); 256 256 } else { 257 257 qdisc_qstats_backlog_dec(q, skb); 258 258 q->q.qlen--; ··· 645 645 if (unlikely(err)) 646 646 return qdisc_drop_cpu(skb, qdisc, to_free); 647 647 648 - qdisc_qstats_cpu_qlen_inc(qdisc); 648 + qdisc_qstats_atomic_qlen_inc(qdisc); 649 649 /* Note: skb can not be used after skb_array_produce(), 650 650 * so we better not use qdisc_qstats_cpu_backlog_inc() 651 651 */ ··· 670 670 if (likely(skb)) { 671 671 qdisc_qstats_cpu_backlog_dec(qdisc, skb); 672 672 qdisc_bstats_cpu_update(qdisc, skb); 673 - qdisc_qstats_cpu_qlen_dec(qdisc); 673 + qdisc_qstats_atomic_qlen_dec(qdisc); 674 674 } 675 675 676 676 return skb; ··· 714 714 struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); 715 715 716 716 q->backlog = 0; 717 - q->qlen = 0; 718 717 } 719 718 } 720 719
+1 -1
scripts/Makefile.kasan
··· 26 26 CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ 27 27 $(call cc-param,asan-globals=1) \ 28 28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ 29 - $(call cc-param,asan-stack=1) \ 29 + $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ 30 30 $(call cc-param,asan-use-after-scope=1) \ 31 31 $(call cc-param,asan-instrument-allocas=1) 32 32 endif
+1 -1
virt/kvm/kvm_main.c
··· 4044 4044 } 4045 4045 add_uevent_var(env, "PID=%d", kvm->userspace_pid); 4046 4046 4047 - if (kvm->debugfs_dentry) { 4047 + if (!IS_ERR_OR_NULL(kvm->debugfs_dentry)) { 4048 4048 char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL); 4049 4049 4050 4050 if (p) {