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/netdev/net

Small conflict around locking in rxrpc_process_event() -
channel_lock moved to bundle in next, while state lock
needs _bh() from net.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+1943 -565
+5
MAINTAINERS
··· 1460 1460 F: drivers/amba/ 1461 1461 F: include/linux/amba/bus.h 1462 1462 1463 + ARM PRIMECELL CLCD PL110 DRIVER 1464 + M: Russell King <linux@armlinux.org.uk> 1465 + S: Odd Fixes 1466 + F: drivers/video/fbdev/amba-clcd.* 1467 + 1463 1468 ARM PRIMECELL KMI PL050 DRIVER 1464 1469 M: Russell King <linux@armlinux.org.uk> 1465 1470 S: Odd Fixes
+1 -1
arch/arm/xen/enlighten.c
··· 150 150 pr_info("Xen: initializing cpu%d\n", cpu); 151 151 vcpup = per_cpu_ptr(xen_vcpu_info, cpu); 152 152 153 - info.mfn = virt_to_gfn(vcpup); 153 + info.mfn = percpu_to_gfn(vcpup); 154 154 info.offset = xen_offset_in_page(vcpup); 155 155 156 156 err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, xen_vcpu_nr(cpu),
+2 -2
arch/arm64/crypto/aes-neonbs-core.S
··· 788 788 789 789 0: mov bskey, x21 790 790 mov rounds, x22 791 - br x7 791 + br x16 792 792 SYM_FUNC_END(__xts_crypt8) 793 793 794 794 .macro __xts_crypt, do8, o0, o1, o2, o3, o4, o5, o6, o7 ··· 806 806 uzp1 v30.4s, v30.4s, v25.4s 807 807 ld1 {v25.16b}, [x24] 808 808 809 - 99: adr x7, \do8 809 + 99: adr x16, \do8 810 810 bl __xts_crypt8 811 811 812 812 ldp q16, q17, [sp, #.Lframe_local_offset]
+2
drivers/gpu/drm/nouveau/nouveau_mem.c
··· 176 176 nouveau_mem_del(struct ttm_mem_reg *reg) 177 177 { 178 178 struct nouveau_mem *mem = nouveau_mem(reg); 179 + if (!mem) 180 + return; 179 181 nouveau_mem_fini(mem); 180 182 kfree(reg->mm_node); 181 183 reg->mm_node = NULL;
+1
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
··· 3149 3149 case 0x168: device->chip = &nv168_chipset; break; 3150 3150 default: 3151 3151 nvdev_error(device, "unknown chipset (%08x)\n", boot0); 3152 + ret = -ENODEV; 3152 3153 goto done; 3153 3154 } 3154 3155
+2
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 998 998 */ 999 999 static u16 vsc9959_wm_enc(u16 value) 1000 1000 { 1001 + WARN_ON(value >= 16 * BIT(8)); 1002 + 1001 1003 if (value >= BIT(8)) 1002 1004 return BIT(8) | (value / 16); 1003 1005
+2
drivers/net/dsa/ocelot/seville_vsc9953.c
··· 1049 1049 */ 1050 1050 static u16 vsc9953_wm_enc(u16 value) 1051 1051 { 1052 + WARN_ON(value >= 16 * BIT(9)); 1053 + 1052 1054 if (value >= BIT(9)) 1053 1055 return BIT(9) | (value / 16); 1054 1056
+6 -6
drivers/net/ethernet/mscc/ocelot.c
··· 1270 1270 struct ocelot_port *ocelot_port = ocelot->ports[port]; 1271 1271 int maxlen = sdu + ETH_HLEN + ETH_FCS_LEN; 1272 1272 int pause_start, pause_stop; 1273 - int atop_wm; 1273 + int atop, atop_tot; 1274 1274 1275 1275 if (port == ocelot->npi) { 1276 1276 maxlen += OCELOT_TAG_LEN; ··· 1291 1291 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_STOP, 1292 1292 pause_stop); 1293 1293 1294 - /* Tail dropping watermark */ 1295 - atop_wm = (ocelot->shared_queue_sz - 9 * maxlen) / 1294 + /* Tail dropping watermarks */ 1295 + atop_tot = (ocelot->shared_queue_sz - 9 * maxlen) / 1296 1296 OCELOT_BUFFER_CELL_SZ; 1297 - ocelot_write_rix(ocelot, ocelot->ops->wm_enc(9 * maxlen), 1298 - SYS_ATOP, port); 1299 - ocelot_write(ocelot, ocelot->ops->wm_enc(atop_wm), SYS_ATOP_TOT_CFG); 1297 + atop = (9 * maxlen) / OCELOT_BUFFER_CELL_SZ; 1298 + ocelot_write_rix(ocelot, ocelot->ops->wm_enc(atop), SYS_ATOP, port); 1299 + ocelot_write(ocelot, ocelot->ops->wm_enc(atop_tot), SYS_ATOP_TOT_CFG); 1300 1300 } 1301 1301 EXPORT_SYMBOL(ocelot_port_set_maxlen); 1302 1302
+2
drivers/net/ethernet/mscc/ocelot_vsc7514.c
··· 754 754 */ 755 755 static u16 ocelot_wm_enc(u16 value) 756 756 { 757 + WARN_ON(value >= 16 * BIT(8)); 758 + 757 759 if (value >= BIT(8)) 758 760 return BIT(8) | (value / 16); 759 761
+7
drivers/net/ethernet/realtek/r8169_main.c
··· 2055 2055 2056 2056 void r8169_apply_firmware(struct rtl8169_private *tp) 2057 2057 { 2058 + int val; 2059 + 2058 2060 /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ 2059 2061 if (tp->rtl_fw) { 2060 2062 rtl_fw_write_firmware(tp, tp->rtl_fw); 2061 2063 /* At least one firmware doesn't reset tp->ocp_base. */ 2062 2064 tp->ocp_base = OCP_STD_PHY_BASE; 2065 + 2066 + /* PHY soft reset may still be in progress */ 2067 + phy_read_poll_timeout(tp->phydev, MII_BMCR, val, 2068 + !(val & BMCR_RESET), 2069 + 50000, 600000, true); 2063 2070 } 2064 2071 } 2065 2072
+3 -1
drivers/net/macsec.c
··· 1077 1077 struct macsec_rx_sa *rx_sa; 1078 1078 struct macsec_rxh_data *rxd; 1079 1079 struct macsec_dev *macsec; 1080 + unsigned int len; 1080 1081 sci_t sci; 1081 1082 u32 hdr_pn; 1082 1083 bool cbit; ··· 1233 1232 macsec_rxsc_put(rx_sc); 1234 1233 1235 1234 skb_orphan(skb); 1235 + len = skb->len; 1236 1236 ret = gro_cells_receive(&macsec->gro_cells, skb); 1237 1237 if (ret == NET_RX_SUCCESS) 1238 - count_rx(dev, skb->len); 1238 + count_rx(dev, len); 1239 1239 else 1240 1240 macsec->secy.netdev->stats.rx_dropped++; 1241 1241
+1
drivers/net/usb/qmi_wwan.c
··· 1375 1375 {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */ 1376 1376 {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ 1377 1377 {QMI_FIXED_INTF(0x0489, 0xe0b5, 0)}, /* Foxconn T77W968 LTE with eSIM support*/ 1378 + {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */ 1378 1379 1379 1380 /* 4. Gobi 1000 devices */ 1380 1381 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+12 -4
drivers/net/usb/rtl8150.c
··· 274 274 return 1; 275 275 } 276 276 277 - static inline void set_ethernet_addr(rtl8150_t * dev) 277 + static void set_ethernet_addr(rtl8150_t *dev) 278 278 { 279 - u8 node_id[6]; 279 + u8 node_id[ETH_ALEN]; 280 + int ret; 280 281 281 - get_registers(dev, IDR, sizeof(node_id), node_id); 282 - memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id)); 282 + ret = get_registers(dev, IDR, sizeof(node_id), node_id); 283 + 284 + if (ret == sizeof(node_id)) { 285 + ether_addr_copy(dev->netdev->dev_addr, node_id); 286 + } else { 287 + eth_hw_addr_random(dev->netdev); 288 + netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n", 289 + dev->netdev->dev_addr); 290 + } 283 291 } 284 292 285 293 static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
+32
drivers/platform/x86/asus-nb-wmi.c
··· 115 115 .wmi_backlight_set_devstate = true, 116 116 }; 117 117 118 + static struct quirk_entry quirk_asus_use_kbd_dock_devid = { 119 + .use_kbd_dock_devid = true, 120 + }; 121 + 118 122 static int dmi_matched(const struct dmi_system_id *dmi) 119 123 { 120 124 pr_info("Identified laptop model '%s'\n", dmi->ident); ··· 491 487 DMI_MATCH(DMI_PRODUCT_NAME, "GA502IV"), 492 488 }, 493 489 .driver_data = &quirk_asus_vendor_backlight, 490 + }, 491 + { 492 + .callback = dmi_matched, 493 + .ident = "Asus Transformer T100TA / T100HA / T100CHI", 494 + .matches = { 495 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 496 + /* Match *T100* */ 497 + DMI_MATCH(DMI_PRODUCT_NAME, "T100"), 498 + }, 499 + .driver_data = &quirk_asus_use_kbd_dock_devid, 500 + }, 501 + { 502 + .callback = dmi_matched, 503 + .ident = "Asus Transformer T101HA", 504 + .matches = { 505 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 506 + DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"), 507 + }, 508 + .driver_data = &quirk_asus_use_kbd_dock_devid, 509 + }, 510 + { 511 + .callback = dmi_matched, 512 + .ident = "Asus Transformer T200TA", 513 + .matches = { 514 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 515 + DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"), 516 + }, 517 + .driver_data = &quirk_asus_use_kbd_dock_devid, 494 518 }, 495 519 {}, 496 520 };
+9 -7
drivers/platform/x86/asus-wmi.c
··· 365 365 if (err) 366 366 goto err_free_dev; 367 367 368 - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK); 369 - if (result >= 0) { 370 - input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); 371 - input_report_switch(asus->inputdev, SW_TABLET_MODE, !result); 372 - } else if (result != -ENODEV) { 373 - pr_err("Error checking for keyboard-dock: %d\n", result); 368 + if (asus->driver->quirks->use_kbd_dock_devid) { 369 + result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK); 370 + if (result >= 0) { 371 + input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); 372 + input_report_switch(asus->inputdev, SW_TABLET_MODE, !result); 373 + } else if (result != -ENODEV) { 374 + pr_err("Error checking for keyboard-dock: %d\n", result); 375 + } 374 376 } 375 377 376 378 err = input_register_device(asus->inputdev); ··· 2117 2115 return; 2118 2116 } 2119 2117 2120 - if (code == NOTIFY_KBD_DOCK_CHANGE) { 2118 + if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) { 2121 2119 result = asus_wmi_get_devstate_simple(asus, 2122 2120 ASUS_WMI_DEVID_KBD_DOCK); 2123 2121 if (result >= 0) {
+1
drivers/platform/x86/asus-wmi.h
··· 33 33 bool wmi_backlight_native; 34 34 bool wmi_backlight_set_devstate; 35 35 bool wmi_force_als_set; 36 + bool use_kbd_dock_devid; 36 37 int wapf; 37 38 /* 38 39 * For machines with AMD graphic chips, it will send out WMI event
+3 -4
drivers/vdpa/Kconfig
··· 30 30 be called ifcvf. 31 31 32 32 config MLX5_VDPA 33 - bool "MLX5 VDPA support library for ConnectX devices" 34 - depends on MLX5_CORE 35 - default n 33 + bool 36 34 help 37 35 Support library for Mellanox VDPA drivers. Provides code that is 38 36 common for all types of VDPA drivers. The following drivers are planned: ··· 38 40 39 41 config MLX5_VDPA_NET 40 42 tristate "vDPA driver for ConnectX devices" 41 - depends on MLX5_VDPA 43 + select MLX5_VDPA 44 + depends on MLX5_CORE 42 45 default n 43 46 help 44 47 VDPA network driver for ConnectX6 and newer. Provides offloading
+14 -6
drivers/vdpa/mlx5/net/mlx5_vnet.c
··· 1133 1133 if (!mvq->initialized) 1134 1134 return; 1135 1135 1136 - if (query_virtqueue(ndev, mvq, &attr)) { 1137 - mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n"); 1138 - return; 1139 - } 1140 1136 if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY) 1141 1137 return; 1142 1138 1143 1139 if (modify_virtqueue(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND)) 1144 1140 mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed\n"); 1141 + 1142 + if (query_virtqueue(ndev, mvq, &attr)) { 1143 + mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n"); 1144 + return; 1145 + } 1146 + mvq->avail_idx = attr.available_index; 1145 1147 } 1146 1148 1147 1149 static void suspend_vqs(struct mlx5_vdpa_net *ndev) ··· 1413 1411 struct mlx5_virtq_attr attr; 1414 1412 int err; 1415 1413 1416 - if (!mvq->initialized) 1417 - return -EAGAIN; 1414 + /* If the virtq object was destroyed, use the value saved at 1415 + * the last minute of suspend_vq. This caters for userspace 1416 + * that cares about emulating the index after vq is stopped. 1417 + */ 1418 + if (!mvq->initialized) { 1419 + state->avail_index = mvq->avail_idx; 1420 + return 0; 1421 + } 1418 1422 1419 1423 err = query_virtqueue(ndev, mvq, &attr); 1420 1424 if (err) {
+77 -50
drivers/vhost/vdpa.c
··· 565 565 perm_to_iommu_flags(perm)); 566 566 } 567 567 568 + if (r) 569 + vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1); 570 + 568 571 return r; 569 572 } 570 573 ··· 595 592 struct vhost_dev *dev = &v->vdev; 596 593 struct vhost_iotlb *iotlb = dev->iotlb; 597 594 struct page **page_list; 598 - unsigned long list_size = PAGE_SIZE / sizeof(struct page *); 595 + struct vm_area_struct **vmas; 599 596 unsigned int gup_flags = FOLL_LONGTERM; 600 - unsigned long npages, cur_base, map_pfn, last_pfn = 0; 601 - unsigned long locked, lock_limit, pinned, i; 597 + unsigned long map_pfn, last_pfn = 0; 598 + unsigned long npages, lock_limit; 599 + unsigned long i, nmap = 0; 602 600 u64 iova = msg->iova; 601 + long pinned; 603 602 int ret = 0; 604 603 605 604 if (vhost_iotlb_itree_first(iotlb, msg->iova, 606 605 msg->iova + msg->size - 1)) 607 606 return -EEXIST; 608 - 609 - page_list = (struct page **) __get_free_page(GFP_KERNEL); 610 - if (!page_list) 611 - return -ENOMEM; 612 607 613 608 if (msg->perm & VHOST_ACCESS_WO) 614 609 gup_flags |= FOLL_WRITE; ··· 615 614 if (!npages) 616 615 return -EINVAL; 617 616 617 + page_list = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL); 618 + vmas = kvmalloc_array(npages, sizeof(struct vm_area_struct *), 619 + GFP_KERNEL); 620 + if (!page_list || !vmas) { 621 + ret = -ENOMEM; 622 + goto free; 623 + } 624 + 618 625 mmap_read_lock(dev->mm); 619 626 620 - locked = atomic64_add_return(npages, &dev->mm->pinned_vm); 621 627 lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; 622 - 623 - if (locked > lock_limit) { 628 + if (npages + atomic64_read(&dev->mm->pinned_vm) > lock_limit) { 624 629 ret = -ENOMEM; 625 - goto out; 630 + goto unlock; 626 631 } 627 632 628 - cur_base = msg->uaddr & PAGE_MASK; 629 - iova &= PAGE_MASK; 630 - 631 - while (npages) { 632 - pinned = min_t(unsigned long, npages, list_size); 633 - ret = pin_user_pages(cur_base, pinned, 634 - gup_flags, page_list, NULL); 635 - if (ret != pinned) 636 - goto out; 637 - 638 - if (!last_pfn) 639 - map_pfn = page_to_pfn(page_list[0]); 640 - 641 - for (i = 0; i < ret; i++) { 642 - unsigned long this_pfn = page_to_pfn(page_list[i]); 643 - u64 csize; 644 - 645 - if (last_pfn && (this_pfn != last_pfn + 1)) { 646 - /* Pin a contiguous chunk of memory */ 647 - csize = (last_pfn - map_pfn + 1) << PAGE_SHIFT; 648 - if (vhost_vdpa_map(v, iova, csize, 649 - map_pfn << PAGE_SHIFT, 650 - msg->perm)) 651 - goto out; 652 - map_pfn = this_pfn; 653 - iova += csize; 654 - } 655 - 656 - last_pfn = this_pfn; 633 + pinned = pin_user_pages(msg->uaddr & PAGE_MASK, npages, gup_flags, 634 + page_list, vmas); 635 + if (npages != pinned) { 636 + if (pinned < 0) { 637 + ret = pinned; 638 + } else { 639 + unpin_user_pages(page_list, pinned); 640 + ret = -ENOMEM; 657 641 } 658 - 659 - cur_base += ret << PAGE_SHIFT; 660 - npages -= ret; 642 + goto unlock; 661 643 } 662 644 663 - /* Pin the rest chunk */ 664 - ret = vhost_vdpa_map(v, iova, (last_pfn - map_pfn + 1) << PAGE_SHIFT, 665 - map_pfn << PAGE_SHIFT, msg->perm); 645 + iova &= PAGE_MASK; 646 + map_pfn = page_to_pfn(page_list[0]); 647 + 648 + /* One more iteration to avoid extra vdpa_map() call out of loop. */ 649 + for (i = 0; i <= npages; i++) { 650 + unsigned long this_pfn; 651 + u64 csize; 652 + 653 + /* The last chunk may have no valid PFN next to it */ 654 + this_pfn = i < npages ? page_to_pfn(page_list[i]) : -1UL; 655 + 656 + if (last_pfn && (this_pfn == -1UL || 657 + this_pfn != last_pfn + 1)) { 658 + /* Pin a contiguous chunk of memory */ 659 + csize = last_pfn - map_pfn + 1; 660 + ret = vhost_vdpa_map(v, iova, csize << PAGE_SHIFT, 661 + map_pfn << PAGE_SHIFT, 662 + msg->perm); 663 + if (ret) { 664 + /* 665 + * Unpin the rest chunks of memory on the 666 + * flight with no corresponding vdpa_map() 667 + * calls having been made yet. On the other 668 + * hand, vdpa_unmap() in the failure path 669 + * is in charge of accounting the number of 670 + * pinned pages for its own. 671 + * This asymmetrical pattern of accounting 672 + * is for efficiency to pin all pages at 673 + * once, while there is no other callsite 674 + * of vdpa_map() than here above. 675 + */ 676 + unpin_user_pages(&page_list[nmap], 677 + npages - nmap); 678 + goto out; 679 + } 680 + atomic64_add(csize, &dev->mm->pinned_vm); 681 + nmap += csize; 682 + iova += csize << PAGE_SHIFT; 683 + map_pfn = this_pfn; 684 + } 685 + last_pfn = this_pfn; 686 + } 687 + 688 + WARN_ON(nmap != npages); 666 689 out: 667 - if (ret) { 690 + if (ret) 668 691 vhost_vdpa_unmap(v, msg->iova, msg->size); 669 - atomic64_sub(npages, &dev->mm->pinned_vm); 670 - } 692 + unlock: 671 693 mmap_read_unlock(dev->mm); 672 - free_page((unsigned long)page_list); 694 + free: 695 + kvfree(vmas); 696 + kvfree(page_list); 673 697 return ret; 674 698 } 675 699 ··· 836 810 837 811 err_init_iotlb: 838 812 vhost_dev_cleanup(&v->vdev); 813 + kfree(vqs); 839 814 err: 840 815 atomic_dec(&v->opened); 841 816 return r;
+23 -10
drivers/vhost/vhost.c
··· 1290 1290 vring_used_t __user *used) 1291 1291 1292 1292 { 1293 + /* If an IOTLB device is present, the vring addresses are 1294 + * GIOVAs. Access validation occurs at prefetch time. */ 1295 + if (vq->iotlb) 1296 + return true; 1297 + 1293 1298 return access_ok(desc, vhost_get_desc_size(vq, num)) && 1294 1299 access_ok(avail, vhost_get_avail_size(vq, num)) && 1295 1300 access_ok(used, vhost_get_used_size(vq, num)); ··· 1370 1365 } 1371 1366 EXPORT_SYMBOL_GPL(vhost_log_access_ok); 1372 1367 1368 + static bool vq_log_used_access_ok(struct vhost_virtqueue *vq, 1369 + void __user *log_base, 1370 + bool log_used, 1371 + u64 log_addr) 1372 + { 1373 + /* If an IOTLB device is present, log_addr is a GIOVA that 1374 + * will never be logged by log_used(). */ 1375 + if (vq->iotlb) 1376 + return true; 1377 + 1378 + return !log_used || log_access_ok(log_base, log_addr, 1379 + vhost_get_used_size(vq, vq->num)); 1380 + } 1381 + 1373 1382 /* Verify access for write logging. */ 1374 1383 /* Caller should have vq mutex and device mutex */ 1375 1384 static bool vq_log_access_ok(struct vhost_virtqueue *vq, ··· 1391 1372 { 1392 1373 return vq_memory_access_ok(log_base, vq->umem, 1393 1374 vhost_has_feature(vq, VHOST_F_LOG_ALL)) && 1394 - (!vq->log_used || log_access_ok(log_base, vq->log_addr, 1395 - vhost_get_used_size(vq, vq->num))); 1375 + vq_log_used_access_ok(vq, log_base, vq->log_used, vq->log_addr); 1396 1376 } 1397 1377 1398 1378 /* Can we start vq? */ ··· 1400 1382 { 1401 1383 if (!vq_log_access_ok(vq, vq->log_base)) 1402 1384 return false; 1403 - 1404 - /* Access validation occurs at prefetch time with IOTLB */ 1405 - if (vq->iotlb) 1406 - return true; 1407 1385 1408 1386 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used); 1409 1387 } ··· 1530 1516 return -EINVAL; 1531 1517 1532 1518 /* Also validate log access for used ring if enabled. */ 1533 - if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) && 1534 - !log_access_ok(vq->log_base, a.log_guest_addr, 1535 - sizeof *vq->used + 1536 - vq->num * sizeof *vq->used->ring)) 1519 + if (!vq_log_used_access_ok(vq, vq->log_base, 1520 + a.flags & (0x1 << VHOST_VRING_F_LOG), 1521 + a.log_guest_addr)) 1537 1522 return -EINVAL; 1538 1523 } 1539 1524
+1 -6
drivers/video/console/newport_con.c
··· 35 35 36 36 #define FONT_DATA ((unsigned char *)font_vga_8x16.data) 37 37 38 - /* borrowed from fbcon.c */ 39 - #define REFCOUNT(fd) (((int *)(fd))[-1]) 40 - #define FNTSIZE(fd) (((int *)(fd))[-2]) 41 - #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 42 - #define FONT_EXTRA_WORDS 3 43 - 44 38 static unsigned char *font_data[MAX_NR_CONSOLES]; 45 39 46 40 static struct newport_regs *npregs; ··· 516 522 FNTSIZE(new_data) = size; 517 523 FNTCHARCNT(new_data) = op->charcount; 518 524 REFCOUNT(new_data) = 0; /* usage counter */ 525 + FNTSUM(new_data) = 0; 519 526 520 527 p = new_data; 521 528 for (i = 0; i < op->charcount; i++) {
+20
drivers/video/fbdev/Kconfig
··· 272 272 help 273 273 Support the Permedia2 FIFO disconnect feature. 274 274 275 + config FB_ARMCLCD 276 + tristate "ARM PrimeCell PL110 support" 277 + depends on ARM || ARM64 || COMPILE_TEST 278 + depends on FB && ARM_AMBA && HAS_IOMEM 279 + select FB_CFB_FILLRECT 280 + select FB_CFB_COPYAREA 281 + select FB_CFB_IMAGEBLIT 282 + select FB_MODE_HELPERS if OF 283 + select VIDEOMODE_HELPERS if OF 284 + select BACKLIGHT_CLASS_DEVICE if OF 285 + help 286 + This framebuffer device driver is for the ARM PrimeCell PL110 287 + Colour LCD controller. ARM PrimeCells provide the building 288 + blocks for System on a Chip devices. 289 + 290 + If you want to compile this as a module (=code which can be 291 + inserted into and removed from the running kernel), say M 292 + here and read <file:Documentation/kbuild/modules.rst>. The module 293 + will be called amba-clcd. 294 + 275 295 config FB_ACORN 276 296 bool "Acorn VIDC support" 277 297 depends on (FB = y) && ARM && ARCH_ACORN
+1
drivers/video/fbdev/Makefile
··· 75 75 obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o 76 76 obj-$(CONFIG_FB_PVR2) += pvr2fb.o 77 77 obj-$(CONFIG_FB_VOODOO1) += sstfb.o 78 + obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o 78 79 obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o 79 80 obj-$(CONFIG_FB_68328) += 68328fb.o 80 81 obj-$(CONFIG_FB_GBE) += gbefb.o
+986
drivers/video/fbdev/amba-clcd.c
··· 1 + /* 2 + * linux/drivers/video/amba-clcd.c 3 + * 4 + * Copyright (C) 2001 ARM Limited, by David A Rusling 5 + * Updated to 2.5, Deep Blue Solutions Ltd. 6 + * 7 + * This file is subject to the terms and conditions of the GNU General Public 8 + * License. See the file COPYING in the main directory of this archive 9 + * for more details. 10 + * 11 + * ARM PrimeCell PL110 Color LCD Controller 12 + */ 13 + #include <linux/amba/bus.h> 14 + #include <linux/amba/clcd.h> 15 + #include <linux/backlight.h> 16 + #include <linux/clk.h> 17 + #include <linux/delay.h> 18 + #include <linux/dma-mapping.h> 19 + #include <linux/fb.h> 20 + #include <linux/init.h> 21 + #include <linux/ioport.h> 22 + #include <linux/list.h> 23 + #include <linux/mm.h> 24 + #include <linux/module.h> 25 + #include <linux/of_address.h> 26 + #include <linux/of_graph.h> 27 + #include <linux/slab.h> 28 + #include <linux/string.h> 29 + #include <video/display_timing.h> 30 + #include <video/of_display_timing.h> 31 + #include <video/videomode.h> 32 + 33 + #define to_clcd(info) container_of(info, struct clcd_fb, fb) 34 + 35 + /* This is limited to 16 characters when displayed by X startup */ 36 + static const char *clcd_name = "CLCD FB"; 37 + 38 + /* 39 + * Unfortunately, the enable/disable functions may be called either from 40 + * process or IRQ context, and we _need_ to delay. This is _not_ good. 41 + */ 42 + static inline void clcdfb_sleep(unsigned int ms) 43 + { 44 + if (in_atomic()) { 45 + mdelay(ms); 46 + } else { 47 + msleep(ms); 48 + } 49 + } 50 + 51 + static inline void clcdfb_set_start(struct clcd_fb *fb) 52 + { 53 + unsigned long ustart = fb->fb.fix.smem_start; 54 + unsigned long lstart; 55 + 56 + ustart += fb->fb.var.yoffset * fb->fb.fix.line_length; 57 + lstart = ustart + fb->fb.var.yres * fb->fb.fix.line_length / 2; 58 + 59 + writel(ustart, fb->regs + CLCD_UBAS); 60 + writel(lstart, fb->regs + CLCD_LBAS); 61 + } 62 + 63 + static void clcdfb_disable(struct clcd_fb *fb) 64 + { 65 + u32 val; 66 + 67 + if (fb->board->disable) 68 + fb->board->disable(fb); 69 + 70 + if (fb->panel->backlight) { 71 + fb->panel->backlight->props.power = FB_BLANK_POWERDOWN; 72 + backlight_update_status(fb->panel->backlight); 73 + } 74 + 75 + val = readl(fb->regs + fb->off_cntl); 76 + if (val & CNTL_LCDPWR) { 77 + val &= ~CNTL_LCDPWR; 78 + writel(val, fb->regs + fb->off_cntl); 79 + 80 + clcdfb_sleep(20); 81 + } 82 + if (val & CNTL_LCDEN) { 83 + val &= ~CNTL_LCDEN; 84 + writel(val, fb->regs + fb->off_cntl); 85 + } 86 + 87 + /* 88 + * Disable CLCD clock source. 89 + */ 90 + if (fb->clk_enabled) { 91 + fb->clk_enabled = false; 92 + clk_disable(fb->clk); 93 + } 94 + } 95 + 96 + static void clcdfb_enable(struct clcd_fb *fb, u32 cntl) 97 + { 98 + /* 99 + * Enable the CLCD clock source. 100 + */ 101 + if (!fb->clk_enabled) { 102 + fb->clk_enabled = true; 103 + clk_enable(fb->clk); 104 + } 105 + 106 + /* 107 + * Bring up by first enabling.. 108 + */ 109 + cntl |= CNTL_LCDEN; 110 + writel(cntl, fb->regs + fb->off_cntl); 111 + 112 + clcdfb_sleep(20); 113 + 114 + /* 115 + * and now apply power. 116 + */ 117 + cntl |= CNTL_LCDPWR; 118 + writel(cntl, fb->regs + fb->off_cntl); 119 + 120 + /* 121 + * Turn on backlight 122 + */ 123 + if (fb->panel->backlight) { 124 + fb->panel->backlight->props.power = FB_BLANK_UNBLANK; 125 + backlight_update_status(fb->panel->backlight); 126 + } 127 + 128 + /* 129 + * finally, enable the interface. 130 + */ 131 + if (fb->board->enable) 132 + fb->board->enable(fb); 133 + } 134 + 135 + static int 136 + clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) 137 + { 138 + u32 caps; 139 + int ret = 0; 140 + 141 + if (fb->panel->caps && fb->board->caps) 142 + caps = fb->panel->caps & fb->board->caps; 143 + else { 144 + /* Old way of specifying what can be used */ 145 + caps = fb->panel->cntl & CNTL_BGR ? 146 + CLCD_CAP_BGR : CLCD_CAP_RGB; 147 + /* But mask out 444 modes as they weren't supported */ 148 + caps &= ~CLCD_CAP_444; 149 + } 150 + 151 + /* Only TFT panels can do RGB888/BGR888 */ 152 + if (!(fb->panel->cntl & CNTL_LCDTFT)) 153 + caps &= ~CLCD_CAP_888; 154 + 155 + memset(&var->transp, 0, sizeof(var->transp)); 156 + 157 + var->red.msb_right = 0; 158 + var->green.msb_right = 0; 159 + var->blue.msb_right = 0; 160 + 161 + switch (var->bits_per_pixel) { 162 + case 1: 163 + case 2: 164 + case 4: 165 + case 8: 166 + /* If we can't do 5551, reject */ 167 + caps &= CLCD_CAP_5551; 168 + if (!caps) { 169 + ret = -EINVAL; 170 + break; 171 + } 172 + 173 + var->red.length = var->bits_per_pixel; 174 + var->red.offset = 0; 175 + var->green.length = var->bits_per_pixel; 176 + var->green.offset = 0; 177 + var->blue.length = var->bits_per_pixel; 178 + var->blue.offset = 0; 179 + break; 180 + 181 + case 16: 182 + /* If we can't do 444, 5551 or 565, reject */ 183 + if (!(caps & (CLCD_CAP_444 | CLCD_CAP_5551 | CLCD_CAP_565))) { 184 + ret = -EINVAL; 185 + break; 186 + } 187 + 188 + /* 189 + * Green length can be 4, 5 or 6 depending whether 190 + * we're operating in 444, 5551 or 565 mode. 191 + */ 192 + if (var->green.length == 4 && caps & CLCD_CAP_444) 193 + caps &= CLCD_CAP_444; 194 + if (var->green.length == 5 && caps & CLCD_CAP_5551) 195 + caps &= CLCD_CAP_5551; 196 + else if (var->green.length == 6 && caps & CLCD_CAP_565) 197 + caps &= CLCD_CAP_565; 198 + else { 199 + /* 200 + * PL110 officially only supports RGB555, 201 + * but may be wired up to allow RGB565. 202 + */ 203 + if (caps & CLCD_CAP_565) { 204 + var->green.length = 6; 205 + caps &= CLCD_CAP_565; 206 + } else if (caps & CLCD_CAP_5551) { 207 + var->green.length = 5; 208 + caps &= CLCD_CAP_5551; 209 + } else { 210 + var->green.length = 4; 211 + caps &= CLCD_CAP_444; 212 + } 213 + } 214 + 215 + if (var->green.length >= 5) { 216 + var->red.length = 5; 217 + var->blue.length = 5; 218 + } else { 219 + var->red.length = 4; 220 + var->blue.length = 4; 221 + } 222 + break; 223 + case 32: 224 + /* If we can't do 888, reject */ 225 + caps &= CLCD_CAP_888; 226 + if (!caps) { 227 + ret = -EINVAL; 228 + break; 229 + } 230 + 231 + var->red.length = 8; 232 + var->green.length = 8; 233 + var->blue.length = 8; 234 + break; 235 + default: 236 + ret = -EINVAL; 237 + break; 238 + } 239 + 240 + /* 241 + * >= 16bpp displays have separate colour component bitfields 242 + * encoded in the pixel data. Calculate their position from 243 + * the bitfield length defined above. 244 + */ 245 + if (ret == 0 && var->bits_per_pixel >= 16) { 246 + bool bgr, rgb; 247 + 248 + bgr = caps & CLCD_CAP_BGR && var->blue.offset == 0; 249 + rgb = caps & CLCD_CAP_RGB && var->red.offset == 0; 250 + 251 + if (!bgr && !rgb) 252 + /* 253 + * The requested format was not possible, try just 254 + * our capabilities. One of BGR or RGB must be 255 + * supported. 256 + */ 257 + bgr = caps & CLCD_CAP_BGR; 258 + 259 + if (bgr) { 260 + var->blue.offset = 0; 261 + var->green.offset = var->blue.offset + var->blue.length; 262 + var->red.offset = var->green.offset + var->green.length; 263 + } else { 264 + var->red.offset = 0; 265 + var->green.offset = var->red.offset + var->red.length; 266 + var->blue.offset = var->green.offset + var->green.length; 267 + } 268 + } 269 + 270 + return ret; 271 + } 272 + 273 + static int clcdfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 274 + { 275 + struct clcd_fb *fb = to_clcd(info); 276 + int ret = -EINVAL; 277 + 278 + if (fb->board->check) 279 + ret = fb->board->check(fb, var); 280 + 281 + if (ret == 0 && 282 + var->xres_virtual * var->bits_per_pixel / 8 * 283 + var->yres_virtual > fb->fb.fix.smem_len) 284 + ret = -EINVAL; 285 + 286 + if (ret == 0) 287 + ret = clcdfb_set_bitfields(fb, var); 288 + 289 + return ret; 290 + } 291 + 292 + static int clcdfb_set_par(struct fb_info *info) 293 + { 294 + struct clcd_fb *fb = to_clcd(info); 295 + struct clcd_regs regs; 296 + 297 + fb->fb.fix.line_length = fb->fb.var.xres_virtual * 298 + fb->fb.var.bits_per_pixel / 8; 299 + 300 + if (fb->fb.var.bits_per_pixel <= 8) 301 + fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; 302 + else 303 + fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; 304 + 305 + fb->board->decode(fb, &regs); 306 + 307 + clcdfb_disable(fb); 308 + 309 + writel(regs.tim0, fb->regs + CLCD_TIM0); 310 + writel(regs.tim1, fb->regs + CLCD_TIM1); 311 + writel(regs.tim2, fb->regs + CLCD_TIM2); 312 + writel(regs.tim3, fb->regs + CLCD_TIM3); 313 + 314 + clcdfb_set_start(fb); 315 + 316 + clk_set_rate(fb->clk, (1000000000 / regs.pixclock) * 1000); 317 + 318 + fb->clcd_cntl = regs.cntl; 319 + 320 + clcdfb_enable(fb, regs.cntl); 321 + 322 + #ifdef DEBUG 323 + printk(KERN_INFO 324 + "CLCD: Registers set to\n" 325 + " %08x %08x %08x %08x\n" 326 + " %08x %08x %08x %08x\n", 327 + readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1), 328 + readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3), 329 + readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS), 330 + readl(fb->regs + fb->off_ienb), readl(fb->regs + fb->off_cntl)); 331 + #endif 332 + 333 + return 0; 334 + } 335 + 336 + static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) 337 + { 338 + unsigned int mask = (1 << bf->length) - 1; 339 + 340 + return (val >> (16 - bf->length) & mask) << bf->offset; 341 + } 342 + 343 + /* 344 + * Set a single color register. The values supplied have a 16 bit 345 + * magnitude. Return != 0 for invalid regno. 346 + */ 347 + static int 348 + clcdfb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, 349 + unsigned int blue, unsigned int transp, struct fb_info *info) 350 + { 351 + struct clcd_fb *fb = to_clcd(info); 352 + 353 + if (regno < 16) 354 + fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | 355 + convert_bitfield(blue, &fb->fb.var.blue) | 356 + convert_bitfield(green, &fb->fb.var.green) | 357 + convert_bitfield(red, &fb->fb.var.red); 358 + 359 + if (fb->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR && regno < 256) { 360 + int hw_reg = CLCD_PALETTE + ((regno * 2) & ~3); 361 + u32 val, mask, newval; 362 + 363 + newval = (red >> 11) & 0x001f; 364 + newval |= (green >> 6) & 0x03e0; 365 + newval |= (blue >> 1) & 0x7c00; 366 + 367 + /* 368 + * 3.2.11: if we're configured for big endian 369 + * byte order, the palette entries are swapped. 370 + */ 371 + if (fb->clcd_cntl & CNTL_BEBO) 372 + regno ^= 1; 373 + 374 + if (regno & 1) { 375 + newval <<= 16; 376 + mask = 0x0000ffff; 377 + } else { 378 + mask = 0xffff0000; 379 + } 380 + 381 + val = readl(fb->regs + hw_reg) & mask; 382 + writel(val | newval, fb->regs + hw_reg); 383 + } 384 + 385 + return regno > 255; 386 + } 387 + 388 + /* 389 + * Blank the screen if blank_mode != 0, else unblank. If blank == NULL 390 + * then the caller blanks by setting the CLUT (Color Look Up Table) to all 391 + * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due 392 + * to e.g. a video mode which doesn't support it. Implements VESA suspend 393 + * and powerdown modes on hardware that supports disabling hsync/vsync: 394 + * blank_mode == 2: suspend vsync 395 + * blank_mode == 3: suspend hsync 396 + * blank_mode == 4: powerdown 397 + */ 398 + static int clcdfb_blank(int blank_mode, struct fb_info *info) 399 + { 400 + struct clcd_fb *fb = to_clcd(info); 401 + 402 + if (blank_mode != 0) { 403 + clcdfb_disable(fb); 404 + } else { 405 + clcdfb_enable(fb, fb->clcd_cntl); 406 + } 407 + return 0; 408 + } 409 + 410 + static int clcdfb_mmap(struct fb_info *info, 411 + struct vm_area_struct *vma) 412 + { 413 + struct clcd_fb *fb = to_clcd(info); 414 + unsigned long len, off = vma->vm_pgoff << PAGE_SHIFT; 415 + int ret = -EINVAL; 416 + 417 + len = info->fix.smem_len; 418 + 419 + if (off <= len && vma->vm_end - vma->vm_start <= len - off && 420 + fb->board->mmap) 421 + ret = fb->board->mmap(fb, vma); 422 + 423 + return ret; 424 + } 425 + 426 + static const struct fb_ops clcdfb_ops = { 427 + .owner = THIS_MODULE, 428 + .fb_check_var = clcdfb_check_var, 429 + .fb_set_par = clcdfb_set_par, 430 + .fb_setcolreg = clcdfb_setcolreg, 431 + .fb_blank = clcdfb_blank, 432 + .fb_fillrect = cfb_fillrect, 433 + .fb_copyarea = cfb_copyarea, 434 + .fb_imageblit = cfb_imageblit, 435 + .fb_mmap = clcdfb_mmap, 436 + }; 437 + 438 + static int clcdfb_register(struct clcd_fb *fb) 439 + { 440 + int ret; 441 + 442 + /* 443 + * ARM PL111 always has IENB at 0x1c; it's only PL110 444 + * which is reversed on some platforms. 445 + */ 446 + if (amba_manf(fb->dev) == 0x41 && amba_part(fb->dev) == 0x111) { 447 + fb->off_ienb = CLCD_PL111_IENB; 448 + fb->off_cntl = CLCD_PL111_CNTL; 449 + } else { 450 + fb->off_ienb = CLCD_PL110_IENB; 451 + fb->off_cntl = CLCD_PL110_CNTL; 452 + } 453 + 454 + fb->clk = clk_get(&fb->dev->dev, NULL); 455 + if (IS_ERR(fb->clk)) { 456 + ret = PTR_ERR(fb->clk); 457 + goto out; 458 + } 459 + 460 + ret = clk_prepare(fb->clk); 461 + if (ret) 462 + goto free_clk; 463 + 464 + fb->fb.device = &fb->dev->dev; 465 + 466 + fb->fb.fix.mmio_start = fb->dev->res.start; 467 + fb->fb.fix.mmio_len = resource_size(&fb->dev->res); 468 + 469 + fb->regs = ioremap(fb->fb.fix.mmio_start, fb->fb.fix.mmio_len); 470 + if (!fb->regs) { 471 + printk(KERN_ERR "CLCD: unable to remap registers\n"); 472 + ret = -ENOMEM; 473 + goto clk_unprep; 474 + } 475 + 476 + fb->fb.fbops = &clcdfb_ops; 477 + fb->fb.flags = FBINFO_FLAG_DEFAULT; 478 + fb->fb.pseudo_palette = fb->cmap; 479 + 480 + strncpy(fb->fb.fix.id, clcd_name, sizeof(fb->fb.fix.id)); 481 + fb->fb.fix.type = FB_TYPE_PACKED_PIXELS; 482 + fb->fb.fix.type_aux = 0; 483 + fb->fb.fix.xpanstep = 0; 484 + fb->fb.fix.ypanstep = 0; 485 + fb->fb.fix.ywrapstep = 0; 486 + fb->fb.fix.accel = FB_ACCEL_NONE; 487 + 488 + fb->fb.var.xres = fb->panel->mode.xres; 489 + fb->fb.var.yres = fb->panel->mode.yres; 490 + fb->fb.var.xres_virtual = fb->panel->mode.xres; 491 + fb->fb.var.yres_virtual = fb->panel->mode.yres; 492 + fb->fb.var.bits_per_pixel = fb->panel->bpp; 493 + fb->fb.var.grayscale = fb->panel->grayscale; 494 + fb->fb.var.pixclock = fb->panel->mode.pixclock; 495 + fb->fb.var.left_margin = fb->panel->mode.left_margin; 496 + fb->fb.var.right_margin = fb->panel->mode.right_margin; 497 + fb->fb.var.upper_margin = fb->panel->mode.upper_margin; 498 + fb->fb.var.lower_margin = fb->panel->mode.lower_margin; 499 + fb->fb.var.hsync_len = fb->panel->mode.hsync_len; 500 + fb->fb.var.vsync_len = fb->panel->mode.vsync_len; 501 + fb->fb.var.sync = fb->panel->mode.sync; 502 + fb->fb.var.vmode = fb->panel->mode.vmode; 503 + fb->fb.var.activate = FB_ACTIVATE_NOW; 504 + fb->fb.var.nonstd = 0; 505 + fb->fb.var.height = fb->panel->height; 506 + fb->fb.var.width = fb->panel->width; 507 + fb->fb.var.accel_flags = 0; 508 + 509 + fb->fb.monspecs.hfmin = 0; 510 + fb->fb.monspecs.hfmax = 100000; 511 + fb->fb.monspecs.vfmin = 0; 512 + fb->fb.monspecs.vfmax = 400; 513 + fb->fb.monspecs.dclkmin = 1000000; 514 + fb->fb.monspecs.dclkmax = 100000000; 515 + 516 + /* 517 + * Make sure that the bitfields are set appropriately. 518 + */ 519 + clcdfb_set_bitfields(fb, &fb->fb.var); 520 + 521 + /* 522 + * Allocate colourmap. 523 + */ 524 + ret = fb_alloc_cmap(&fb->fb.cmap, 256, 0); 525 + if (ret) 526 + goto unmap; 527 + 528 + /* 529 + * Ensure interrupts are disabled. 530 + */ 531 + writel(0, fb->regs + fb->off_ienb); 532 + 533 + fb_set_var(&fb->fb, &fb->fb.var); 534 + 535 + dev_info(&fb->dev->dev, "%s hardware, %s display\n", 536 + fb->board->name, fb->panel->mode.name); 537 + 538 + ret = register_framebuffer(&fb->fb); 539 + if (ret == 0) 540 + goto out; 541 + 542 + printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); 543 + 544 + fb_dealloc_cmap(&fb->fb.cmap); 545 + unmap: 546 + iounmap(fb->regs); 547 + clk_unprep: 548 + clk_unprepare(fb->clk); 549 + free_clk: 550 + clk_put(fb->clk); 551 + out: 552 + return ret; 553 + } 554 + 555 + #ifdef CONFIG_OF 556 + static int clcdfb_of_get_dpi_panel_mode(struct device_node *node, 557 + struct clcd_panel *clcd_panel) 558 + { 559 + int err; 560 + struct display_timing timing; 561 + struct videomode video; 562 + 563 + err = of_get_display_timing(node, "panel-timing", &timing); 564 + if (err) { 565 + pr_err("%pOF: problems parsing panel-timing (%d)\n", node, err); 566 + return err; 567 + } 568 + 569 + videomode_from_timing(&timing, &video); 570 + 571 + err = fb_videomode_from_videomode(&video, &clcd_panel->mode); 572 + if (err) 573 + return err; 574 + 575 + /* Set up some inversion flags */ 576 + if (timing.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) 577 + clcd_panel->tim2 |= TIM2_IPC; 578 + else if (!(timing.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)) 579 + /* 580 + * To preserve backwards compatibility, the IPC (inverted 581 + * pixel clock) flag needs to be set on any display that 582 + * doesn't explicitly specify that the pixel clock is 583 + * active on the negative or positive edge. 584 + */ 585 + clcd_panel->tim2 |= TIM2_IPC; 586 + 587 + if (timing.flags & DISPLAY_FLAGS_HSYNC_LOW) 588 + clcd_panel->tim2 |= TIM2_IHS; 589 + 590 + if (timing.flags & DISPLAY_FLAGS_VSYNC_LOW) 591 + clcd_panel->tim2 |= TIM2_IVS; 592 + 593 + if (timing.flags & DISPLAY_FLAGS_DE_LOW) 594 + clcd_panel->tim2 |= TIM2_IOE; 595 + 596 + return 0; 597 + } 598 + 599 + static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode) 600 + { 601 + return snprintf(buf, size, "%ux%u@%u", mode->xres, mode->yres, 602 + mode->refresh); 603 + } 604 + 605 + static int clcdfb_of_get_backlight(struct device *dev, 606 + struct clcd_panel *clcd_panel) 607 + { 608 + struct backlight_device *backlight; 609 + 610 + /* Look up the optional backlight device */ 611 + backlight = devm_of_find_backlight(dev); 612 + if (IS_ERR(backlight)) 613 + return PTR_ERR(backlight); 614 + 615 + clcd_panel->backlight = backlight; 616 + return 0; 617 + } 618 + 619 + static int clcdfb_of_get_mode(struct device *dev, struct device_node *panel, 620 + struct clcd_panel *clcd_panel) 621 + { 622 + int err; 623 + struct fb_videomode *mode; 624 + char *name; 625 + int len; 626 + 627 + /* Only directly connected DPI panels supported for now */ 628 + if (of_device_is_compatible(panel, "panel-dpi")) 629 + err = clcdfb_of_get_dpi_panel_mode(panel, clcd_panel); 630 + else 631 + err = -ENOENT; 632 + if (err) 633 + return err; 634 + mode = &clcd_panel->mode; 635 + 636 + len = clcdfb_snprintf_mode(NULL, 0, mode); 637 + name = devm_kzalloc(dev, len + 1, GFP_KERNEL); 638 + if (!name) 639 + return -ENOMEM; 640 + 641 + clcdfb_snprintf_mode(name, len + 1, mode); 642 + mode->name = name; 643 + 644 + return 0; 645 + } 646 + 647 + static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) 648 + { 649 + static struct { 650 + unsigned int part; 651 + u32 r0, g0, b0; 652 + u32 caps; 653 + } panels[] = { 654 + { 0x110, 1, 7, 13, CLCD_CAP_5551 }, 655 + { 0x110, 0, 8, 16, CLCD_CAP_888 }, 656 + { 0x110, 16, 8, 0, CLCD_CAP_888 }, 657 + { 0x111, 4, 14, 20, CLCD_CAP_444 }, 658 + { 0x111, 3, 11, 19, CLCD_CAP_444 | CLCD_CAP_5551 }, 659 + { 0x111, 3, 10, 19, CLCD_CAP_444 | CLCD_CAP_5551 | 660 + CLCD_CAP_565 }, 661 + { 0x111, 0, 8, 16, CLCD_CAP_444 | CLCD_CAP_5551 | 662 + CLCD_CAP_565 | CLCD_CAP_888 }, 663 + }; 664 + int i; 665 + 666 + /* Bypass pixel clock divider */ 667 + fb->panel->tim2 |= TIM2_BCD; 668 + 669 + /* TFT display, vert. comp. interrupt at the start of the back porch */ 670 + fb->panel->cntl |= CNTL_LCDTFT | CNTL_LCDVCOMP(1); 671 + 672 + fb->panel->caps = 0; 673 + 674 + /* Match the setup with known variants */ 675 + for (i = 0; i < ARRAY_SIZE(panels) && !fb->panel->caps; i++) { 676 + if (amba_part(fb->dev) != panels[i].part) 677 + continue; 678 + if (g0 != panels[i].g0) 679 + continue; 680 + if (r0 == panels[i].r0 && b0 == panels[i].b0) 681 + fb->panel->caps = panels[i].caps; 682 + } 683 + 684 + /* 685 + * If we actually physically connected the R lines to B and 686 + * vice versa 687 + */ 688 + if (r0 != 0 && b0 == 0) 689 + fb->panel->bgr_connection = true; 690 + 691 + return fb->panel->caps ? 0 : -EINVAL; 692 + } 693 + 694 + static int clcdfb_of_init_display(struct clcd_fb *fb) 695 + { 696 + struct device_node *endpoint, *panel; 697 + int err; 698 + unsigned int bpp; 699 + u32 max_bandwidth; 700 + u32 tft_r0b0g0[3]; 701 + 702 + fb->panel = devm_kzalloc(&fb->dev->dev, sizeof(*fb->panel), GFP_KERNEL); 703 + if (!fb->panel) 704 + return -ENOMEM; 705 + 706 + /* 707 + * Fetch the panel endpoint. 708 + */ 709 + endpoint = of_graph_get_next_endpoint(fb->dev->dev.of_node, NULL); 710 + if (!endpoint) 711 + return -ENODEV; 712 + 713 + panel = of_graph_get_remote_port_parent(endpoint); 714 + if (!panel) 715 + return -ENODEV; 716 + 717 + err = clcdfb_of_get_backlight(&fb->dev->dev, fb->panel); 718 + if (err) 719 + return err; 720 + 721 + err = clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel); 722 + if (err) 723 + return err; 724 + 725 + err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", 726 + &max_bandwidth); 727 + if (!err) { 728 + /* 729 + * max_bandwidth is in bytes per second and pixclock in 730 + * pico-seconds, so the maximum allowed bits per pixel is 731 + * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) 732 + * Rearrange this calculation to avoid overflow and then ensure 733 + * result is a valid format. 734 + */ 735 + bpp = max_bandwidth / (1000 / 8) 736 + / PICOS2KHZ(fb->panel->mode.pixclock); 737 + bpp = rounddown_pow_of_two(bpp); 738 + if (bpp > 32) 739 + bpp = 32; 740 + } else 741 + bpp = 32; 742 + fb->panel->bpp = bpp; 743 + 744 + #ifdef CONFIG_CPU_BIG_ENDIAN 745 + fb->panel->cntl |= CNTL_BEBO; 746 + #endif 747 + fb->panel->width = -1; 748 + fb->panel->height = -1; 749 + 750 + if (of_property_read_u32_array(endpoint, 751 + "arm,pl11x,tft-r0g0b0-pads", 752 + tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) != 0) 753 + return -ENOENT; 754 + 755 + return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0], 756 + tft_r0b0g0[1], tft_r0b0g0[2]); 757 + } 758 + 759 + static int clcdfb_of_vram_setup(struct clcd_fb *fb) 760 + { 761 + int err; 762 + struct device_node *memory; 763 + u64 size; 764 + 765 + err = clcdfb_of_init_display(fb); 766 + if (err) 767 + return err; 768 + 769 + memory = of_parse_phandle(fb->dev->dev.of_node, "memory-region", 0); 770 + if (!memory) 771 + return -ENODEV; 772 + 773 + fb->fb.screen_base = of_iomap(memory, 0); 774 + if (!fb->fb.screen_base) 775 + return -ENOMEM; 776 + 777 + fb->fb.fix.smem_start = of_translate_address(memory, 778 + of_get_address(memory, 0, &size, NULL)); 779 + fb->fb.fix.smem_len = size; 780 + 781 + return 0; 782 + } 783 + 784 + static int clcdfb_of_vram_mmap(struct clcd_fb *fb, struct vm_area_struct *vma) 785 + { 786 + unsigned long off, user_size, kernel_size; 787 + 788 + 789 + off = vma->vm_pgoff << PAGE_SHIFT; 790 + user_size = vma->vm_end - vma->vm_start; 791 + kernel_size = fb->fb.fix.smem_len; 792 + 793 + if (off >= kernel_size || user_size > (kernel_size - off)) 794 + return -ENXIO; 795 + 796 + return remap_pfn_range(vma, vma->vm_start, 797 + __phys_to_pfn(fb->fb.fix.smem_start) + vma->vm_pgoff, 798 + user_size, 799 + pgprot_writecombine(vma->vm_page_prot)); 800 + } 801 + 802 + static void clcdfb_of_vram_remove(struct clcd_fb *fb) 803 + { 804 + iounmap(fb->fb.screen_base); 805 + } 806 + 807 + static int clcdfb_of_dma_setup(struct clcd_fb *fb) 808 + { 809 + unsigned long framesize; 810 + dma_addr_t dma; 811 + int err; 812 + 813 + err = clcdfb_of_init_display(fb); 814 + if (err) 815 + return err; 816 + 817 + framesize = PAGE_ALIGN(fb->panel->mode.xres * fb->panel->mode.yres * 818 + fb->panel->bpp / 8); 819 + fb->fb.screen_base = dma_alloc_coherent(&fb->dev->dev, framesize, 820 + &dma, GFP_KERNEL); 821 + if (!fb->fb.screen_base) 822 + return -ENOMEM; 823 + 824 + fb->fb.fix.smem_start = dma; 825 + fb->fb.fix.smem_len = framesize; 826 + 827 + return 0; 828 + } 829 + 830 + static int clcdfb_of_dma_mmap(struct clcd_fb *fb, struct vm_area_struct *vma) 831 + { 832 + return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base, 833 + fb->fb.fix.smem_start, fb->fb.fix.smem_len); 834 + } 835 + 836 + static void clcdfb_of_dma_remove(struct clcd_fb *fb) 837 + { 838 + dma_free_coherent(&fb->dev->dev, fb->fb.fix.smem_len, 839 + fb->fb.screen_base, fb->fb.fix.smem_start); 840 + } 841 + 842 + static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev) 843 + { 844 + struct clcd_board *board = devm_kzalloc(&dev->dev, sizeof(*board), 845 + GFP_KERNEL); 846 + struct device_node *node = dev->dev.of_node; 847 + 848 + if (!board) 849 + return NULL; 850 + 851 + board->name = of_node_full_name(node); 852 + board->caps = CLCD_CAP_ALL; 853 + board->check = clcdfb_check; 854 + board->decode = clcdfb_decode; 855 + if (of_find_property(node, "memory-region", NULL)) { 856 + board->setup = clcdfb_of_vram_setup; 857 + board->mmap = clcdfb_of_vram_mmap; 858 + board->remove = clcdfb_of_vram_remove; 859 + } else { 860 + board->setup = clcdfb_of_dma_setup; 861 + board->mmap = clcdfb_of_dma_mmap; 862 + board->remove = clcdfb_of_dma_remove; 863 + } 864 + 865 + return board; 866 + } 867 + #else 868 + static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev) 869 + { 870 + return NULL; 871 + } 872 + #endif 873 + 874 + static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id) 875 + { 876 + struct clcd_board *board = dev_get_platdata(&dev->dev); 877 + struct clcd_fb *fb; 878 + int ret; 879 + 880 + if (!board) 881 + board = clcdfb_of_get_board(dev); 882 + 883 + if (!board) 884 + return -EINVAL; 885 + 886 + ret = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); 887 + if (ret) 888 + goto out; 889 + 890 + ret = amba_request_regions(dev, NULL); 891 + if (ret) { 892 + printk(KERN_ERR "CLCD: unable to reserve regs region\n"); 893 + goto out; 894 + } 895 + 896 + fb = kzalloc(sizeof(*fb), GFP_KERNEL); 897 + if (!fb) { 898 + ret = -ENOMEM; 899 + goto free_region; 900 + } 901 + 902 + fb->dev = dev; 903 + fb->board = board; 904 + 905 + dev_info(&fb->dev->dev, "PL%03x designer %02x rev%u at 0x%08llx\n", 906 + amba_part(dev), amba_manf(dev), amba_rev(dev), 907 + (unsigned long long)dev->res.start); 908 + 909 + ret = fb->board->setup(fb); 910 + if (ret) 911 + goto free_fb; 912 + 913 + ret = clcdfb_register(fb); 914 + if (ret == 0) { 915 + amba_set_drvdata(dev, fb); 916 + goto out; 917 + } 918 + 919 + fb->board->remove(fb); 920 + free_fb: 921 + kfree(fb); 922 + free_region: 923 + amba_release_regions(dev); 924 + out: 925 + return ret; 926 + } 927 + 928 + static int clcdfb_remove(struct amba_device *dev) 929 + { 930 + struct clcd_fb *fb = amba_get_drvdata(dev); 931 + 932 + clcdfb_disable(fb); 933 + unregister_framebuffer(&fb->fb); 934 + if (fb->fb.cmap.len) 935 + fb_dealloc_cmap(&fb->fb.cmap); 936 + iounmap(fb->regs); 937 + clk_unprepare(fb->clk); 938 + clk_put(fb->clk); 939 + 940 + fb->board->remove(fb); 941 + 942 + kfree(fb); 943 + 944 + amba_release_regions(dev); 945 + 946 + return 0; 947 + } 948 + 949 + static const struct amba_id clcdfb_id_table[] = { 950 + { 951 + .id = 0x00041110, 952 + .mask = 0x000ffffe, 953 + }, 954 + { 0, 0 }, 955 + }; 956 + 957 + MODULE_DEVICE_TABLE(amba, clcdfb_id_table); 958 + 959 + static struct amba_driver clcd_driver = { 960 + .drv = { 961 + .name = "clcd-pl11x", 962 + }, 963 + .probe = clcdfb_probe, 964 + .remove = clcdfb_remove, 965 + .id_table = clcdfb_id_table, 966 + }; 967 + 968 + static int __init amba_clcdfb_init(void) 969 + { 970 + if (fb_get_options("ambafb", NULL)) 971 + return -ENODEV; 972 + 973 + return amba_driver_register(&clcd_driver); 974 + } 975 + 976 + module_init(amba_clcdfb_init); 977 + 978 + static void __exit amba_clcdfb_exit(void) 979 + { 980 + amba_driver_unregister(&clcd_driver); 981 + } 982 + 983 + module_exit(amba_clcdfb_exit); 984 + 985 + MODULE_DESCRIPTION("ARM PrimeCell PL110 CLCD core driver"); 986 + MODULE_LICENSE("GPL");
+12
drivers/video/fbdev/core/fbcon.c
··· 2299 2299 2300 2300 if (font->width <= 8) { 2301 2301 j = vc->vc_font.height; 2302 + if (font->charcount * j > FNTSIZE(fontdata)) 2303 + return -EINVAL; 2304 + 2302 2305 for (i = 0; i < font->charcount; i++) { 2303 2306 memcpy(data, fontdata, j); 2304 2307 memset(data + j, 0, 32 - j); ··· 2310 2307 } 2311 2308 } else if (font->width <= 16) { 2312 2309 j = vc->vc_font.height * 2; 2310 + if (font->charcount * j > FNTSIZE(fontdata)) 2311 + return -EINVAL; 2312 + 2313 2313 for (i = 0; i < font->charcount; i++) { 2314 2314 memcpy(data, fontdata, j); 2315 2315 memset(data + j, 0, 64 - j); ··· 2320 2314 fontdata += j; 2321 2315 } 2322 2316 } else if (font->width <= 24) { 2317 + if (font->charcount * (vc->vc_font.height * sizeof(u32)) > FNTSIZE(fontdata)) 2318 + return -EINVAL; 2319 + 2323 2320 for (i = 0; i < font->charcount; i++) { 2324 2321 for (j = 0; j < vc->vc_font.height; j++) { 2325 2322 *data++ = fontdata[0]; ··· 2335 2326 } 2336 2327 } else { 2337 2328 j = vc->vc_font.height * 4; 2329 + if (font->charcount * j > FNTSIZE(fontdata)) 2330 + return -EINVAL; 2331 + 2338 2332 for (i = 0; i < font->charcount; i++) { 2339 2333 memcpy(data, fontdata, j); 2340 2334 memset(data + j, 0, 128 - j);
-7
drivers/video/fbdev/core/fbcon.h
··· 152 152 #define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0) 153 153 #define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1) 154 154 155 - /* Font */ 156 - #define REFCOUNT(fd) (((int *)(fd))[-1]) 157 - #define FNTSIZE(fd) (((int *)(fd))[-2]) 158 - #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 159 - #define FNTSUM(fd) (((int *)(fd))[-4]) 160 - #define FONT_EXTRA_WORDS 4 161 - 162 155 /* 163 156 * Scroll Method 164 157 */
+1
drivers/video/fbdev/core/fbcon_rotate.c
··· 14 14 #include <linux/fb.h> 15 15 #include <linux/vt_kern.h> 16 16 #include <linux/console.h> 17 + #include <linux/font.h> 17 18 #include <asm/types.h> 18 19 #include "fbcon.h" 19 20 #include "fbcon_rotate.h"
+1
drivers/video/fbdev/core/tileblit.c
··· 13 13 #include <linux/fb.h> 14 14 #include <linux/vt_kern.h> 15 15 #include <linux/console.h> 16 + #include <linux/font.h> 16 17 #include <asm/types.h> 17 18 #include "fbcon.h" 18 19
+38 -9
fs/afs/inode.c
··· 810 810 811 811 static void afs_setattr_success(struct afs_operation *op) 812 812 { 813 - struct inode *inode = &op->file[0].vnode->vfs_inode; 813 + struct afs_vnode_param *vp = &op->file[0]; 814 + struct inode *inode = &vp->vnode->vfs_inode; 815 + loff_t old_i_size = i_size_read(inode); 814 816 815 - afs_vnode_commit_status(op, &op->file[0]); 817 + op->setattr.old_i_size = old_i_size; 818 + afs_vnode_commit_status(op, vp); 819 + /* inode->i_size has now been changed. */ 820 + 816 821 if (op->setattr.attr->ia_valid & ATTR_SIZE) { 817 - loff_t i_size = inode->i_size, size = op->setattr.attr->ia_size; 818 - if (size > i_size) 819 - pagecache_isize_extended(inode, i_size, size); 820 - truncate_pagecache(inode, size); 822 + loff_t size = op->setattr.attr->ia_size; 823 + if (size > old_i_size) 824 + pagecache_isize_extended(inode, old_i_size, size); 825 + } 826 + } 827 + 828 + static void afs_setattr_edit_file(struct afs_operation *op) 829 + { 830 + struct afs_vnode_param *vp = &op->file[0]; 831 + struct inode *inode = &vp->vnode->vfs_inode; 832 + 833 + if (op->setattr.attr->ia_valid & ATTR_SIZE) { 834 + loff_t size = op->setattr.attr->ia_size; 835 + loff_t i_size = op->setattr.old_i_size; 836 + 837 + if (size < i_size) 838 + truncate_pagecache(inode, size); 821 839 } 822 840 } 823 841 ··· 843 825 .issue_afs_rpc = afs_fs_setattr, 844 826 .issue_yfs_rpc = yfs_fs_setattr, 845 827 .success = afs_setattr_success, 828 + .edit_dir = afs_setattr_edit_file, 846 829 }; 847 830 848 831 /* ··· 882 863 if (S_ISREG(vnode->vfs_inode.i_mode)) 883 864 filemap_write_and_wait(vnode->vfs_inode.i_mapping); 884 865 866 + /* Prevent any new writebacks from starting whilst we do this. */ 867 + down_write(&vnode->validate_lock); 868 + 885 869 op = afs_alloc_operation(((attr->ia_valid & ATTR_FILE) ? 886 870 afs_file_key(attr->ia_file) : NULL), 887 871 vnode->volume); 888 - if (IS_ERR(op)) 889 - return PTR_ERR(op); 872 + if (IS_ERR(op)) { 873 + ret = PTR_ERR(op); 874 + goto out_unlock; 875 + } 890 876 891 877 afs_op_set_vnode(op, 0, vnode); 892 878 op->setattr.attr = attr; ··· 904 880 op->file[0].update_ctime = 1; 905 881 906 882 op->ops = &afs_setattr_operation; 907 - return afs_do_sync_operation(op); 883 + ret = afs_do_sync_operation(op); 884 + 885 + out_unlock: 886 + up_write(&vnode->validate_lock); 887 + _leave(" = %d", ret); 888 + return ret; 908 889 }
+1
fs/afs/internal.h
··· 812 812 } store; 813 813 struct { 814 814 struct iattr *attr; 815 + loff_t old_i_size; 815 816 } setattr; 816 817 struct afs_acl *acl; 817 818 struct yfs_acl *yacl;
+11
fs/afs/write.c
··· 738 738 int afs_writepages(struct address_space *mapping, 739 739 struct writeback_control *wbc) 740 740 { 741 + struct afs_vnode *vnode = AFS_FS_I(mapping->host); 741 742 pgoff_t start, end, next; 742 743 int ret; 743 744 744 745 _enter(""); 746 + 747 + /* We have to be careful as we can end up racing with setattr() 748 + * truncating the pagecache since the caller doesn't take a lock here 749 + * to prevent it. 750 + */ 751 + if (wbc->sync_mode == WB_SYNC_ALL) 752 + down_read(&vnode->validate_lock); 753 + else if (!down_read_trylock(&vnode->validate_lock)) 754 + return 0; 745 755 746 756 if (wbc->range_cyclic) { 747 757 start = mapping->writeback_index; ··· 772 762 ret = afs_writepages_region(mapping, wbc, start, end, &next); 773 763 } 774 764 765 + up_read(&vnode->validate_lock); 775 766 _leave(" = %d", ret); 776 767 return ret; 777 768 }
-11
fs/exfat/cache.c
··· 17 17 #include "exfat_raw.h" 18 18 #include "exfat_fs.h" 19 19 20 - #define EXFAT_CACHE_VALID 0 21 20 #define EXFAT_MAX_CACHE 16 22 21 23 22 struct exfat_cache { ··· 58 59 if (!exfat_cachep) 59 60 return; 60 61 kmem_cache_destroy(exfat_cachep); 61 - } 62 - 63 - void exfat_cache_init_inode(struct inode *inode) 64 - { 65 - struct exfat_inode_info *ei = EXFAT_I(inode); 66 - 67 - spin_lock_init(&ei->cache_lru_lock); 68 - ei->nr_caches = 0; 69 - ei->cache_valid_id = EXFAT_CACHE_VALID + 1; 70 - INIT_LIST_HEAD(&ei->cache_lru); 71 62 } 72 63 73 64 static inline struct exfat_cache *exfat_cache_alloc(void)
+2 -1
fs/exfat/exfat_fs.h
··· 248 248 struct rcu_head rcu; 249 249 }; 250 250 251 + #define EXFAT_CACHE_VALID 0 252 + 251 253 /* 252 254 * EXFAT file system inode in-memory data 253 255 */ ··· 430 428 /* cache.c */ 431 429 int exfat_cache_init(void); 432 430 void exfat_cache_shutdown(void); 433 - void exfat_cache_init_inode(struct inode *inode); 434 431 void exfat_cache_inval_inode(struct inode *inode); 435 432 int exfat_get_cluster(struct inode *inode, unsigned int cluster, 436 433 unsigned int *fclus, unsigned int *dclus,
-2
fs/exfat/inode.c
··· 611 611 ei->i_crtime = info->crtime; 612 612 inode->i_atime = info->atime; 613 613 614 - exfat_cache_init_inode(inode); 615 - 616 614 return 0; 617 615 } 618 616
+6 -7
fs/exfat/namei.c
··· 578 578 579 579 i_pos = exfat_make_i_pos(&info); 580 580 inode = exfat_build_inode(sb, &info, i_pos); 581 - if (IS_ERR(inode)) 581 + err = PTR_ERR_OR_ZERO(inode); 582 + if (err) 582 583 goto unlock; 583 584 584 585 inode_inc_iversion(inode); ··· 746 745 747 746 i_pos = exfat_make_i_pos(&info); 748 747 inode = exfat_build_inode(sb, &info, i_pos); 749 - if (IS_ERR(inode)) { 750 - err = PTR_ERR(inode); 748 + err = PTR_ERR_OR_ZERO(inode); 749 + if (err) 751 750 goto unlock; 752 - } 753 751 754 752 i_mode = inode->i_mode; 755 753 alias = d_find_alias(inode); ··· 890 890 891 891 i_pos = exfat_make_i_pos(&info); 892 892 inode = exfat_build_inode(sb, &info, i_pos); 893 - if (IS_ERR(inode)) { 894 - err = PTR_ERR(inode); 893 + err = PTR_ERR_OR_ZERO(inode); 894 + if (err) 895 895 goto unlock; 896 - } 897 896 898 897 inode_inc_iversion(inode); 899 898 inode->i_mtime = inode->i_atime = inode->i_ctime =
+4 -1
fs/exfat/super.c
··· 376 376 inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = 377 377 current_time(inode); 378 378 exfat_truncate_atime(&inode->i_atime); 379 - exfat_cache_init_inode(inode); 380 379 return 0; 381 380 } 382 381 ··· 762 763 { 763 764 struct exfat_inode_info *ei = (struct exfat_inode_info *)foo; 764 765 766 + spin_lock_init(&ei->cache_lru_lock); 767 + ei->nr_caches = 0; 768 + ei->cache_valid_id = EXFAT_CACHE_VALID + 1; 769 + INIT_LIST_HEAD(&ei->cache_lru); 765 770 INIT_HLIST_NODE(&ei->i_hash_fat); 766 771 inode_init_once(&ei->vfs_inode); 767 772 }
+20
fs/splice.c
··· 526 526 return 1; 527 527 } 528 528 529 + /* We know we have a pipe buffer, but maybe it's empty? */ 530 + static inline bool eat_empty_buffer(struct pipe_inode_info *pipe) 531 + { 532 + unsigned int tail = pipe->tail; 533 + unsigned int mask = pipe->ring_size - 1; 534 + struct pipe_buffer *buf = &pipe->bufs[tail & mask]; 535 + 536 + if (unlikely(!buf->len)) { 537 + pipe_buf_release(pipe, buf); 538 + pipe->tail = tail+1; 539 + return true; 540 + } 541 + 542 + return false; 543 + } 544 + 529 545 /** 530 546 * splice_from_pipe_next - wait for some data to splice from 531 547 * @pipe: pipe to splice from ··· 561 545 if (signal_pending(current)) 562 546 return -ERESTARTSYS; 563 547 548 + repeat: 564 549 while (pipe_empty(pipe->head, pipe->tail)) { 565 550 if (!pipe->writers) 566 551 return 0; ··· 582 565 583 566 pipe_wait_readable(pipe); 584 567 } 568 + 569 + if (eat_empty_buffer(pipe)) 570 + goto repeat; 585 571 586 572 return 1; 587 573 }
+1 -1
include/drm/drm_dsc.h
··· 588 588 * This structure represents the DSC PPS infoframe required to send the Picture 589 589 * Parameter Set metadata required before enabling VESA Display Stream 590 590 * Compression. This is based on the DP Secondary Data Packet structure and 591 - * comprises of SDP Header as defined &struct struct dp_sdp_header in drm_dp_helper.h 591 + * comprises of SDP Header as defined &struct dp_sdp_header in drm_dp_helper.h 592 592 * and PPS payload defined in &struct drm_dsc_picture_parameter_set. 593 593 * 594 594 * @pps_header: Header for PPS as per DP SDP header format of type
+87
include/linux/amba/clcd-regs.h
··· 1 + /* 2 + * David A Rusling 3 + * 4 + * Copyright (C) 2001 ARM Limited 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file COPYING in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #ifndef AMBA_CLCD_REGS_H 12 + #define AMBA_CLCD_REGS_H 13 + 14 + /* 15 + * CLCD Controller Internal Register addresses 16 + */ 17 + #define CLCD_TIM0 0x00000000 18 + #define CLCD_TIM1 0x00000004 19 + #define CLCD_TIM2 0x00000008 20 + #define CLCD_TIM3 0x0000000c 21 + #define CLCD_UBAS 0x00000010 22 + #define CLCD_LBAS 0x00000014 23 + 24 + #define CLCD_PL110_IENB 0x00000018 25 + #define CLCD_PL110_CNTL 0x0000001c 26 + #define CLCD_PL110_STAT 0x00000020 27 + #define CLCD_PL110_INTR 0x00000024 28 + #define CLCD_PL110_UCUR 0x00000028 29 + #define CLCD_PL110_LCUR 0x0000002C 30 + 31 + #define CLCD_PL111_CNTL 0x00000018 32 + #define CLCD_PL111_IENB 0x0000001c 33 + #define CLCD_PL111_RIS 0x00000020 34 + #define CLCD_PL111_MIS 0x00000024 35 + #define CLCD_PL111_ICR 0x00000028 36 + #define CLCD_PL111_UCUR 0x0000002c 37 + #define CLCD_PL111_LCUR 0x00000030 38 + 39 + #define CLCD_PALL 0x00000200 40 + #define CLCD_PALETTE 0x00000200 41 + 42 + #define TIM2_PCD_LO_MASK GENMASK(4, 0) 43 + #define TIM2_PCD_LO_BITS 5 44 + #define TIM2_CLKSEL (1 << 5) 45 + #define TIM2_ACB_MASK GENMASK(10, 6) 46 + #define TIM2_IVS (1 << 11) 47 + #define TIM2_IHS (1 << 12) 48 + #define TIM2_IPC (1 << 13) 49 + #define TIM2_IOE (1 << 14) 50 + #define TIM2_BCD (1 << 26) 51 + #define TIM2_PCD_HI_MASK GENMASK(31, 27) 52 + #define TIM2_PCD_HI_BITS 5 53 + #define TIM2_PCD_HI_SHIFT 27 54 + 55 + #define CNTL_LCDEN (1 << 0) 56 + #define CNTL_LCDBPP1 (0 << 1) 57 + #define CNTL_LCDBPP2 (1 << 1) 58 + #define CNTL_LCDBPP4 (2 << 1) 59 + #define CNTL_LCDBPP8 (3 << 1) 60 + #define CNTL_LCDBPP16 (4 << 1) 61 + #define CNTL_LCDBPP16_565 (6 << 1) 62 + #define CNTL_LCDBPP16_444 (7 << 1) 63 + #define CNTL_LCDBPP24 (5 << 1) 64 + #define CNTL_LCDBW (1 << 4) 65 + #define CNTL_LCDTFT (1 << 5) 66 + #define CNTL_LCDMONO8 (1 << 6) 67 + #define CNTL_LCDDUAL (1 << 7) 68 + #define CNTL_BGR (1 << 8) 69 + #define CNTL_BEBO (1 << 9) 70 + #define CNTL_BEPO (1 << 10) 71 + #define CNTL_LCDPWR (1 << 11) 72 + #define CNTL_LCDVCOMP(x) ((x) << 12) 73 + #define CNTL_LDMAFIFOTIME (1 << 15) 74 + #define CNTL_WATERMARK (1 << 16) 75 + 76 + /* ST Microelectronics variant bits */ 77 + #define CNTL_ST_1XBPP_444 0x0 78 + #define CNTL_ST_1XBPP_5551 (1 << 17) 79 + #define CNTL_ST_1XBPP_565 (1 << 18) 80 + #define CNTL_ST_CDWID_12 0x0 81 + #define CNTL_ST_CDWID_16 (1 << 19) 82 + #define CNTL_ST_CDWID_18 (1 << 20) 83 + #define CNTL_ST_CDWID_24 ((1 << 19)|(1 << 20)) 84 + #define CNTL_ST_CEAEN (1 << 21) 85 + #define CNTL_ST_LCDBPP24_PACKED (6 << 1) 86 + 87 + #endif /* AMBA_CLCD_REGS_H */
+290
include/linux/amba/clcd.h
··· 1 + /* 2 + * linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel. 3 + * 4 + * David A Rusling 5 + * 6 + * Copyright (C) 2001 ARM Limited 7 + * 8 + * This file is subject to the terms and conditions of the GNU General Public 9 + * License. See the file COPYING in the main directory of this archive 10 + * for more details. 11 + */ 12 + #include <linux/fb.h> 13 + #include <linux/amba/clcd-regs.h> 14 + 15 + enum { 16 + /* individual formats */ 17 + CLCD_CAP_RGB444 = (1 << 0), 18 + CLCD_CAP_RGB5551 = (1 << 1), 19 + CLCD_CAP_RGB565 = (1 << 2), 20 + CLCD_CAP_RGB888 = (1 << 3), 21 + CLCD_CAP_BGR444 = (1 << 4), 22 + CLCD_CAP_BGR5551 = (1 << 5), 23 + CLCD_CAP_BGR565 = (1 << 6), 24 + CLCD_CAP_BGR888 = (1 << 7), 25 + 26 + /* connection layouts */ 27 + CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444, 28 + CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551, 29 + CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565, 30 + CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888, 31 + 32 + /* red/blue ordering */ 33 + CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 | 34 + CLCD_CAP_RGB565 | CLCD_CAP_RGB888, 35 + CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 | 36 + CLCD_CAP_BGR565 | CLCD_CAP_BGR888, 37 + 38 + CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB, 39 + }; 40 + 41 + struct backlight_device; 42 + 43 + struct clcd_panel { 44 + struct fb_videomode mode; 45 + signed short width; /* width in mm */ 46 + signed short height; /* height in mm */ 47 + u32 tim2; 48 + u32 tim3; 49 + u32 cntl; 50 + u32 caps; 51 + unsigned int bpp:8, 52 + fixedtimings:1, 53 + grayscale:1; 54 + unsigned int connector; 55 + struct backlight_device *backlight; 56 + /* 57 + * If the B/R lines are switched between the CLCD 58 + * and the panel we need to know this and not try to 59 + * compensate with the BGR bit in the control register. 60 + */ 61 + bool bgr_connection; 62 + }; 63 + 64 + struct clcd_regs { 65 + u32 tim0; 66 + u32 tim1; 67 + u32 tim2; 68 + u32 tim3; 69 + u32 cntl; 70 + unsigned long pixclock; 71 + }; 72 + 73 + struct clcd_fb; 74 + 75 + /* 76 + * the board-type specific routines 77 + */ 78 + struct clcd_board { 79 + const char *name; 80 + 81 + /* 82 + * Optional. Hardware capability flags. 83 + */ 84 + u32 caps; 85 + 86 + /* 87 + * Optional. Check whether the var structure is acceptable 88 + * for this display. 89 + */ 90 + int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var); 91 + 92 + /* 93 + * Compulsory. Decode fb->fb.var into regs->*. In the case of 94 + * fixed timing, set regs->* to the register values required. 95 + */ 96 + void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs); 97 + 98 + /* 99 + * Optional. Disable any extra display hardware. 100 + */ 101 + void (*disable)(struct clcd_fb *); 102 + 103 + /* 104 + * Optional. Enable any extra display hardware. 105 + */ 106 + void (*enable)(struct clcd_fb *); 107 + 108 + /* 109 + * Setup platform specific parts of CLCD driver 110 + */ 111 + int (*setup)(struct clcd_fb *); 112 + 113 + /* 114 + * mmap the framebuffer memory 115 + */ 116 + int (*mmap)(struct clcd_fb *, struct vm_area_struct *); 117 + 118 + /* 119 + * Remove platform specific parts of CLCD driver 120 + */ 121 + void (*remove)(struct clcd_fb *); 122 + }; 123 + 124 + struct amba_device; 125 + struct clk; 126 + 127 + /* this data structure describes each frame buffer device we find */ 128 + struct clcd_fb { 129 + struct fb_info fb; 130 + struct amba_device *dev; 131 + struct clk *clk; 132 + struct clcd_panel *panel; 133 + struct clcd_board *board; 134 + void *board_data; 135 + void __iomem *regs; 136 + u16 off_ienb; 137 + u16 off_cntl; 138 + u32 clcd_cntl; 139 + u32 cmap[16]; 140 + bool clk_enabled; 141 + }; 142 + 143 + static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 144 + { 145 + struct fb_var_screeninfo *var = &fb->fb.var; 146 + u32 val, cpl; 147 + 148 + /* 149 + * Program the CLCD controller registers and start the CLCD 150 + */ 151 + val = ((var->xres / 16) - 1) << 2; 152 + val |= (var->hsync_len - 1) << 8; 153 + val |= (var->right_margin - 1) << 16; 154 + val |= (var->left_margin - 1) << 24; 155 + regs->tim0 = val; 156 + 157 + val = var->yres; 158 + if (fb->panel->cntl & CNTL_LCDDUAL) 159 + val /= 2; 160 + val -= 1; 161 + val |= (var->vsync_len - 1) << 10; 162 + val |= var->lower_margin << 16; 163 + val |= var->upper_margin << 24; 164 + regs->tim1 = val; 165 + 166 + val = fb->panel->tim2; 167 + val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS; 168 + val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS; 169 + 170 + cpl = var->xres_virtual; 171 + if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */ 172 + /* / 1 */; 173 + else if (!var->grayscale) /* STN color */ 174 + cpl = cpl * 8 / 3; 175 + else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */ 176 + cpl /= 8; 177 + else /* STN monochrome, 4bit */ 178 + cpl /= 4; 179 + 180 + regs->tim2 = val | ((cpl - 1) << 16); 181 + 182 + regs->tim3 = fb->panel->tim3; 183 + 184 + val = fb->panel->cntl; 185 + if (var->grayscale) 186 + val |= CNTL_LCDBW; 187 + 188 + if (fb->panel->caps && fb->board->caps && var->bits_per_pixel >= 16) { 189 + /* 190 + * if board and panel supply capabilities, we can support 191 + * changing BGR/RGB depending on supplied parameters. Here 192 + * we switch to what the framebuffer is providing if need 193 + * be, so if the framebuffer is BGR but the display connection 194 + * is RGB (first case) we switch it around. Vice versa mutatis 195 + * mutandis if the framebuffer is RGB but the display connection 196 + * is BGR, we flip it around. 197 + */ 198 + if (var->red.offset == 0) 199 + val &= ~CNTL_BGR; 200 + else 201 + val |= CNTL_BGR; 202 + if (fb->panel->bgr_connection) 203 + val ^= CNTL_BGR; 204 + } 205 + 206 + switch (var->bits_per_pixel) { 207 + case 1: 208 + val |= CNTL_LCDBPP1; 209 + break; 210 + case 2: 211 + val |= CNTL_LCDBPP2; 212 + break; 213 + case 4: 214 + val |= CNTL_LCDBPP4; 215 + break; 216 + case 8: 217 + val |= CNTL_LCDBPP8; 218 + break; 219 + case 16: 220 + /* 221 + * PL110 cannot choose between 5551 and 565 modes in its 222 + * control register. It is possible to use 565 with 223 + * custom external wiring. 224 + */ 225 + if (amba_part(fb->dev) == 0x110 || 226 + var->green.length == 5) 227 + val |= CNTL_LCDBPP16; 228 + else if (var->green.length == 6) 229 + val |= CNTL_LCDBPP16_565; 230 + else 231 + val |= CNTL_LCDBPP16_444; 232 + break; 233 + case 32: 234 + val |= CNTL_LCDBPP24; 235 + break; 236 + } 237 + 238 + regs->cntl = val; 239 + regs->pixclock = var->pixclock; 240 + } 241 + 242 + static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) 243 + { 244 + var->xres_virtual = var->xres = (var->xres + 15) & ~15; 245 + var->yres_virtual = var->yres = (var->yres + 1) & ~1; 246 + 247 + #define CHECK(e,l,h) (var->e < l || var->e > h) 248 + if (CHECK(right_margin, (5+1), 256) || /* back porch */ 249 + CHECK(left_margin, (5+1), 256) || /* front porch */ 250 + CHECK(hsync_len, (5+1), 256) || 251 + var->xres > 4096 || 252 + var->lower_margin > 255 || /* back porch */ 253 + var->upper_margin > 255 || /* front porch */ 254 + var->vsync_len > 32 || 255 + var->yres > 1024) 256 + return -EINVAL; 257 + #undef CHECK 258 + 259 + /* single panel mode: PCD = max(PCD, 1) */ 260 + /* dual panel mode: PCD = max(PCD, 5) */ 261 + 262 + /* 263 + * You can't change the grayscale setting, and 264 + * we can only do non-interlaced video. 265 + */ 266 + if (var->grayscale != fb->fb.var.grayscale || 267 + (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) 268 + return -EINVAL; 269 + 270 + #define CHECK(e) (var->e != fb->fb.var.e) 271 + if (fb->panel->fixedtimings && 272 + (CHECK(xres) || 273 + CHECK(yres) || 274 + CHECK(bits_per_pixel) || 275 + CHECK(pixclock) || 276 + CHECK(left_margin) || 277 + CHECK(right_margin) || 278 + CHECK(upper_margin) || 279 + CHECK(lower_margin) || 280 + CHECK(hsync_len) || 281 + CHECK(vsync_len) || 282 + CHECK(sync))) 283 + return -EINVAL; 284 + #undef CHECK 285 + 286 + var->nonstd = 0; 287 + var->accel_flags = 0; 288 + 289 + return 0; 290 + }
+13
include/linux/font.h
··· 59 59 /* Max. length for the name of a predefined font */ 60 60 #define MAX_FONT_NAME 32 61 61 62 + /* Extra word getters */ 63 + #define REFCOUNT(fd) (((int *)(fd))[-1]) 64 + #define FNTSIZE(fd) (((int *)(fd))[-2]) 65 + #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 66 + #define FNTSUM(fd) (((int *)(fd))[-4]) 67 + 68 + #define FONT_EXTRA_WORDS 4 69 + 70 + struct font_data { 71 + unsigned int extra[FONT_EXTRA_WORDS]; 72 + const unsigned char data[]; 73 + } __packed; 74 + 62 75 #endif /* _VIDEO_FONT_H */
+1 -1
include/uapi/linux/rxrpc.h
··· 51 51 RXRPC_BUSY = 6, /* -r: server busy received [terminal] */ 52 52 RXRPC_LOCAL_ERROR = 7, /* -r: local error generated [terminal] */ 53 53 RXRPC_NEW_CALL = 8, /* -r: [Service] new incoming call notification */ 54 - RXRPC_ACCEPT = 9, /* s-: [Service] accept request */ 55 54 RXRPC_EXCLUSIVE_CALL = 10, /* s-: Call should be on exclusive connection */ 56 55 RXRPC_UPGRADE_SERVICE = 11, /* s-: Request service upgrade for client call */ 57 56 RXRPC_TX_LENGTH = 12, /* s-: Total length of Tx data */ 58 57 RXRPC_SET_CALL_TIMEOUT = 13, /* s-: Set one or more call timeouts */ 58 + RXRPC_CHARGE_ACCEPT = 14, /* s-: Charge the accept pool with a user call ID */ 59 59 RXRPC__SUPPORTED 60 60 }; 61 61
+3
include/xen/arm/page.h
··· 83 83 }) 84 84 #define gfn_to_virt(m) (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT)) 85 85 86 + #define percpu_to_gfn(v) \ 87 + (pfn_to_gfn(per_cpu_ptr_to_phys(v) >> XEN_PAGE_SHIFT)) 88 + 86 89 /* Only used in PV code. But ARM guests are always HVM. */ 87 90 static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr) 88 91 {
+4 -4
kernel/bpf/verifier.c
··· 5880 5880 bool src_known = tnum_subreg_is_const(src_reg->var_off); 5881 5881 bool dst_known = tnum_subreg_is_const(dst_reg->var_off); 5882 5882 struct tnum var32_off = tnum_subreg(dst_reg->var_off); 5883 - s32 smin_val = src_reg->smin_value; 5884 - u32 umin_val = src_reg->umin_value; 5883 + s32 smin_val = src_reg->s32_min_value; 5884 + u32 umin_val = src_reg->u32_min_value; 5885 5885 5886 5886 /* Assuming scalar64_min_max_or will be called so it is safe 5887 5887 * to skip updating register for known case. ··· 5904 5904 /* ORing two positives gives a positive, so safe to 5905 5905 * cast result into s64. 5906 5906 */ 5907 - dst_reg->s32_min_value = dst_reg->umin_value; 5908 - dst_reg->s32_max_value = dst_reg->umax_value; 5907 + dst_reg->s32_min_value = dst_reg->u32_min_value; 5908 + dst_reg->s32_max_value = dst_reg->u32_max_value; 5909 5909 } 5910 5910 } 5911 5911
+9
kernel/umh.c
··· 14 14 #include <linux/cred.h> 15 15 #include <linux/file.h> 16 16 #include <linux/fdtable.h> 17 + #include <linux/fs_struct.h> 17 18 #include <linux/workqueue.h> 18 19 #include <linux/security.h> 19 20 #include <linux/mount.h> ··· 71 70 spin_lock_irq(&current->sighand->siglock); 72 71 flush_signal_handlers(current, 1); 73 72 spin_unlock_irq(&current->sighand->siglock); 73 + 74 + /* 75 + * Initial kernel threads share ther FS with init, in order to 76 + * get the init root directory. But we've now created a new 77 + * thread that is going to execve a user process and has its own 78 + * 'struct fs_struct'. Reset umask to the default. 79 + */ 80 + current->fs->umask = 0022; 74 81 75 82 /* 76 83 * Our parent (unbound workqueue) runs with elevated scheduling
+4 -5
lib/fonts/font_10x18.c
··· 8 8 9 9 #define FONTDATAMAX 9216 10 10 11 - static const unsigned char fontdata_10x18[FONTDATAMAX] = { 12 - 11 + static struct font_data fontdata_10x18 = { 12 + { 0, 0, FONTDATAMAX, 0 }, { 13 13 /* 0 0x00 '^@' */ 14 14 0x00, 0x00, /* 0000000000 */ 15 15 0x00, 0x00, /* 0000000000 */ ··· 5129 5129 0x00, 0x00, /* 0000000000 */ 5130 5130 0x00, 0x00, /* 0000000000 */ 5131 5131 0x00, 0x00, /* 0000000000 */ 5132 - 5133 - }; 5132 + } }; 5134 5133 5135 5134 5136 5135 const struct font_desc font_10x18 = { ··· 5137 5138 .name = "10x18", 5138 5139 .width = 10, 5139 5140 .height = 18, 5140 - .data = fontdata_10x18, 5141 + .data = fontdata_10x18.data, 5141 5142 #ifdef __sparc__ 5142 5143 .pref = 5, 5143 5144 #else
+5 -4
lib/fonts/font_6x10.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/font.h> 3 3 4 - static const unsigned char fontdata_6x10[] = { 4 + #define FONTDATAMAX 2560 5 5 6 + static struct font_data fontdata_6x10 = { 7 + { 0, 0, FONTDATAMAX, 0 }, { 6 8 /* 0 0x00 '^@' */ 7 9 0x00, /* 00000000 */ 8 10 0x00, /* 00000000 */ ··· 3076 3074 0x00, /* 00000000 */ 3077 3075 0x00, /* 00000000 */ 3078 3076 0x00, /* 00000000 */ 3079 - 3080 - }; 3077 + } }; 3081 3078 3082 3079 const struct font_desc font_6x10 = { 3083 3080 .idx = FONT6x10_IDX, 3084 3081 .name = "6x10", 3085 3082 .width = 6, 3086 3083 .height = 10, 3087 - .data = fontdata_6x10, 3084 + .data = fontdata_6x10.data, 3088 3085 .pref = 0, 3089 3086 };
+4 -5
lib/fonts/font_6x11.c
··· 9 9 10 10 #define FONTDATAMAX (11*256) 11 11 12 - static const unsigned char fontdata_6x11[FONTDATAMAX] = { 13 - 12 + static struct font_data fontdata_6x11 = { 13 + { 0, 0, FONTDATAMAX, 0 }, { 14 14 /* 0 0x00 '^@' */ 15 15 0x00, /* 00000000 */ 16 16 0x00, /* 00000000 */ ··· 3338 3338 0x00, /* 00000000 */ 3339 3339 0x00, /* 00000000 */ 3340 3340 0x00, /* 00000000 */ 3341 - 3342 - }; 3341 + } }; 3343 3342 3344 3343 3345 3344 const struct font_desc font_vga_6x11 = { ··· 3346 3347 .name = "ProFont6x11", 3347 3348 .width = 6, 3348 3349 .height = 11, 3349 - .data = fontdata_6x11, 3350 + .data = fontdata_6x11.data, 3350 3351 /* Try avoiding this font if possible unless on MAC */ 3351 3352 .pref = -2000, 3352 3353 };
+4 -5
lib/fonts/font_7x14.c
··· 8 8 9 9 #define FONTDATAMAX 3584 10 10 11 - static const unsigned char fontdata_7x14[FONTDATAMAX] = { 12 - 11 + static struct font_data fontdata_7x14 = { 12 + { 0, 0, FONTDATAMAX, 0 }, { 13 13 /* 0 0x00 '^@' */ 14 14 0x00, /* 0000000 */ 15 15 0x00, /* 0000000 */ ··· 4105 4105 0x00, /* 0000000 */ 4106 4106 0x00, /* 0000000 */ 4107 4107 0x00, /* 0000000 */ 4108 - 4109 - }; 4108 + } }; 4110 4109 4111 4110 4112 4111 const struct font_desc font_7x14 = { ··· 4113 4114 .name = "7x14", 4114 4115 .width = 7, 4115 4116 .height = 14, 4116 - .data = fontdata_7x14, 4117 + .data = fontdata_7x14.data, 4117 4118 .pref = 0, 4118 4119 };
+4 -5
lib/fonts/font_8x16.c
··· 10 10 11 11 #define FONTDATAMAX 4096 12 12 13 - static const unsigned char fontdata_8x16[FONTDATAMAX] = { 14 - 13 + static struct font_data fontdata_8x16 = { 14 + { 0, 0, FONTDATAMAX, 0 }, { 15 15 /* 0 0x00 '^@' */ 16 16 0x00, /* 00000000 */ 17 17 0x00, /* 00000000 */ ··· 4619 4619 0x00, /* 00000000 */ 4620 4620 0x00, /* 00000000 */ 4621 4621 0x00, /* 00000000 */ 4622 - 4623 - }; 4622 + } }; 4624 4623 4625 4624 4626 4625 const struct font_desc font_vga_8x16 = { ··· 4627 4628 .name = "VGA8x16", 4628 4629 .width = 8, 4629 4630 .height = 16, 4630 - .data = fontdata_8x16, 4631 + .data = fontdata_8x16.data, 4631 4632 .pref = 0, 4632 4633 }; 4633 4634 EXPORT_SYMBOL(font_vga_8x16);
+4 -5
lib/fonts/font_8x8.c
··· 9 9 10 10 #define FONTDATAMAX 2048 11 11 12 - static const unsigned char fontdata_8x8[FONTDATAMAX] = { 13 - 12 + static struct font_data fontdata_8x8 = { 13 + { 0, 0, FONTDATAMAX, 0 }, { 14 14 /* 0 0x00 '^@' */ 15 15 0x00, /* 00000000 */ 16 16 0x00, /* 00000000 */ ··· 2570 2570 0x00, /* 00000000 */ 2571 2571 0x00, /* 00000000 */ 2572 2572 0x00, /* 00000000 */ 2573 - 2574 - }; 2573 + } }; 2575 2574 2576 2575 2577 2576 const struct font_desc font_vga_8x8 = { ··· 2578 2579 .name = "VGA8x8", 2579 2580 .width = 8, 2580 2581 .height = 8, 2581 - .data = fontdata_8x8, 2582 + .data = fontdata_8x8.data, 2582 2583 .pref = 0, 2583 2584 };
+6 -3
lib/fonts/font_acorn_8x8.c
··· 3 3 4 4 #include <linux/font.h> 5 5 6 - static const unsigned char acorndata_8x8[] = { 6 + #define FONTDATAMAX 2048 7 + 8 + static struct font_data acorndata_8x8 = { 9 + { 0, 0, FONTDATAMAX, 0 }, { 7 10 /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */ 8 11 /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */ 9 12 /* 02 */ 0x7e, 0xff, 0xbd, 0xff, 0xc3, 0xe7, 0xff, 0x7e, /* ^B */ ··· 263 260 /* FD */ 0x38, 0x04, 0x18, 0x20, 0x3c, 0x00, 0x00, 0x00, 264 261 /* FE */ 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 265 262 /* FF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 266 - }; 263 + } }; 267 264 268 265 const struct font_desc font_acorn_8x8 = { 269 266 .idx = ACORN8x8_IDX, 270 267 .name = "Acorn8x8", 271 268 .width = 8, 272 269 .height = 8, 273 - .data = acorndata_8x8, 270 + .data = acorndata_8x8.data, 274 271 #ifdef CONFIG_ARCH_ACORN 275 272 .pref = 20, 276 273 #else
+4 -4
lib/fonts/font_mini_4x6.c
··· 43 43 44 44 #define FONTDATAMAX 1536 45 45 46 - static const unsigned char fontdata_mini_4x6[FONTDATAMAX] = { 47 - 46 + static struct font_data fontdata_mini_4x6 = { 47 + { 0, 0, FONTDATAMAX, 0 }, { 48 48 /*{*/ 49 49 /* Char 0: ' ' */ 50 50 0xee, /*= [*** ] */ ··· 2145 2145 0xee, /*= [*** ] */ 2146 2146 0x00, /*= [ ] */ 2147 2147 /*}*/ 2148 - }; 2148 + } }; 2149 2149 2150 2150 const struct font_desc font_mini_4x6 = { 2151 2151 .idx = MINI4x6_IDX, 2152 2152 .name = "MINI4x6", 2153 2153 .width = 4, 2154 2154 .height = 6, 2155 - .data = fontdata_mini_4x6, 2155 + .data = fontdata_mini_4x6.data, 2156 2156 .pref = 3, 2157 2157 }; 2158 2158
+4 -5
lib/fonts/font_pearl_8x8.c
··· 14 14 15 15 #define FONTDATAMAX 2048 16 16 17 - static const unsigned char fontdata_pearl8x8[FONTDATAMAX] = { 18 - 17 + static struct font_data fontdata_pearl8x8 = { 18 + { 0, 0, FONTDATAMAX, 0 }, { 19 19 /* 0 0x00 '^@' */ 20 20 0x00, /* 00000000 */ 21 21 0x00, /* 00000000 */ ··· 2575 2575 0x00, /* 00000000 */ 2576 2576 0x00, /* 00000000 */ 2577 2577 0x00, /* 00000000 */ 2578 - 2579 - }; 2578 + } }; 2580 2579 2581 2580 const struct font_desc font_pearl_8x8 = { 2582 2581 .idx = PEARL8x8_IDX, 2583 2582 .name = "PEARL8x8", 2584 2583 .width = 8, 2585 2584 .height = 8, 2586 - .data = fontdata_pearl8x8, 2585 + .data = fontdata_pearl8x8.data, 2587 2586 .pref = 2, 2588 2587 };
+4 -5
lib/fonts/font_sun12x22.c
··· 3 3 4 4 #define FONTDATAMAX 11264 5 5 6 - static const unsigned char fontdata_sun12x22[FONTDATAMAX] = { 7 - 6 + static struct font_data fontdata_sun12x22 = { 7 + { 0, 0, FONTDATAMAX, 0 }, { 8 8 /* 0 0x00 '^@' */ 9 9 0x00, 0x00, /* 000000000000 */ 10 10 0x00, 0x00, /* 000000000000 */ ··· 6148 6148 0x00, 0x00, /* 000000000000 */ 6149 6149 0x00, 0x00, /* 000000000000 */ 6150 6150 0x00, 0x00, /* 000000000000 */ 6151 - 6152 - }; 6151 + } }; 6153 6152 6154 6153 6155 6154 const struct font_desc font_sun_12x22 = { ··· 6156 6157 .name = "SUN12x22", 6157 6158 .width = 12, 6158 6159 .height = 22, 6159 - .data = fontdata_sun12x22, 6160 + .data = fontdata_sun12x22.data, 6160 6161 #ifdef __sparc__ 6161 6162 .pref = 5, 6162 6163 #else
+4 -3
lib/fonts/font_sun8x16.c
··· 3 3 4 4 #define FONTDATAMAX 4096 5 5 6 - static const unsigned char fontdata_sun8x16[FONTDATAMAX] = { 6 + static struct font_data fontdata_sun8x16 = { 7 + { 0, 0, FONTDATAMAX, 0 }, { 7 8 /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 8 9 /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, 9 10 /* */ 0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00, ··· 261 260 /* */ 0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 262 261 /* */ 0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00, 263 262 /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 264 - }; 263 + } }; 265 264 266 265 const struct font_desc font_sun_8x16 = { 267 266 .idx = SUN8x16_IDX, 268 267 .name = "SUN8x16", 269 268 .width = 8, 270 269 .height = 16, 271 - .data = fontdata_sun8x16, 270 + .data = fontdata_sun8x16.data, 272 271 #ifdef __sparc__ 273 272 .pref = 10, 274 273 #else
+4 -5
lib/fonts/font_ter16x32.c
··· 4 4 5 5 #define FONTDATAMAX 16384 6 6 7 - static const unsigned char fontdata_ter16x32[FONTDATAMAX] = { 8 - 7 + static struct font_data fontdata_ter16x32 = { 8 + { 0, 0, FONTDATAMAX, 0 }, { 9 9 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 10 10 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc, 11 11 0x70, 0x1c, 0x70, 0x1c, 0x70, 0x1c, 0x70, 0x1c, ··· 2054 2054 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2055 2055 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2056 2056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 255 */ 2057 - 2058 - }; 2057 + } }; 2059 2058 2060 2059 2061 2060 const struct font_desc font_ter_16x32 = { ··· 2062 2063 .name = "TER16x32", 2063 2064 .width = 16, 2064 2065 .height = 32, 2065 - .data = fontdata_ter16x32, 2066 + .data = fontdata_ter16x32.data, 2066 2067 #ifdef __sparc__ 2067 2068 .pref = 5, 2068 2069 #else
+4 -37
mm/memory.c
··· 806 806 return 1; 807 807 808 808 /* 809 - * The trick starts. 810 - * 811 809 * What we want to do is to check whether this page may 812 810 * have been pinned by the parent process. If so, 813 811 * instead of wrprotect the pte on both sides, we copy ··· 813 815 * the pinned page won't be randomly replaced in the 814 816 * future. 815 817 * 816 - * To achieve this, we do the following: 817 - * 818 - * 1. Write-protect the pte if it's writable. This is 819 - * to protect concurrent write fast-gup with 820 - * FOLL_PIN, so that we'll fail the fast-gup with 821 - * the write bit removed. 822 - * 823 - * 2. Check page_maybe_dma_pinned() to see whether this 824 - * page may have been pinned. 825 - * 826 - * The order of these steps is important to serialize 827 - * against the fast-gup code (gup_pte_range()) on the 828 - * pte check and try_grab_compound_head(), so that 829 - * we'll make sure either we'll capture that fast-gup 830 - * so we'll copy the pinned page here, or we'll fail 831 - * that fast-gup. 832 - * 833 - * NOTE! Even if we don't end up copying the page, 834 - * we won't undo this wrprotect(), because the normal 835 - * reference copy will need it anyway. 836 - */ 837 - if (pte_write(pte)) 838 - ptep_set_wrprotect(src_mm, addr, src_pte); 839 - 840 - /* 841 - * These are the "normally we can just copy by reference" 842 - * checks. 818 + * The page pinning checks are just "has this mm ever 819 + * seen pinning", along with the (inexact) check of 820 + * the page count. That might give false positives for 821 + * for pinning, but it will work correctly. 843 822 */ 844 823 if (likely(!atomic_read(&src_mm->has_pinned))) 845 824 return 1; 846 825 if (likely(!page_maybe_dma_pinned(page))) 847 826 return 1; 848 - 849 - /* 850 - * Uhhuh. It looks like the page might be a pinned page, 851 - * and we actually need to copy it. Now we can set the 852 - * source pte back to being writable. 853 - */ 854 - if (pte_write(pte)) 855 - set_pte_at(src_mm, addr, src_pte, pte); 856 827 857 828 new_page = *prealloc; 858 829 if (!new_page)
+11 -15
net/bridge/br_netlink.c
··· 380 380 u32 filter_mask, const struct net_device *dev) 381 381 { 382 382 u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; 383 + struct nlattr *af = NULL; 383 384 struct net_bridge *br; 384 385 struct ifinfomsg *hdr; 385 386 struct nlmsghdr *nlh; ··· 424 423 nla_nest_end(skb, nest); 425 424 } 426 425 426 + if (filter_mask & (RTEXT_FILTER_BRVLAN | 427 + RTEXT_FILTER_BRVLAN_COMPRESSED | 428 + RTEXT_FILTER_MRP)) { 429 + af = nla_nest_start_noflag(skb, IFLA_AF_SPEC); 430 + if (!af) 431 + goto nla_put_failure; 432 + } 433 + 427 434 /* Check if the VID information is requested */ 428 435 if ((filter_mask & RTEXT_FILTER_BRVLAN) || 429 436 (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) { 430 437 struct net_bridge_vlan_group *vg; 431 - struct nlattr *af; 432 438 int err; 433 439 434 440 /* RCU needed because of the VLAN locking rules (rcu || rtnl) */ ··· 449 441 rcu_read_unlock(); 450 442 goto done; 451 443 } 452 - af = nla_nest_start_noflag(skb, IFLA_AF_SPEC); 453 - if (!af) { 454 - rcu_read_unlock(); 455 - goto nla_put_failure; 456 - } 457 444 if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED) 458 445 err = br_fill_ifvlaninfo_compressed(skb, vg); 459 446 else ··· 459 456 rcu_read_unlock(); 460 457 if (err) 461 458 goto nla_put_failure; 462 - 463 - nla_nest_end(skb, af); 464 459 } 465 460 466 461 if (filter_mask & RTEXT_FILTER_MRP) { 467 - struct nlattr *af; 468 462 int err; 469 463 470 464 if (!br_mrp_enabled(br) || port) 471 465 goto done; 472 - 473 - af = nla_nest_start_noflag(skb, IFLA_AF_SPEC); 474 - if (!af) 475 - goto nla_put_failure; 476 466 477 467 rcu_read_lock(); 478 468 err = br_mrp_fill_info(skb, br); ··· 473 477 474 478 if (err) 475 479 goto nla_put_failure; 476 - 477 - nla_nest_end(skb, af); 478 480 } 479 481 480 482 done: 483 + if (af) 484 + nla_nest_end(skb, af); 481 485 nlmsg_end(skb, nlh); 482 486 return 0; 483 487
+6
net/core/filter.c
··· 10203 10203 10204 10204 BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk) 10205 10205 { 10206 + /* BTF types for tcp_timewait_sock and inet_timewait_sock are not 10207 + * generated if CONFIG_INET=n. Trigger an explicit generation here. 10208 + */ 10209 + BTF_TYPE_EMIT(struct inet_timewait_sock); 10210 + BTF_TYPE_EMIT(struct tcp_timewait_sock); 10211 + 10206 10212 #ifdef CONFIG_INET 10207 10213 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT) 10208 10214 return (unsigned long)sk;
+3 -3
net/ipv4/tcp_ipv4.c
··· 1798 1798 1799 1799 __skb_pull(skb, hdrlen); 1800 1800 if (skb_try_coalesce(tail, skb, &fragstolen, &delta)) { 1801 - thtail->window = th->window; 1802 - 1803 1801 TCP_SKB_CB(tail)->end_seq = TCP_SKB_CB(skb)->end_seq; 1804 1802 1805 - if (after(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq)) 1803 + if (likely(!before(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq))) { 1806 1804 TCP_SKB_CB(tail)->ack_seq = TCP_SKB_CB(skb)->ack_seq; 1805 + thtail->window = th->window; 1806 + } 1807 1807 1808 1808 /* We have to update both TCP_SKB_CB(tail)->tcp_flags and 1809 1809 * thtail->fin, so that the fast path in tcp_rcv_established()
+5 -5
net/mptcp/options.c
··· 452 452 static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, 453 453 struct sk_buff *skb, struct mptcp_ext *ext) 454 454 { 455 - u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq); 455 + /* The write_seq value has already been incremented, so the actual 456 + * sequence number for the DATA_FIN is one less. 457 + */ 458 + u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; 456 459 457 460 if (!ext->use_map || !skb->len) { 458 461 /* RFC6824 requires a DSS mapping with specific values ··· 464 461 ext->data_fin = 1; 465 462 ext->use_map = 1; 466 463 ext->dsn64 = 1; 467 - /* The write_seq value has already been incremented, so 468 - * the actual sequence number for the DATA_FIN is one less. 469 - */ 470 - ext->data_seq = data_fin_tx_seq - 1; 464 + ext->data_seq = data_fin_tx_seq; 471 465 ext->subflow_seq = 0; 472 466 ext->data_len = 1; 473 467 } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) {
+1 -1
net/mptcp/subflow.c
··· 750 750 return MAPPING_DATA_FIN; 751 751 } 752 752 } else { 753 - u64 data_fin_seq = mpext->data_seq + data_len; 753 + u64 data_fin_seq = mpext->data_seq + data_len - 1; 754 754 755 755 /* If mpext->data_seq is a 32-bit value, data_fin_seq 756 756 * must also be limited to 32 bits.
+12 -8
net/openvswitch/conntrack.c
··· 905 905 } 906 906 err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); 907 907 908 - if (err == NF_ACCEPT && 909 - ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) { 910 - if (maniptype == NF_NAT_MANIP_SRC) 911 - maniptype = NF_NAT_MANIP_DST; 912 - else 913 - maniptype = NF_NAT_MANIP_SRC; 908 + if (err == NF_ACCEPT && ct->status & IPS_DST_NAT) { 909 + if (ct->status & IPS_SRC_NAT) { 910 + if (maniptype == NF_NAT_MANIP_SRC) 911 + maniptype = NF_NAT_MANIP_DST; 912 + else 913 + maniptype = NF_NAT_MANIP_SRC; 914 914 915 - err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, 916 - maniptype); 915 + err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, 916 + maniptype); 917 + } else if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) { 918 + err = ovs_ct_nat_execute(skb, ct, ctinfo, NULL, 919 + NF_NAT_MANIP_SRC); 920 + } 917 921 } 918 922 919 923 /* Mark NAT done if successful and update the flow key. */
+64 -12
net/qrtr/ns.c
··· 193 193 struct qrtr_server *srv; 194 194 struct qrtr_node *node; 195 195 void __rcu **slot; 196 - int ret = 0; 196 + int ret; 197 197 198 198 node = node_get(qrtr_ns.local_node); 199 199 if (!node) ··· 203 203 /* Announce the list of servers registered in this node */ 204 204 radix_tree_for_each_slot(slot, &node->servers, &iter, 0) { 205 205 srv = radix_tree_deref_slot(slot); 206 + if (!srv) 207 + continue; 208 + if (radix_tree_deref_retry(srv)) { 209 + slot = radix_tree_iter_retry(&iter); 210 + continue; 211 + } 212 + slot = radix_tree_iter_resume(slot, &iter); 213 + rcu_read_unlock(); 206 214 207 215 ret = service_announce_new(sq, srv); 208 216 if (ret < 0) { 209 217 pr_err("failed to announce new service\n"); 210 - goto err_out; 218 + return ret; 211 219 } 220 + 221 + rcu_read_lock(); 212 222 } 213 223 214 - err_out: 215 224 rcu_read_unlock(); 216 225 217 - return ret; 226 + return 0; 218 227 } 219 228 220 229 static struct qrtr_server *server_add(unsigned int service, ··· 348 339 struct qrtr_node *node; 349 340 void __rcu **slot; 350 341 struct kvec iv; 351 - int ret = 0; 342 + int ret; 352 343 353 344 iv.iov_base = &pkt; 354 345 iv.iov_len = sizeof(pkt); ··· 361 352 /* Advertise removal of this client to all servers of remote node */ 362 353 radix_tree_for_each_slot(slot, &node->servers, &iter, 0) { 363 354 srv = radix_tree_deref_slot(slot); 355 + if (!srv) 356 + continue; 357 + if (radix_tree_deref_retry(srv)) { 358 + slot = radix_tree_iter_retry(&iter); 359 + continue; 360 + } 361 + slot = radix_tree_iter_resume(slot, &iter); 362 + rcu_read_unlock(); 364 363 server_del(node, srv->port); 364 + rcu_read_lock(); 365 365 } 366 366 rcu_read_unlock(); 367 367 ··· 386 368 rcu_read_lock(); 387 369 radix_tree_for_each_slot(slot, &local_node->servers, &iter, 0) { 388 370 srv = radix_tree_deref_slot(slot); 371 + if (!srv) 372 + continue; 373 + if (radix_tree_deref_retry(srv)) { 374 + slot = radix_tree_iter_retry(&iter); 375 + continue; 376 + } 377 + slot = radix_tree_iter_resume(slot, &iter); 378 + rcu_read_unlock(); 389 379 390 380 sq.sq_family = AF_QIPCRTR; 391 381 sq.sq_node = srv->node; ··· 405 379 ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); 406 380 if (ret < 0) { 407 381 pr_err("failed to send bye cmd\n"); 408 - goto err_out; 382 + return ret; 409 383 } 384 + rcu_read_lock(); 410 385 } 411 386 412 - err_out: 413 387 rcu_read_unlock(); 414 388 415 - return ret; 389 + return 0; 416 390 } 417 391 418 392 static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, ··· 430 404 struct list_head *li; 431 405 void __rcu **slot; 432 406 struct kvec iv; 433 - int ret = 0; 407 + int ret; 434 408 435 409 iv.iov_base = &pkt; 436 410 iv.iov_len = sizeof(pkt); ··· 473 447 rcu_read_lock(); 474 448 radix_tree_for_each_slot(slot, &local_node->servers, &iter, 0) { 475 449 srv = radix_tree_deref_slot(slot); 450 + if (!srv) 451 + continue; 452 + if (radix_tree_deref_retry(srv)) { 453 + slot = radix_tree_iter_retry(&iter); 454 + continue; 455 + } 456 + slot = radix_tree_iter_resume(slot, &iter); 457 + rcu_read_unlock(); 476 458 477 459 sq.sq_family = AF_QIPCRTR; 478 460 sq.sq_node = srv->node; ··· 492 458 ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); 493 459 if (ret < 0) { 494 460 pr_err("failed to send del client cmd\n"); 495 - goto err_out; 461 + return ret; 496 462 } 463 + rcu_read_lock(); 497 464 } 498 465 499 - err_out: 500 466 rcu_read_unlock(); 501 467 502 - return ret; 468 + return 0; 503 469 } 504 470 505 471 static int ctrl_cmd_new_server(struct sockaddr_qrtr *from, ··· 605 571 rcu_read_lock(); 606 572 radix_tree_for_each_slot(node_slot, &nodes, &node_iter, 0) { 607 573 node = radix_tree_deref_slot(node_slot); 574 + if (!node) 575 + continue; 576 + if (radix_tree_deref_retry(node)) { 577 + node_slot = radix_tree_iter_retry(&node_iter); 578 + continue; 579 + } 580 + node_slot = radix_tree_iter_resume(node_slot, &node_iter); 608 581 609 582 radix_tree_for_each_slot(srv_slot, &node->servers, 610 583 &srv_iter, 0) { 611 584 struct qrtr_server *srv; 612 585 613 586 srv = radix_tree_deref_slot(srv_slot); 587 + if (!srv) 588 + continue; 589 + if (radix_tree_deref_retry(srv)) { 590 + srv_slot = radix_tree_iter_retry(&srv_iter); 591 + continue; 592 + } 593 + 614 594 if (!server_match(srv, &filter)) 615 595 continue; 616 596 597 + srv_slot = radix_tree_iter_resume(srv_slot, &srv_iter); 598 + 599 + rcu_read_unlock(); 617 600 lookup_notify(from, srv, true); 601 + rcu_read_lock(); 618 602 } 619 603 } 620 604 rcu_read_unlock();
+2 -5
net/rxrpc/ar-internal.h
··· 514 514 RXRPC_CALL_CLIENT_RECV_REPLY, /* - client receiving reply phase */ 515 515 RXRPC_CALL_SERVER_PREALLOC, /* - service preallocation */ 516 516 RXRPC_CALL_SERVER_SECURING, /* - server securing request connection */ 517 - RXRPC_CALL_SERVER_ACCEPTING, /* - server accepting request */ 518 517 RXRPC_CALL_SERVER_RECV_REQUEST, /* - server receiving request */ 519 518 RXRPC_CALL_SERVER_ACK_REQUEST, /* - server pending ACK of request */ 520 519 RXRPC_CALL_SERVER_SEND_REPLY, /* - server sending reply */ ··· 709 710 enum rxrpc_command { 710 711 RXRPC_CMD_SEND_DATA, /* send data message */ 711 712 RXRPC_CMD_SEND_ABORT, /* request abort generation */ 712 - RXRPC_CMD_ACCEPT, /* [server] accept incoming call */ 713 713 RXRPC_CMD_REJECT_BUSY, /* [server] reject a call as busy */ 714 + RXRPC_CMD_CHARGE_ACCEPT, /* [server] charge accept preallocation */ 714 715 }; 715 716 716 717 struct rxrpc_call_params { ··· 751 752 struct rxrpc_sock *, 752 753 struct sk_buff *); 753 754 void rxrpc_accept_incoming_calls(struct rxrpc_local *); 754 - struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *, unsigned long, 755 - rxrpc_notify_rx_t); 756 - int rxrpc_reject_call(struct rxrpc_sock *); 755 + int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long); 757 756 758 757 /* 759 758 * call_event.c
+38 -225
net/rxrpc/call_accept.c
··· 39 39 unsigned int debug_id) 40 40 { 41 41 const void *here = __builtin_return_address(0); 42 - struct rxrpc_call *call; 42 + struct rxrpc_call *call, *xcall; 43 43 struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk)); 44 + struct rb_node *parent, **pp; 44 45 int max, tmp; 45 46 unsigned int size = RXRPC_BACKLOG_MAX; 46 47 unsigned int head, tail, call_head, call_tail; ··· 95 94 } 96 95 97 96 /* Now it gets complicated, because calls get registered with the 98 - * socket here, particularly if a user ID is preassigned by the user. 97 + * socket here, with a user ID preassigned by the user. 99 98 */ 100 99 call = rxrpc_alloc_call(rx, gfp, debug_id); 101 100 if (!call) ··· 108 107 here, (const void *)user_call_ID); 109 108 110 109 write_lock(&rx->call_lock); 110 + 111 + /* Check the user ID isn't already in use */ 112 + pp = &rx->calls.rb_node; 113 + parent = NULL; 114 + while (*pp) { 115 + parent = *pp; 116 + xcall = rb_entry(parent, struct rxrpc_call, sock_node); 117 + if (user_call_ID < xcall->user_call_ID) 118 + pp = &(*pp)->rb_left; 119 + else if (user_call_ID > xcall->user_call_ID) 120 + pp = &(*pp)->rb_right; 121 + else 122 + goto id_in_use; 123 + } 124 + 125 + call->user_call_ID = user_call_ID; 126 + call->notify_rx = notify_rx; 111 127 if (user_attach_call) { 112 - struct rxrpc_call *xcall; 113 - struct rb_node *parent, **pp; 114 - 115 - /* Check the user ID isn't already in use */ 116 - pp = &rx->calls.rb_node; 117 - parent = NULL; 118 - while (*pp) { 119 - parent = *pp; 120 - xcall = rb_entry(parent, struct rxrpc_call, sock_node); 121 - if (user_call_ID < xcall->user_call_ID) 122 - pp = &(*pp)->rb_left; 123 - else if (user_call_ID > xcall->user_call_ID) 124 - pp = &(*pp)->rb_right; 125 - else 126 - goto id_in_use; 127 - } 128 - 129 - call->user_call_ID = user_call_ID; 130 - call->notify_rx = notify_rx; 131 128 rxrpc_get_call(call, rxrpc_call_got_kernel); 132 129 user_attach_call(call, user_call_ID); 133 - rxrpc_get_call(call, rxrpc_call_got_userid); 134 - rb_link_node(&call->sock_node, parent, pp); 135 - rb_insert_color(&call->sock_node, &rx->calls); 136 - set_bit(RXRPC_CALL_HAS_USERID, &call->flags); 137 130 } 131 + 132 + rxrpc_get_call(call, rxrpc_call_got_userid); 133 + rb_link_node(&call->sock_node, parent, pp); 134 + rb_insert_color(&call->sock_node, &rx->calls); 135 + set_bit(RXRPC_CALL_HAS_USERID, &call->flags); 138 136 139 137 list_add(&call->sock_link, &rx->sock_calls); 140 138 ··· 157 157 } 158 158 159 159 /* 160 - * Preallocate sufficient service connections, calls and peers to cover the 161 - * entire backlog of a socket. When a new call comes in, if we don't have 162 - * sufficient of each available, the call gets rejected as busy or ignored. 163 - * 164 - * The backlog is replenished when a connection is accepted or rejected. 160 + * Allocate the preallocation buffers for incoming service calls. These must 161 + * be charged manually. 165 162 */ 166 163 int rxrpc_service_prealloc(struct rxrpc_sock *rx, gfp_t gfp) 167 164 { ··· 170 173 return -ENOMEM; 171 174 rx->backlog = b; 172 175 } 173 - 174 - if (rx->discard_new_call) 175 - return 0; 176 - 177 - while (rxrpc_service_prealloc_one(rx, b, NULL, NULL, 0, gfp, 178 - atomic_inc_return(&rxrpc_debug_id)) == 0) 179 - ; 180 176 181 177 return 0; 182 178 } ··· 323 333 rxrpc_see_call(call); 324 334 call->conn = conn; 325 335 call->security = conn->security; 336 + call->security_ix = conn->security_ix; 326 337 call->peer = rxrpc_get_peer(conn->params.peer); 327 338 call->cong_cwnd = call->peer->cong_cwnd; 328 339 return call; ··· 393 402 394 403 if (rx->notify_new_call) 395 404 rx->notify_new_call(&rx->sk, call, call->user_call_ID); 396 - else 397 - sk_acceptq_added(&rx->sk); 398 405 399 406 spin_lock(&conn->state_lock); 400 407 switch (conn->state) { ··· 404 415 405 416 case RXRPC_CONN_SERVICE: 406 417 write_lock(&call->state_lock); 407 - if (call->state < RXRPC_CALL_COMPLETE) { 408 - if (rx->discard_new_call) 409 - call->state = RXRPC_CALL_SERVER_RECV_REQUEST; 410 - else 411 - call->state = RXRPC_CALL_SERVER_ACCEPTING; 412 - } 418 + if (call->state < RXRPC_CALL_COMPLETE) 419 + call->state = RXRPC_CALL_SERVER_RECV_REQUEST; 413 420 write_unlock(&call->state_lock); 414 421 break; 415 422 ··· 425 440 426 441 rxrpc_send_ping(call, skb); 427 442 428 - if (call->state == RXRPC_CALL_SERVER_ACCEPTING) 429 - rxrpc_notify_socket(call); 430 - 431 443 /* We have to discard the prealloc queue's ref here and rely on a 432 444 * combination of the RCU read lock and refs held either by the socket 433 445 * (recvmsg queue, to-be-accepted queue or user ID tree) or the kernel ··· 442 460 } 443 461 444 462 /* 445 - * handle acceptance of a call by userspace 446 - * - assign the user call ID to the call at the front of the queue 447 - * - called with the socket locked. 463 + * Charge up socket with preallocated calls, attaching user call IDs. 448 464 */ 449 - struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx, 450 - unsigned long user_call_ID, 451 - rxrpc_notify_rx_t notify_rx) 452 - __releases(&rx->sk.sk_lock.slock) 453 - __acquires(call->user_mutex) 465 + int rxrpc_user_charge_accept(struct rxrpc_sock *rx, unsigned long user_call_ID) 454 466 { 455 - struct rxrpc_call *call; 456 - struct rb_node *parent, **pp; 457 - int ret; 467 + struct rxrpc_backlog *b = rx->backlog; 458 468 459 - _enter(",%lx", user_call_ID); 469 + if (rx->sk.sk_state == RXRPC_CLOSE) 470 + return -ESHUTDOWN; 460 471 461 - ASSERT(!irqs_disabled()); 462 - 463 - write_lock(&rx->call_lock); 464 - 465 - if (list_empty(&rx->to_be_accepted)) { 466 - write_unlock(&rx->call_lock); 467 - release_sock(&rx->sk); 468 - kleave(" = -ENODATA [empty]"); 469 - return ERR_PTR(-ENODATA); 470 - } 471 - 472 - /* check the user ID isn't already in use */ 473 - pp = &rx->calls.rb_node; 474 - parent = NULL; 475 - while (*pp) { 476 - parent = *pp; 477 - call = rb_entry(parent, struct rxrpc_call, sock_node); 478 - 479 - if (user_call_ID < call->user_call_ID) 480 - pp = &(*pp)->rb_left; 481 - else if (user_call_ID > call->user_call_ID) 482 - pp = &(*pp)->rb_right; 483 - else 484 - goto id_in_use; 485 - } 486 - 487 - /* Dequeue the first call and check it's still valid. We gain 488 - * responsibility for the queue's reference. 489 - */ 490 - call = list_entry(rx->to_be_accepted.next, 491 - struct rxrpc_call, accept_link); 492 - write_unlock(&rx->call_lock); 493 - 494 - /* We need to gain the mutex from the interrupt handler without 495 - * upsetting lockdep, so we have to release it there and take it here. 496 - * We are, however, still holding the socket lock, so other accepts 497 - * must wait for us and no one can add the user ID behind our backs. 498 - */ 499 - if (mutex_lock_interruptible(&call->user_mutex) < 0) { 500 - release_sock(&rx->sk); 501 - kleave(" = -ERESTARTSYS"); 502 - return ERR_PTR(-ERESTARTSYS); 503 - } 504 - 505 - write_lock(&rx->call_lock); 506 - list_del_init(&call->accept_link); 507 - sk_acceptq_removed(&rx->sk); 508 - rxrpc_see_call(call); 509 - 510 - /* Find the user ID insertion point. */ 511 - pp = &rx->calls.rb_node; 512 - parent = NULL; 513 - while (*pp) { 514 - parent = *pp; 515 - call = rb_entry(parent, struct rxrpc_call, sock_node); 516 - 517 - if (user_call_ID < call->user_call_ID) 518 - pp = &(*pp)->rb_left; 519 - else if (user_call_ID > call->user_call_ID) 520 - pp = &(*pp)->rb_right; 521 - else 522 - BUG(); 523 - } 524 - 525 - write_lock_bh(&call->state_lock); 526 - switch (call->state) { 527 - case RXRPC_CALL_SERVER_ACCEPTING: 528 - call->state = RXRPC_CALL_SERVER_RECV_REQUEST; 529 - break; 530 - case RXRPC_CALL_COMPLETE: 531 - ret = call->error; 532 - goto out_release; 533 - default: 534 - BUG(); 535 - } 536 - 537 - /* formalise the acceptance */ 538 - call->notify_rx = notify_rx; 539 - call->user_call_ID = user_call_ID; 540 - rxrpc_get_call(call, rxrpc_call_got_userid); 541 - rb_link_node(&call->sock_node, parent, pp); 542 - rb_insert_color(&call->sock_node, &rx->calls); 543 - if (test_and_set_bit(RXRPC_CALL_HAS_USERID, &call->flags)) 544 - BUG(); 545 - 546 - write_unlock_bh(&call->state_lock); 547 - write_unlock(&rx->call_lock); 548 - rxrpc_notify_socket(call); 549 - rxrpc_service_prealloc(rx, GFP_KERNEL); 550 - release_sock(&rx->sk); 551 - _leave(" = %p{%d}", call, call->debug_id); 552 - return call; 553 - 554 - out_release: 555 - _debug("release %p", call); 556 - write_unlock_bh(&call->state_lock); 557 - write_unlock(&rx->call_lock); 558 - rxrpc_release_call(rx, call); 559 - rxrpc_put_call(call, rxrpc_call_put); 560 - goto out; 561 - 562 - id_in_use: 563 - ret = -EBADSLT; 564 - write_unlock(&rx->call_lock); 565 - out: 566 - rxrpc_service_prealloc(rx, GFP_KERNEL); 567 - release_sock(&rx->sk); 568 - _leave(" = %d", ret); 569 - return ERR_PTR(ret); 570 - } 571 - 572 - /* 573 - * Handle rejection of a call by userspace 574 - * - reject the call at the front of the queue 575 - */ 576 - int rxrpc_reject_call(struct rxrpc_sock *rx) 577 - { 578 - struct rxrpc_call *call; 579 - bool abort = false; 580 - int ret; 581 - 582 - _enter(""); 583 - 584 - ASSERT(!irqs_disabled()); 585 - 586 - write_lock(&rx->call_lock); 587 - 588 - if (list_empty(&rx->to_be_accepted)) { 589 - write_unlock(&rx->call_lock); 590 - return -ENODATA; 591 - } 592 - 593 - /* Dequeue the first call and check it's still valid. We gain 594 - * responsibility for the queue's reference. 595 - */ 596 - call = list_entry(rx->to_be_accepted.next, 597 - struct rxrpc_call, accept_link); 598 - list_del_init(&call->accept_link); 599 - sk_acceptq_removed(&rx->sk); 600 - rxrpc_see_call(call); 601 - 602 - write_lock_bh(&call->state_lock); 603 - switch (call->state) { 604 - case RXRPC_CALL_SERVER_ACCEPTING: 605 - __rxrpc_abort_call("REJ", call, 1, RX_USER_ABORT, -ECONNABORTED); 606 - abort = true; 607 - fallthrough; 608 - case RXRPC_CALL_COMPLETE: 609 - ret = call->error; 610 - goto out_discard; 611 - default: 612 - BUG(); 613 - } 614 - 615 - out_discard: 616 - write_unlock_bh(&call->state_lock); 617 - write_unlock(&rx->call_lock); 618 - if (abort) { 619 - rxrpc_send_abort_packet(call); 620 - rxrpc_release_call(rx, call); 621 - rxrpc_put_call(call, rxrpc_call_put); 622 - } 623 - rxrpc_service_prealloc(rx, GFP_KERNEL); 624 - _leave(" = %d", ret); 625 - return ret; 472 + return rxrpc_service_prealloc_one(rx, b, NULL, NULL, user_call_ID, 473 + GFP_KERNEL, 474 + atomic_inc_return(&rxrpc_debug_id)); 626 475 } 627 476 628 477 /*
+1 -4
net/rxrpc/call_object.c
··· 23 23 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl", 24 24 [RXRPC_CALL_SERVER_PREALLOC] = "SvPrealc", 25 25 [RXRPC_CALL_SERVER_SECURING] = "SvSecure", 26 - [RXRPC_CALL_SERVER_ACCEPTING] = "SvAccept", 27 26 [RXRPC_CALL_SERVER_RECV_REQUEST] = "SvRcvReq", 28 27 [RXRPC_CALL_SERVER_ACK_REQUEST] = "SvAckReq", 29 28 [RXRPC_CALL_SERVER_SEND_REPLY] = "SvSndRpl", ··· 392 393 call->call_id = sp->hdr.callNumber; 393 394 call->service_id = sp->hdr.serviceId; 394 395 call->cid = sp->hdr.cid; 395 - call->state = RXRPC_CALL_SERVER_ACCEPTING; 396 - if (sp->hdr.securityIndex > 0) 397 - call->state = RXRPC_CALL_SERVER_SECURING; 396 + call->state = RXRPC_CALL_SERVER_SECURING; 398 397 call->cong_tstamp = skb->tstamp; 399 398 400 399 /* Set the channel for this call. We don't get channel_lock as we're
+4 -4
net/rxrpc/conn_event.c
··· 270 270 if (call) { 271 271 write_lock_bh(&call->state_lock); 272 272 if (call->state == RXRPC_CALL_SERVER_SECURING) { 273 - call->state = RXRPC_CALL_SERVER_ACCEPTING; 273 + call->state = RXRPC_CALL_SERVER_RECV_REQUEST; 274 274 rxrpc_notify_socket(call); 275 275 } 276 276 write_unlock_bh(&call->state_lock); ··· 342 342 return ret; 343 343 344 344 spin_lock(&conn->bundle->channel_lock); 345 - spin_lock(&conn->state_lock); 345 + spin_lock_bh(&conn->state_lock); 346 346 347 347 if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) { 348 348 conn->state = RXRPC_CONN_SERVICE; 349 - spin_unlock(&conn->state_lock); 349 + spin_unlock_bh(&conn->state_lock); 350 350 for (loop = 0; loop < RXRPC_MAXCALLS; loop++) 351 351 rxrpc_call_is_secure( 352 352 rcu_dereference_protected( 353 353 conn->channels[loop].call, 354 354 lockdep_is_held(&conn->bundle->channel_lock))); 355 355 } else { 356 - spin_unlock(&conn->state_lock); 356 + spin_unlock_bh(&conn->state_lock); 357 357 } 358 358 359 359 spin_unlock(&conn->bundle->channel_lock);
+14 -6
net/rxrpc/key.c
··· 903 903 904 904 _enter(""); 905 905 906 - if (optlen <= 0 || optlen > PAGE_SIZE - 1) 906 + if (optlen <= 0 || optlen > PAGE_SIZE - 1 || rx->securities) 907 907 return -EINVAL; 908 908 909 909 description = memdup_sockptr_nul(optval, optlen); ··· 940 940 if (IS_ERR(description)) 941 941 return PTR_ERR(description); 942 942 943 - key = request_key_net(&key_type_keyring, description, sock_net(&rx->sk), NULL); 943 + key = request_key(&key_type_keyring, description, NULL); 944 944 if (IS_ERR(key)) { 945 945 kfree(description); 946 946 _leave(" = %ld", PTR_ERR(key)); ··· 1072 1072 1073 1073 switch (token->security_index) { 1074 1074 case RXRPC_SECURITY_RXKAD: 1075 - toksize += 9 * 4; /* viceid, kvno, key*2 + len, begin, 1075 + toksize += 8 * 4; /* viceid, kvno, key*2, begin, 1076 1076 * end, primary, tktlen */ 1077 1077 toksize += RND(token->kad->ticket_len); 1078 1078 break; ··· 1107 1107 break; 1108 1108 1109 1109 default: /* we have a ticket we can't encode */ 1110 - BUG(); 1110 + pr_err("Unsupported key token type (%u)\n", 1111 + token->security_index); 1111 1112 continue; 1112 1113 } 1113 1114 ··· 1134 1133 do { \ 1135 1134 u32 _l = (l); \ 1136 1135 ENCODE(l); \ 1136 + memcpy(xdr, (s), _l); \ 1137 + if (_l & 3) \ 1138 + memcpy((u8 *)xdr + _l, &zero, 4 - (_l & 3)); \ 1139 + xdr += (_l + 3) >> 2; \ 1140 + } while(0) 1141 + #define ENCODE_BYTES(l, s) \ 1142 + do { \ 1143 + u32 _l = (l); \ 1137 1144 memcpy(xdr, (s), _l); \ 1138 1145 if (_l & 3) \ 1139 1146 memcpy((u8 *)xdr + _l, &zero, 4 - (_l & 3)); \ ··· 1174 1165 case RXRPC_SECURITY_RXKAD: 1175 1166 ENCODE(token->kad->vice_id); 1176 1167 ENCODE(token->kad->kvno); 1177 - ENCODE_DATA(8, token->kad->session_key); 1168 + ENCODE_BYTES(8, token->kad->session_key); 1178 1169 ENCODE(token->kad->start); 1179 1170 ENCODE(token->kad->expiry); 1180 1171 ENCODE(token->kad->primary_flag); ··· 1224 1215 break; 1225 1216 1226 1217 default: 1227 - BUG(); 1228 1218 break; 1229 1219 } 1230 1220
+1 -35
net/rxrpc/recvmsg.c
··· 179 179 } 180 180 181 181 /* 182 - * Pass back notification of a new call. The call is added to the 183 - * to-be-accepted list. This means that the next call to be accepted might not 184 - * be the last call seen awaiting acceptance, but unless we leave this on the 185 - * front of the queue and block all other messages until someone gives us a 186 - * user_ID for it, there's not a lot we can do. 187 - */ 188 - static int rxrpc_recvmsg_new_call(struct rxrpc_sock *rx, 189 - struct rxrpc_call *call, 190 - struct msghdr *msg, int flags) 191 - { 192 - int tmp = 0, ret; 193 - 194 - ret = put_cmsg(msg, SOL_RXRPC, RXRPC_NEW_CALL, 0, &tmp); 195 - 196 - if (ret == 0 && !(flags & MSG_PEEK)) { 197 - _debug("to be accepted"); 198 - write_lock_bh(&rx->recvmsg_lock); 199 - list_del_init(&call->recvmsg_link); 200 - write_unlock_bh(&rx->recvmsg_lock); 201 - 202 - rxrpc_get_call(call, rxrpc_call_got); 203 - write_lock(&rx->call_lock); 204 - list_add_tail(&call->accept_link, &rx->to_be_accepted); 205 - write_unlock(&rx->call_lock); 206 - } 207 - 208 - trace_rxrpc_recvmsg(call, rxrpc_recvmsg_to_be_accepted, 1, 0, 0, ret); 209 - return ret; 210 - } 211 - 212 - /* 213 182 * End the packet reception phase. 214 183 */ 215 184 static void rxrpc_end_rx_phase(struct rxrpc_call *call, rxrpc_serial_t serial) ··· 599 630 } 600 631 601 632 switch (READ_ONCE(call->state)) { 602 - case RXRPC_CALL_SERVER_ACCEPTING: 603 - ret = rxrpc_recvmsg_new_call(rx, call, msg, flags); 604 - break; 605 633 case RXRPC_CALL_CLIENT_RECV_REPLY: 606 634 case RXRPC_CALL_SERVER_RECV_REQUEST: 607 635 case RXRPC_CALL_SERVER_ACK_REQUEST: ··· 694 728 call->debug_id, rxrpc_call_states[call->state], 695 729 iov_iter_count(iter), want_more); 696 730 697 - ASSERTCMP(call->state, !=, RXRPC_CALL_SERVER_ACCEPTING); 731 + ASSERTCMP(call->state, !=, RXRPC_CALL_SERVER_SECURING); 698 732 699 733 mutex_lock(&call->user_mutex); 700 734
+5 -10
net/rxrpc/sendmsg.c
··· 530 530 return -EINVAL; 531 531 break; 532 532 533 - case RXRPC_ACCEPT: 533 + case RXRPC_CHARGE_ACCEPT: 534 534 if (p->command != RXRPC_CMD_SEND_DATA) 535 535 return -EINVAL; 536 - p->command = RXRPC_CMD_ACCEPT; 536 + p->command = RXRPC_CMD_CHARGE_ACCEPT; 537 537 if (len != 0) 538 538 return -EINVAL; 539 539 break; ··· 659 659 if (ret < 0) 660 660 goto error_release_sock; 661 661 662 - if (p.command == RXRPC_CMD_ACCEPT) { 662 + if (p.command == RXRPC_CMD_CHARGE_ACCEPT) { 663 663 ret = -EINVAL; 664 664 if (rx->sk.sk_state != RXRPC_SERVER_LISTENING) 665 665 goto error_release_sock; 666 - call = rxrpc_accept_call(rx, p.call.user_call_ID, NULL); 667 - /* The socket is now unlocked. */ 668 - if (IS_ERR(call)) 669 - return PTR_ERR(call); 670 - ret = 0; 671 - goto out_put_unlock; 666 + ret = rxrpc_user_charge_accept(rx, p.call.user_call_ID); 667 + goto error_release_sock; 672 668 } 673 669 674 670 call = rxrpc_find_call_by_user_ID(rx, p.call.user_call_ID); ··· 686 690 case RXRPC_CALL_CLIENT_AWAIT_CONN: 687 691 case RXRPC_CALL_SERVER_PREALLOC: 688 692 case RXRPC_CALL_SERVER_SECURING: 689 - case RXRPC_CALL_SERVER_ACCEPTING: 690 693 rxrpc_put_call(call, rxrpc_call_put); 691 694 ret = -EBUSY; 692 695 goto error_release_sock;
+1
net/sctp/auth.c
··· 494 494 out_err: 495 495 /* Clean up any successful allocations */ 496 496 sctp_auth_destroy_hmacs(ep->auth_hmacs); 497 + ep->auth_hmacs = NULL; 497 498 return -ENOMEM; 498 499 } 499 500
+3
net/wireless/nl80211.c
··· 4259 4259 if (err) 4260 4260 return err; 4261 4261 4262 + if (key.idx < 0) 4263 + return -EINVAL; 4264 + 4262 4265 if (info->attrs[NL80211_ATTR_MAC]) 4263 4266 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 4264 4267