···5454unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old,5555 unsigned long new, unsigned int size)5656{5757- u32 mask, old32, new32, load32;5757+ u32 mask, old32, new32, load32, load;5858 volatile u32 *ptr32;5959 unsigned int shift;6060- u8 load;61606261 /* Check that ptr is naturally aligned */6362 WARN_ON((unsigned long)ptr & (size - 1));
+2-1
arch/mips/kernel/setup.c
···384384 init_initrd();385385 reserved_end = (unsigned long) PFN_UP(__pa_symbol(&_end));386386387387- memblock_reserve(PHYS_OFFSET, reserved_end << PAGE_SHIFT);387387+ memblock_reserve(PHYS_OFFSET,388388+ (reserved_end << PAGE_SHIFT) - PHYS_OFFSET);388389389390 /*390391 * max_low_pfn is not a number of pages. The number of pages
···841841 * count is equal with how many entries of union hv_gpa_page_range can842842 * be populated into the input parameter page.843843 */844844-#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) / \844844+#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) / \845845 sizeof(union hv_gpa_page_range))846846847847struct hv_guest_mapping_flush_list {
···117117}118118EXPORT_SYMBOL_GPL(ex_handler_fprestore);119119120120-/* Helper to check whether a uaccess fault indicates a kernel bug. */121121-static bool bogus_uaccess(struct pt_regs *regs, int trapnr,122122- unsigned long fault_addr)123123-{124124- /* This is the normal case: #PF with a fault address in userspace. */125125- if (trapnr == X86_TRAP_PF && fault_addr < TASK_SIZE_MAX)126126- return false;127127-128128- /*129129- * This code can be reached for machine checks, but only if the #MC130130- * handler has already decided that it looks like a candidate for fixup.131131- * This e.g. happens when attempting to access userspace memory which132132- * the CPU can't access because of uncorrectable bad memory.133133- */134134- if (trapnr == X86_TRAP_MC)135135- return false;136136-137137- /*138138- * There are two remaining exception types we might encounter here:139139- * - #PF for faulting accesses to kernel addresses140140- * - #GP for faulting accesses to noncanonical addresses141141- * Complain about anything else.142142- */143143- if (trapnr != X86_TRAP_PF && trapnr != X86_TRAP_GP) {144144- WARN(1, "unexpected trap %d in uaccess\n", trapnr);145145- return false;146146- }147147-148148- /*149149- * This is a faulting memory access in kernel space, on a kernel150150- * address, in a usercopy function. This can e.g. be caused by improper151151- * use of helpers like __put_user and by improper attempts to access152152- * userspace addresses in KERNEL_DS regions.153153- * The one (semi-)legitimate exception are probe_kernel_{read,write}(),154154- * which can be invoked from places like kgdb, /dev/mem (for reading)155155- * and privileged BPF code (for reading).156156- * The probe_kernel_*() functions set the kernel_uaccess_faults_ok flag157157- * to tell us that faulting on kernel addresses, and even noncanonical158158- * addresses, in a userspace accessor does not necessarily imply a159159- * kernel bug, root might just be doing weird stuff.160160- */161161- if (current->kernel_uaccess_faults_ok)162162- return false;163163-164164- /* This is bad. Refuse the fixup so that we go into die(). */165165- if (trapnr == X86_TRAP_PF) {166166- pr_emerg("BUG: pagefault on kernel address 0x%lx in non-whitelisted uaccess\n",167167- fault_addr);168168- } else {169169- pr_emerg("BUG: GPF in non-whitelisted uaccess (non-canonical address?)\n");170170- }171171- return true;172172-}173173-174120__visible bool ex_handler_uaccess(const struct exception_table_entry *fixup,175121 struct pt_regs *regs, int trapnr,176122 unsigned long error_code,177123 unsigned long fault_addr)178124{179179- if (bogus_uaccess(regs, trapnr, fault_addr))180180- return false;181125 regs->ip = ex_fixup_addr(fixup);182126 return true;183127}···132188 unsigned long error_code,133189 unsigned long fault_addr)134190{135135- if (bogus_uaccess(regs, trapnr, fault_addr))136136- return false;137191 /* Special hack for uaccess_err */138192 current->thread.uaccess_err = 1;139193 regs->ip = ex_fixup_addr(fixup);
···303303 return;304304 }305305306306+ /* Update to correct count(s) if racing with vblank irq */307307+ amdgpu_crtc->last_flip_vblank = drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);306308307309 /* wake up userspace */308310 if (amdgpu_crtc->event) {309309- /* Update to correct count(s) if racing with vblank irq */310310- drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);311311-312311 drm_crtc_send_vblank_event(&amdgpu_crtc->base, amdgpu_crtc->event);313312314313 /* page flip completed. clean up */···48274828 to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc));48284829 int planes_count = 0;48294830 unsigned long flags;48314831+ u64 last_flip_vblank;48324832+ bool vrr_active = acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE;4830483348314834 /* update planes when needed */48324835 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {···48604859 /* In commit tail framework this cannot happen */48614860 WARN_ON(1);48624861 }48624862+48634863+ /* For variable refresh rate mode only:48644864+ * Get vblank of last completed flip to avoid > 1 vrr flips per48654865+ * video frame by use of throttling, but allow flip programming48664866+ * anywhere in the possibly large variable vrr vblank interval48674867+ * for fine-grained flip timing control and more opportunity to48684868+ * avoid stutter on late submission of amdgpu_dm_do_flip() calls.48694869+ */48704870+ last_flip_vblank = acrtc_attach->last_flip_vblank;48714871+48634872 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);4864487348654874 if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {···48934882 if (plane->type == DRM_PLANE_TYPE_PRIMARY)48944883 drm_crtc_vblank_get(crtc);4895488448854885+ /* Use old throttling in non-vrr fixed refresh rate mode48864886+ * to keep flip scheduling based on target vblank counts48874887+ * working in a backwards compatible way, e.g., clients48884888+ * using GLX_OML_sync_control extension.48894889+ */48904890+ if (!vrr_active)48914891+ last_flip_vblank = drm_crtc_vblank_count(crtc);48924892+48964893 amdgpu_dm_do_flip(48974894 crtc,48984895 fb,48994899- (uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank,48964896+ (uint32_t) last_flip_vblank + *wait_for_vblank,49004897 dc_state);49014898 }49024899
+4
drivers/gpu/drm/bochs/bochs_drv.c
···154154 if (IS_ERR(dev))155155 return PTR_ERR(dev);156156157157+ ret = pci_enable_device(pdev);158158+ if (ret)159159+ goto err_free_dev;160160+157161 dev->pdev = pdev;158162 pci_set_drvdata(pdev, dev);159163
+9
drivers/gpu/drm/drm_atomic_helper.c
···16021602 old_plane_state->crtc != new_plane_state->crtc)16031603 return -EINVAL;1604160416051605+ /*16061606+ * FIXME: Since prepare_fb and cleanup_fb are always called on16071607+ * the new_plane_state for async updates we need to block framebuffer16081608+ * changes. This prevents use of a fb that's been cleaned up and16091609+ * double cleanups from occuring.16101610+ */16111611+ if (old_plane_state->fb != new_plane_state->fb)16121612+ return -EINVAL;16131613+16051614 funcs = plane->helper_private;16061615 if (!funcs->atomic_async_update)16071616 return -EINVAL;
···267267 struct phy *serdes;268268 void __iomem *regs;269269 char res_name[8];270270+ int phy_mode;270271 u32 port;271272272273 if (of_property_read_u32(portnp, "reg", &port))···293292 if (err)294293 return err;295294296296- err = of_get_phy_mode(portnp);297297- if (err < 0)295295+ phy_mode = of_get_phy_mode(portnp);296296+ if (phy_mode < 0)298297 ocelot->ports[port]->phy_mode = PHY_INTERFACE_MODE_NA;299298 else300300- ocelot->ports[port]->phy_mode = err;299299+ ocelot->ports[port]->phy_mode = phy_mode;301300302301 switch (ocelot->ports[port]->phy_mode) {303302 case PHY_INTERFACE_MODE_NA:···305304 case PHY_INTERFACE_MODE_SGMII:306305 break;307306 case PHY_INTERFACE_MODE_QSGMII:307307+ /* Ensure clock signals and speed is set on all308308+ * QSGMII links309309+ */310310+ ocelot_port_writel(ocelot->ports[port],311311+ DEV_CLOCK_CFG_LINK_SPEED312312+ (OCELOT_SPEED_1000),313313+ DEV_CLOCK_CFG);308314 break;309315 default:310316 dev_err(ocelot->dev,
+18-8
drivers/net/usb/qmi_wwan.c
···976976 0xff),977977 .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,978978 },979979+ { /* Quectel EG12/EM12 */980980+ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512,981981+ USB_CLASS_VENDOR_SPEC,982982+ USB_SUBCLASS_VENDOR_SPEC,983983+ 0xff),984984+ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,985985+ },979986980987 /* 3. Combined interface devices matching on interface number */981988 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */···13501343 return false;13511344}1352134513531353-static bool quectel_ep06_diag_detected(struct usb_interface *intf)13461346+static bool quectel_diag_detected(struct usb_interface *intf)13541347{13551348 struct usb_device *dev = interface_to_usbdev(intf);13561349 struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc;13501350+ u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor);13511351+ u16 id_product = le16_to_cpu(dev->descriptor.idProduct);1357135213581358- if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c &&13591359- le16_to_cpu(dev->descriptor.idProduct) == 0x0306 &&13601360- intf_desc.bNumEndpoints == 2)13531353+ if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2)13541354+ return false;13551355+13561356+ if (id_product == 0x0306 || id_product == 0x0512)13611357 return true;13621362-13631363- return false;13581358+ else13591359+ return false;13641360}1365136113661362static int qmi_wwan_probe(struct usb_interface *intf,···14001390 return -ENODEV;14011391 }1402139214031403- /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so13931393+ /* Several Quectel modems supports dynamic interface configuration, so14041394 * we need to match on class/subclass/protocol. These values are14051395 * identical for the diagnostic- and QMI-interface, but bNumEndpoints is14061396 * different. Ignore the current interface if the number of endpoints14071397 * the number for the diag interface (two).14081398 */14091409- if (quectel_ep06_diag_detected(intf))13991399+ if (quectel_diag_detected(intf))14101400 return -ENODEV;1411140114121402 return usbnet_probe(intf, id);
+9-5
drivers/scsi/3w-9xxx.c
···20092009 struct Scsi_Host *host = NULL;20102010 TW_Device_Extension *tw_dev;20112011 unsigned long mem_addr, mem_len;20122012- int retval = -ENODEV;20122012+ int retval;2013201320142014 retval = pci_enable_device(pdev);20152015 if (retval) {···20202020 pci_set_master(pdev);20212021 pci_try_set_mwi(pdev);2022202220232023- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||20242024- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {20232023+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));20242024+ if (retval)20252025+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));20262026+ if (retval) {20252027 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");20262028 retval = -ENODEV;20272029 goto out_disable_device;···22422240 pci_set_master(pdev);22432241 pci_try_set_mwi(pdev);2244224222452245- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||22462246- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {22432243+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));22442244+ if (retval)22452245+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));22462246+ if (retval) {22472247 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");22482248 retval = -ENODEV;22492249 goto out_disable_device;
+8-4
drivers/scsi/3w-sas.c
···15731573 pci_set_master(pdev);15741574 pci_try_set_mwi(pdev);1575157515761576- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||15771577- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {15761576+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));15771577+ if (retval)15781578+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));15791579+ if (retval) {15781580 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");15791581 retval = -ENODEV;15801582 goto out_disable_device;···18071805 pci_set_master(pdev);18081806 pci_try_set_mwi(pdev);1809180718101810- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||18111811- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {18081808+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));18091809+ if (retval)18101810+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));18111811+ if (retval) {18121812 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");18131813 retval = -ENODEV;18141814 goto out_disable_device;
+5-3
drivers/scsi/aic94xx/aic94xx_init.c
···769769 if (err)770770 goto Err_remove;771771772772- err = -ENODEV;773773- if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||774774- dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {772772+ err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64));773773+ if (err)774774+ err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));775775+ if (err) {776776+ err = -ENODEV;775777 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));776778 goto Err_remove;777779 }
+13-5
drivers/scsi/bfa/bfad.c
···727727int728728bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)729729{730730- int rc = -ENODEV;730730+ int rc = -ENODEV;731731732732 if (pci_enable_device(pdev)) {733733 printk(KERN_ERR "pci_enable_device fail %p\n", pdev);···739739740740 pci_set_master(pdev);741741742742- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||743743- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {742742+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));743743+ if (rc)744744+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));745745+746746+ if (rc) {747747+ rc = -ENODEV;744748 printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);745749 goto out_release_region;746750 }···15381534{15391535 struct bfad_s *bfad = pci_get_drvdata(pdev);15401536 u8 byte;15371537+ int rc;1541153815421539 dev_printk(KERN_ERR, &pdev->dev,15431540 "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);···15661561 pci_save_state(pdev);15671562 pci_set_master(pdev);1568156315691569- if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) ||15701570- dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32)))15641564+ rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));15651565+ if (rc)15661566+ rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,15671567+ DMA_BIT_MASK(32));15681568+ if (rc)15711569 goto out_disable_device;1572157015731571 if (restart_bfa(bfad) == -1)
+5-2
drivers/scsi/csiostor/csio_init.c
···210210 pci_set_master(pdev);211211 pci_try_set_mwi(pdev);212212213213- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||214214- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {213213+ rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));214214+ if (rv)215215+ rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));216216+ if (rv) {217217+ rv = -ENODEV;215218 dev_err(&pdev->dev, "No suitable DMA available.\n");216219 goto err_release_regions;217220 }
+6-2
drivers/scsi/hisi_sas/hisi_sas_main.c
···23232323 struct Scsi_Host *shost;23242324 struct hisi_hba *hisi_hba;23252325 struct device *dev = &pdev->dev;23262326+ int error;2326232723272328 shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));23282329 if (!shost) {···23442343 if (hisi_sas_get_fw_info(hisi_hba) < 0)23452344 goto err_out;2346234523472347- if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) &&23482348- dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {23462346+ error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));23472347+ if (error)23482348+ error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));23492349+23502350+ if (error) {23492351 dev_err(dev, "No usable DMA addressing method\n");23502352 goto err_out;23512353 }
+5-3
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
···24472447 if (rc)24482448 goto err_out_disable_device;2449244924502450- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||24512451- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {24502450+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));24512451+ if (rc)24522452+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));24532453+ if (rc) {24522454 dev_err(dev, "No usable DMA addressing method\n");24532453- rc = -EIO;24552455+ rc = -ENODEV;24542456 goto err_out_regions;24552457 }24562458
+7-3
drivers/scsi/hptiop.c
···12921292 dma_addr_t start_phy;12931293 void *start_virt;12941294 u32 offset, i, req_size;12951295+ int rc;1295129612961297 dprintk("hptiop_probe(%p)\n", pcidev);12971298···1309130813101309 /* Enable 64bit DMA if possible */13111310 iop_ops = (struct hptiop_adapter_ops *)id->driver_data;13121312- if (dma_set_mask(&pcidev->dev,13131313- DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) ||13141314- dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) {13111311+ rc = dma_set_mask(&pcidev->dev,13121312+ DMA_BIT_MASK(iop_ops->hw_dma_bit_mask));13131313+ if (rc)13141314+ rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32));13151315+13161316+ if (rc) {13151317 printk(KERN_ERR "hptiop: fail to set dma_mask\n");13161318 goto disable_pci_device;13171319 }
+12-7
drivers/scsi/lpfc/lpfc_init.c
···73617361 unsigned long bar0map_len, bar2map_len;73627362 int i, hbq_count;73637363 void *ptr;73647364- int error = -ENODEV;73647364+ int error;7365736573667366 if (!pdev)73677367- return error;73677367+ return -ENODEV;7368736873697369 /* Set the device DMA mask size */73707370- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||73717371- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))73707370+ error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));73717371+ if (error)73727372+ error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));73737373+ if (error)73727374 return error;73757375+ error = -ENODEV;7373737673747377 /* Get the bus address of Bar0 and Bar2 and the number of bytes73757378 * required by each mapping.···97459742 uint32_t if_type;9746974397479744 if (!pdev)97489748- return error;97459745+ return -ENODEV;9749974697509747 /* Set the device DMA mask size */97519751- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||97529752- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))97489748+ error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));97499749+ if (error)97509750+ error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));97519751+ if (error)97539752 return error;9754975397559754 /*
-1
drivers/scsi/scsi_lib.c
···25982598 * device deleted during suspend)25992599 */26002600 mutex_lock(&sdev->state_mutex);26012601- WARN_ON_ONCE(!sdev->quiesced_by);26022601 sdev->quiesced_by = NULL;26032602 blk_clear_pm_only(sdev->request_queue);26042603 if (sdev->sdev_state == SDEV_QUIESCE)
···859859 rc = migrate_huge_page_move_mapping(mapping, newpage, page);860860 if (rc != MIGRATEPAGE_SUCCESS)861861 return rc;862862+863863+ /*864864+ * page_private is subpool pointer in hugetlb pages. Transfer to865865+ * new page. PagePrivate is not associated with page_private for866866+ * hugetlb pages and can not be set here as only page_huge_active867867+ * pages can be migrated.868868+ */869869+ if (page_private(page)) {870870+ set_page_private(newpage, page_private(page));871871+ set_page_private(page, 0);872872+ }873873+862874 if (mode != MIGRATE_SYNC_NO_COPY)863875 migrate_page_copy(newpage, page);864876 else
···158158extern int sysctl_aarp_resolve_time;159159160160#ifdef CONFIG_SYSCTL161161-extern void atalk_register_sysctl(void);161161+extern int atalk_register_sysctl(void);162162extern void atalk_unregister_sysctl(void);163163#else164164#define atalk_register_sysctl() do { } while(0)
-6
include/linux/sched.h
···739739 unsigned use_memdelay:1;740740#endif741741742742- /*743743- * May usercopy functions fault on kernel addresses?744744- * This is not just a single bit because this can potentially nest.745745- */746746- unsigned int kernel_uaccess_faults_ok;747747-748742 unsigned long atomic_flags; /* Flags requiring atomic access. */749743750744 struct restart_block restart_block;
···113113114114endchoice115115116116+config KASAN_STACK_ENABLE117117+ bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST118118+ default !(CLANG_VERSION < 90000)119119+ depends on KASAN120120+ help121121+ The LLVM stack address sanitizer has a know problem that122122+ causes excessive stack usage in a lot of functions, see123123+ https://bugs.llvm.org/show_bug.cgi?id=38809124124+ Disabling asan-stack makes it safe to run kernels build125125+ with clang-8 with KASAN enabled, though it loses some of126126+ the functionality.127127+ This feature is always disabled when compile-testing with clang-8128128+ or earlier to avoid cluttering the output in stack overflow129129+ warnings, but clang-8 users can still enable it for builds without130130+ CONFIG_COMPILE_TEST. On gcc and later clang versions it is131131+ assumed to always be safe to use and enabled by default.132132+133133+config KASAN_STACK134134+ int135135+ default 1 if KASAN_STACK_ENABLE || CC_IS_GCC136136+ default 0137137+116138config KASAN_S390_4_LEVEL_PAGING117139 bool "KASan: use 4-level paging"118140 depends on KASAN && S390
+13-3
mm/hugetlb.c
···36243624 copy_user_huge_page(new_page, old_page, address, vma,36253625 pages_per_huge_page(h));36263626 __SetPageUptodate(new_page);36273627- set_page_huge_active(new_page);3628362736293628 mmu_notifier_range_init(&range, mm, haddr, haddr + huge_page_size(h));36303629 mmu_notifier_invalidate_range_start(&range);···36443645 make_huge_pte(vma, new_page, 1));36453646 page_remove_rmap(old_page, true);36463647 hugepage_add_new_anon_rmap(new_page, vma, haddr);36483648+ set_page_huge_active(new_page);36473649 /* Make the old page be freed below */36483650 new_page = old_page;36493651 }···37293729 pte_t new_pte;37303730 spinlock_t *ptl;37313731 unsigned long haddr = address & huge_page_mask(h);37323732+ bool new_page = false;3732373337333734 /*37343735 * Currently, we are forced to kill the process in the event the···37913790 }37923791 clear_huge_page(page, address, pages_per_huge_page(h));37933792 __SetPageUptodate(page);37943794- set_page_huge_active(page);37933793+ new_page = true;3795379437963795 if (vma->vm_flags & VM_MAYSHARE) {37973796 int err = huge_add_to_page_cache(page, mapping, idx);···38623861 }3863386238643863 spin_unlock(ptl);38643864+38653865+ /*38663866+ * Only make newly allocated pages active. Existing pages found38673867+ * in the pagecache could be !page_huge_active() if they have been38683868+ * isolated for migration.38693869+ */38703870+ if (new_page)38713871+ set_page_huge_active(page);38723872+38653873 unlock_page(page);38663874out:38673875 return ret;···41054095 * the set_pte_at() write.41064096 */41074097 __SetPageUptodate(page);41084108- set_page_huge_active(page);4109409841104099 mapping = dst_vma->vm_file->f_mapping;41114100 idx = vma_hugecache_offset(h, dst_vma, dst_addr);···41724163 update_mmu_cache(dst_vma, dst_addr, dst_pte);4173416441744165 spin_unlock(ptl);41664166+ set_page_huge_active(page);41754167 if (vm_shared)41764168 unlock_page(page);41774169 ret = 0;
···13151315 lock_page(hpage);13161316 }1317131713181318+ /*13191319+ * Check for pages which are in the process of being freed. Without13201320+ * page_mapping() set, hugetlbfs specific move page routine will not13211321+ * be called and we could leak usage counts for subpools.13221322+ */13231323+ if (page_private(hpage) && !page_mapping(hpage)) {13241324+ rc = -EBUSY;13251325+ goto out_unlock;13261326+ }13271327+13181328 if (PageAnon(hpage))13191329 anon_vma = page_get_anon_vma(hpage);13201330···13551345 put_new_page = NULL;13561346 }1357134713481348+out_unlock:13581349 unlock_page(hpage);13591350out:13601351 if (rc != -EAGAIN)
+3-4
mm/mmap.c
···24262426{24272427 struct mm_struct *mm = vma->vm_mm;24282428 struct vm_area_struct *prev;24292429- int error;24292429+ int error = 0;2430243024312431 address &= PAGE_MASK;24322432- error = security_mmap_addr(address);24332433- if (error)24342434- return error;24322432+ if (address < mmap_min_addr)24332433+ return -EPERM;2435243424362435 /* Enforce stack_guard_gap */24372436 prev = vma->vm_prev;
+1-1
mm/shmem.c
···28482848static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)28492849{28502850 struct inode *inode = d_inode(old_dentry);28512851- int ret;28512851+ int ret = 0;2852285228532853 /*28542854 * No ordinary (disk based) filesystem counts links as inodes;
+18-40
net/appletalk/atalk_proc.c
···210210 .show = atalk_seq_socket_show,211211};212212213213-static struct proc_dir_entry *atalk_proc_dir;214214-215213int __init atalk_proc_init(void)216214{217217- struct proc_dir_entry *p;218218- int rc = -ENOMEM;215215+ if (!proc_mkdir("atalk", init_net.proc_net))216216+ return -ENOMEM;219217220220- atalk_proc_dir = proc_mkdir("atalk", init_net.proc_net);221221- if (!atalk_proc_dir)218218+ if (!proc_create_seq("atalk/interface", 0444, init_net.proc_net,219219+ &atalk_seq_interface_ops))222220 goto out;223221224224- p = proc_create_seq("interface", 0444, atalk_proc_dir,225225- &atalk_seq_interface_ops);226226- if (!p)227227- goto out_interface;222222+ if (!proc_create_seq("atalk/route", 0444, init_net.proc_net,223223+ &atalk_seq_route_ops))224224+ goto out;228225229229- p = proc_create_seq("route", 0444, atalk_proc_dir,230230- &atalk_seq_route_ops);231231- if (!p)232232- goto out_route;226226+ if (!proc_create_seq("atalk/socket", 0444, init_net.proc_net,227227+ &atalk_seq_socket_ops))228228+ goto out;233229234234- p = proc_create_seq("socket", 0444, atalk_proc_dir,235235- &atalk_seq_socket_ops);236236- if (!p)237237- goto out_socket;230230+ if (!proc_create_seq_private("atalk/arp", 0444, init_net.proc_net,231231+ &aarp_seq_ops,232232+ sizeof(struct aarp_iter_state), NULL))233233+ goto out;238234239239- p = proc_create_seq_private("arp", 0444, atalk_proc_dir, &aarp_seq_ops,240240- sizeof(struct aarp_iter_state), NULL);241241- if (!p)242242- goto out_arp;243243-244244- rc = 0;245235out:246246- return rc;247247-out_arp:248248- remove_proc_entry("socket", atalk_proc_dir);249249-out_socket:250250- remove_proc_entry("route", atalk_proc_dir);251251-out_route:252252- remove_proc_entry("interface", atalk_proc_dir);253253-out_interface:254254- remove_proc_entry("atalk", init_net.proc_net);255255- goto out;236236+ remove_proc_subtree("atalk", init_net.proc_net);237237+ return -ENOMEM;256238}257239258258-void __exit atalk_proc_exit(void)240240+void atalk_proc_exit(void)259241{260260- remove_proc_entry("interface", atalk_proc_dir);261261- remove_proc_entry("route", atalk_proc_dir);262262- remove_proc_entry("socket", atalk_proc_dir);263263- remove_proc_entry("arp", atalk_proc_dir);264264- remove_proc_entry("atalk", init_net.proc_net);242242+ remove_proc_subtree("atalk", init_net.proc_net);265243}
+31-6
net/appletalk/ddp.c
···19101910/* Called by proto.c on kernel start up */19111911static int __init atalk_init(void)19121912{19131913- int rc = proto_register(&ddp_proto, 0);19131913+ int rc;1914191419151915- if (rc != 0)19151915+ rc = proto_register(&ddp_proto, 0);19161916+ if (rc)19161917 goto out;1917191819181918- (void)sock_register(&atalk_family_ops);19191919+ rc = sock_register(&atalk_family_ops);19201920+ if (rc)19211921+ goto out_proto;19221922+19191923 ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv);19201924 if (!ddp_dl)19211925 printk(atalk_err_snap);···19271923 dev_add_pack(<alk_packet_type);19281924 dev_add_pack(&ppptalk_packet_type);1929192519301930- register_netdevice_notifier(&ddp_notifier);19261926+ rc = register_netdevice_notifier(&ddp_notifier);19271927+ if (rc)19281928+ goto out_sock;19291929+19311930 aarp_proto_init();19321932- atalk_proc_init();19331933- atalk_register_sysctl();19311931+ rc = atalk_proc_init();19321932+ if (rc)19331933+ goto out_aarp;19341934+19351935+ rc = atalk_register_sysctl();19361936+ if (rc)19371937+ goto out_proc;19341938out:19351939 return rc;19401940+out_proc:19411941+ atalk_proc_exit();19421942+out_aarp:19431943+ aarp_cleanup_module();19441944+ unregister_netdevice_notifier(&ddp_notifier);19451945+out_sock:19461946+ dev_remove_pack(&ppptalk_packet_type);19471947+ dev_remove_pack(<alk_packet_type);19481948+ unregister_snap_client(ddp_dl);19491949+ sock_unregister(PF_APPLETALK);19501950+out_proto:19511951+ proto_unregister(&ddp_proto);19521952+ goto out;19361953}19371954module_init(atalk_init);19381955