No conflicts.
Showing the changes to kernel (20 of 405 files). Show all
Unified · Split
| @@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, · 204 unmodified lines | ||
| 205 | 205 | atomic_inc(&entry_count); |
| 206 | 206 | spin_unlock_irqrestore(&async_lock, flags); |
| 207 | 207 | |
| 208 | − /* mark that this task has queued an async job, used by module init */ | |
| 209 | − current->flags |= PF_USED_ASYNC; | |
| 210 | − | |
| 211 | 208 | /* schedule for execution */ |
| 212 | 209 | queue_work_node(node, system_unbound_wq, &entry->work); |
| 213 | 210 | |
| @@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) · 540 unmodified lines | ||
| 541 | 541 | /** |
| 542 | 542 | * kauditd_rehold_skb - Handle a audit record send failure in the hold queue |
| 543 | 543 | * @skb: audit record |
| 544 | + * @error: error code (unused) | |
| 544 | 545 | * |
| 545 | 546 | * Description: |
| 546 | 547 | * This should only be used by the kauditd_thread when it fails to flush the |
| 547 | 548 | * hold queue. |
| 548 | 549 | */ |
| 549 | −static void kauditd_rehold_skb(struct sk_buff *skb) | |
| 550 | +static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error) | |
| 550 | 551 | { |
| 551 | − /* put the record back in the queue at the same place */ | |
| 552 | − skb_queue_head(&audit_hold_queue, skb); | |
| 552 | + /* put the record back in the queue */ | |
| 553 | + skb_queue_tail(&audit_hold_queue, skb); | |
| 553 | 554 | } |
| 554 | 555 | |
| 555 | 556 | /** |
| 556 | 557 | * kauditd_hold_skb - Queue an audit record, waiting for auditd |
| 557 | 558 | * @skb: audit record |
| 559 | + * @error: error code | |
| 558 | 560 | * |
| 559 | 561 | * Description: |
| 560 | 562 | * Queue the audit record, waiting for an instance of auditd. When this |
| @@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) · 3 unmodified lines | ||
| 564 | 566 | * and queue it, if we have room. If we want to hold on to the record, but we |
| 565 | 567 | * don't have room, record a record lost message. |
| 566 | 568 | */ |
| 567 | −static void kauditd_hold_skb(struct sk_buff *skb) | |
| 569 | +static void kauditd_hold_skb(struct sk_buff *skb, int error) | |
| 568 | 570 | { |
| 569 | 571 | /* at this point it is uncertain if we will ever send this to auditd so |
| 570 | 572 | * try to send the message via printk before we go any further */ |
| 571 | 573 | kauditd_printk_skb(skb); |
| 572 | 574 | |
| 573 | 575 | /* can we just silently drop the message? */ |
| 574 | − if (!audit_default) { | |
| 575 | − kfree_skb(skb); | |
| 576 | − return; | |
| 576 | + if (!audit_default) | |
| 577 | + goto drop; | |
| 578 | + | |
| 579 | + /* the hold queue is only for when the daemon goes away completely, | |
| 580 | + * not -EAGAIN failures; if we are in a -EAGAIN state requeue the | |
| 581 | + * record on the retry queue unless it's full, in which case drop it | |
| 582 | + */ | |
| 583 | + if (error == -EAGAIN) { | |
| 584 | + if (!audit_backlog_limit || | |
| 585 | + skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { | |
| 586 | + skb_queue_tail(&audit_retry_queue, skb); | |
| 587 | + return; | |
| 588 | + } | |
| 589 | + audit_log_lost("kauditd retry queue overflow"); | |
| 590 | + goto drop; | |
| 577 | 591 | } |
| 578 | 592 | |
| 579 | − /* if we have room, queue the message */ | |
| 593 | + /* if we have room in the hold queue, queue the message */ | |
| 580 | 594 | if (!audit_backlog_limit || |
| 581 | 595 | skb_queue_len(&audit_hold_queue) < audit_backlog_limit) { |
| 582 | 596 | skb_queue_tail(&audit_hold_queue, skb); |
| @@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 2 unmodified lines | ||
| 585 | 599 | |
| 586 | 600 | /* we have no other options - drop the message */ |
| 587 | 601 | audit_log_lost("kauditd hold queue overflow"); |
| 602 | +drop: | |
| 588 | 603 | kfree_skb(skb); |
| 589 | 604 | } |
| 590 | 605 | |
| 591 | 606 | /** |
| 592 | 607 | * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd |
| 593 | 608 | * @skb: audit record |
| 609 | + * @error: error code (unused) | |
| 594 | 610 | * |
| 595 | 611 | * Description: |
| 596 | 612 | * Not as serious as kauditd_hold_skb() as we still have a connected auditd, |
| 597 | 613 | * but for some reason we are having problems sending it audit records so |
| 598 | 614 | * queue the given record and attempt to resend. |
| 599 | 615 | */ |
| 600 | −static void kauditd_retry_skb(struct sk_buff *skb) | |
| 616 | +static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error) | |
| 601 | 617 | { |
| 602 | − /* NOTE: because records should only live in the retry queue for a | |
| 603 | − * short period of time, before either being sent or moved to the hold | |
| 604 | − * queue, we don't currently enforce a limit on this queue */ | |
| 605 | − skb_queue_tail(&audit_retry_queue, skb); | |
| 618 | + if (!audit_backlog_limit || | |
| 619 | + skb_queue_len(&audit_retry_queue) < audit_backlog_limit) { | |
| 620 | + skb_queue_tail(&audit_retry_queue, skb); | |
| 621 | + return; | |
| 622 | + } | |
| 623 | + | |
| 624 | + /* we have to drop the record, send it via printk as a last effort */ | |
| 625 | + kauditd_printk_skb(skb); | |
| 626 | + audit_log_lost("kauditd retry queue overflow"); | |
| 627 | + kfree_skb(skb); | |
| 606 | 628 | } |
| 607 | 629 | |
| 608 | 630 | /** |
| @@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) · 31 unmodified lines | ||
| 640 | 662 | /* flush the retry queue to the hold queue, but don't touch the main |
| 641 | 663 | * queue since we need to process that normally for multicast */ |
| 642 | 664 | while ((skb = skb_dequeue(&audit_retry_queue))) |
| 643 | − kauditd_hold_skb(skb); | |
| 665 | + kauditd_hold_skb(skb, -ECONNREFUSED); | |
| 644 | 666 | } |
| 645 | 667 | |
| 646 | 668 | /** |
| @@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 67 unmodified lines | ||
| 714 | 736 | struct sk_buff_head *queue, |
| 715 | 737 | unsigned int retry_limit, |
| 716 | 738 | void (*skb_hook)(struct sk_buff *skb), |
| 717 | − void (*err_hook)(struct sk_buff *skb)) | |
| 739 | + void (*err_hook)(struct sk_buff *skb, int error)) | |
| 718 | 740 | { |
| 719 | 741 | int rc = 0; |
| 720 | − struct sk_buff *skb; | |
| 742 | + struct sk_buff *skb = NULL; | |
| 743 | + struct sk_buff *skb_tail; | |
| 721 | 744 | unsigned int failed = 0; |
| 722 | 745 | |
| 723 | 746 | /* NOTE: kauditd_thread takes care of all our locking, we just use |
| 724 | 747 | * the netlink info passed to us (e.g. sk and portid) */ |
| 725 | 748 | |
| 726 | − while ((skb = skb_dequeue(queue))) { | |
| 749 | + skb_tail = skb_peek_tail(queue); | |
| 750 | + while ((skb != skb_tail) && (skb = skb_dequeue(queue))) { | |
| 727 | 751 | /* call the skb_hook for each skb we touch */ |
| 728 | 752 | if (skb_hook) |
| 729 | 753 | (*skb_hook)(skb); |
| @@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 1 unmodified line | ||
| 731 | 755 | /* can we send to anyone via unicast? */ |
| 732 | 756 | if (!sk) { |
| 733 | 757 | if (err_hook) |
| 734 | − (*err_hook)(skb); | |
| 758 | + (*err_hook)(skb, -ECONNREFUSED); | |
| 735 | 759 | continue; |
| 736 | 760 | } |
| 737 | 761 | |
| @@ -745,7 +769,7 @@ retry: · 7 unmodified lines | ||
| 745 | 769 | rc == -ECONNREFUSED || rc == -EPERM) { |
| 746 | 770 | sk = NULL; |
| 747 | 771 | if (err_hook) |
| 748 | − (*err_hook)(skb); | |
| 772 | + (*err_hook)(skb, rc); | |
| 749 | 773 | if (rc == -EAGAIN) |
| 750 | 774 | rc = 0; |
| 751 | 775 | /* continue to drain the queue */ |
| @@ -207,7 +207,7 @@ BTF_ID(func, bpf_lsm_socket_socketpair) · 206 unmodified lines | ||
| 207 | 207 | |
| 208 | 208 | BTF_ID(func, bpf_lsm_syslog) |
| 209 | 209 | BTF_ID(func, bpf_lsm_task_alloc) |
| 210 | −BTF_ID(func, bpf_lsm_task_getsecid_subj) | |
| 210 | +BTF_ID(func, bpf_lsm_current_getsecid_subj) | |
| 211 | 211 | BTF_ID(func, bpf_lsm_task_getsecid_obj) |
| 212 | 212 | BTF_ID(func, bpf_lsm_task_prctl) |
| 213 | 213 | BTF_ID(func, bpf_lsm_task_setscheduler) |
| @@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) · 103 unmodified lines | ||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages, |
| 107 | − VM_ALLOC | VM_USERMAP, PAGE_KERNEL); | |
| 107 | + VM_MAP | VM_USERMAP, PAGE_KERNEL); | |
| 108 | 108 | if (rb) { |
| 109 | 109 | kmemleak_not_leak(pages); |
| 110 | 110 | rb->pages = pages; |
| @@ -550,11 +550,12 @@ static __always_inline u64 notrace bpf_prog_start_time(void) · 549 unmodified lines | ||
| 550 | 550 | static void notrace inc_misses_counter(struct bpf_prog *prog) |
| 551 | 551 | { |
| 552 | 552 | struct bpf_prog_stats *stats; |
| 553 | + unsigned int flags; | |
| 553 | 554 | |
| 554 | 555 | stats = this_cpu_ptr(prog->stats); |
| 555 | − u64_stats_update_begin(&stats->syncp); | |
| 556 | + flags = u64_stats_update_begin_irqsave(&stats->syncp); | |
| 556 | 557 | u64_stats_inc(&stats->misses); |
| 557 | − u64_stats_update_end(&stats->syncp); | |
| 558 | + u64_stats_update_end_irqrestore(&stats->syncp, flags); | |
| 558 | 559 | } |
| 559 | 560 | |
| 560 | 561 | /* The logic is similar to bpf_prog_run(), but with an explicit |
| @@ -549,6 +549,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 548 unmodified lines | ||
| 549 | 549 | |
| 550 | 550 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); |
| 551 | 551 | |
| 552 | + /* | |
| 553 | + * Release agent gets called with all capabilities, | |
| 554 | + * require capabilities to set release agent. | |
| 555 | + */ | |
| 556 | + if ((of->file->f_cred->user_ns != &init_user_ns) || | |
| 557 | + !capable(CAP_SYS_ADMIN)) | |
| 558 | + return -EPERM; | |
| 559 | + | |
| 552 | 560 | cgrp = cgroup_kn_lock_live(of->kn, false); |
| 553 | 561 | if (!cgrp) |
| 554 | 562 | return -ENODEV; |
| @@ -954,6 +962,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) · 399 unmodified lines | ||
| 954 | 962 | /* Specifying two release agents is forbidden */ |
| 955 | 963 | if (ctx->release_agent) |
| 956 | 964 | return invalfc(fc, "release_agent respecified"); |
| 965 | + /* | |
| 966 | + * Release agent gets called with all capabilities, | |
| 967 | + * require capabilities to set release agent. | |
| 968 | + */ | |
| 969 | + if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN)) | |
| 970 | + return invalfc(fc, "Setting release_agent not allowed"); | |
| 957 | 971 | ctx->release_agent = param->string; |
| 958 | 972 | param->string = NULL; |
| 959 | 973 | break; |
| @@ -590,6 +590,35 @@ static inline void free_cpuset(struct cpuset *cs) · 589 unmodified lines | ||
| 590 | 590 | kfree(cs); |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | +/* | |
| 594 | + * validate_change_legacy() - Validate conditions specific to legacy (v1) | |
| 595 | + * behavior. | |
| 596 | + */ | |
| 597 | +static int validate_change_legacy(struct cpuset *cur, struct cpuset *trial) | |
| 598 | +{ | |
| 599 | + struct cgroup_subsys_state *css; | |
| 600 | + struct cpuset *c, *par; | |
| 601 | + int ret; | |
| 602 | + | |
| 603 | + WARN_ON_ONCE(!rcu_read_lock_held()); | |
| 604 | + | |
| 605 | + /* Each of our child cpusets must be a subset of us */ | |
| 606 | + ret = -EBUSY; | |
| 607 | + cpuset_for_each_child(c, css, cur) | |
| 608 | + if (!is_cpuset_subset(c, trial)) | |
| 609 | + goto out; | |
| 610 | + | |
| 611 | + /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | |
| 612 | + ret = -EACCES; | |
| 613 | + par = parent_cs(cur); | |
| 614 | + if (par && !is_cpuset_subset(trial, par)) | |
| 615 | + goto out; | |
| 616 | + | |
| 617 | + ret = 0; | |
| 618 | +out: | |
| 619 | + return ret; | |
| 620 | +} | |
| 621 | + | |
| 593 | 622 | /* |
| 594 | 623 | * validate_change() - Used to validate that any proposed cpuset change |
| 595 | 624 | * follows the structural rules for cpusets. |
| @@ -614,20 +643,21 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) · 18 unmodified lines | ||
| 614 | 643 | { |
| 615 | 644 | struct cgroup_subsys_state *css; |
| 616 | 645 | struct cpuset *c, *par; |
| 617 | − int ret; | |
| 618 | − | |
| 619 | − /* The checks don't apply to root cpuset */ | |
| 620 | − if (cur == &top_cpuset) | |
| 621 | − return 0; | |
| 646 | + int ret = 0; | |
| 622 | 647 | |
| 623 | 648 | rcu_read_lock(); |
| 624 | − par = parent_cs(cur); | |
| 625 | 649 | |
| 626 | − /* On legacy hierarchy, we must be a subset of our parent cpuset. */ | |
| 627 | − ret = -EACCES; | |
| 628 | − if (!is_in_v2_mode() && !is_cpuset_subset(trial, par)) | |
| 650 | + if (!is_in_v2_mode()) | |
| 651 | + ret = validate_change_legacy(cur, trial); | |
| 652 | + if (ret) | |
| 653 | + goto out; | |
| 654 | + | |
| 655 | + /* Remaining checks don't apply to root cpuset */ | |
| 656 | + if (cur == &top_cpuset) | |
| 629 | 657 | goto out; |
| 630 | 658 | |
| 659 | + par = parent_cs(cur); | |
| 660 | + | |
| 631 | 661 | /* |
| 632 | 662 | * If either I or some sibling (!= me) is exclusive, we can't |
| 633 | 663 | * overlap |
| @@ -1175,9 +1205,7 @@ enum subparts_cmd { · 541 unmodified lines | ||
| 1175 | 1205 | * |
| 1176 | 1206 | * Because of the implicit cpu exclusive nature of a partition root, |
| 1177 | 1207 | * cpumask changes that violates the cpu exclusivity rule will not be |
| 1178 | − * permitted when checked by validate_change(). The validate_change() | |
| 1179 | − * function will also prevent any changes to the cpu list if it is not | |
| 1180 | − * a superset of children's cpu lists. | |
| 1208 | + * permitted when checked by validate_change(). | |
| 1181 | 1209 | */ |
| 1182 | 1210 | static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd, |
| 1183 | 1211 | struct cpumask *newmask, |
| @@ -1522,10 +1550,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 338 unmodified lines | ||
| 1522 | 1550 | struct cpuset *sibling; |
| 1523 | 1551 | struct cgroup_subsys_state *pos_css; |
| 1524 | 1552 | |
| 1553 | + percpu_rwsem_assert_held(&cpuset_rwsem); | |
| 1554 | + | |
| 1525 | 1555 | /* |
| 1526 | 1556 | * Check all its siblings and call update_cpumasks_hier() |
| 1527 | 1557 | * if their use_parent_ecpus flag is set in order for them |
| 1528 | 1558 | * to use the right effective_cpus value. |
| 1559 | + * | |
| 1560 | + * The update_cpumasks_hier() function may sleep. So we have to | |
| 1561 | + * release the RCU read lock before calling it. | |
| 1529 | 1562 | */ |
| 1530 | 1563 | rcu_read_lock(); |
| 1531 | 1564 | cpuset_for_each_child(sibling, pos_css, parent) { |
| @@ -1533,8 +1566,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 1 unmodified line | ||
| 1533 | 1566 | continue; |
| 1534 | 1567 | if (!sibling->use_parent_ecpus) |
| 1535 | 1568 | continue; |
| 1569 | + if (!css_tryget_online(&sibling->css)) | |
| 1570 | + continue; | |
| 1536 | 1571 | |
| 1572 | + rcu_read_unlock(); | |
| 1537 | 1573 | update_cpumasks_hier(sibling, tmp); |
| 1574 | + rcu_read_lock(); | |
| 1575 | + css_put(&sibling->css); | |
| 1538 | 1576 | } |
| 1539 | 1577 | rcu_read_unlock(); |
| 1540 | 1578 | } |
| @@ -1607,8 +1645,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, · 66 unmodified lines | ||
| 1607 | 1645 | * Make sure that subparts_cpus is a subset of cpus_allowed. |
| 1608 | 1646 | */ |
| 1609 | 1647 | if (cs->nr_subparts_cpus) { |
| 1610 | − cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus, | |
| 1611 | − cs->cpus_allowed); | |
| 1648 | + cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed); | |
| 1612 | 1649 | cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus); |
| 1613 | 1650 | } |
| 1614 | 1651 | spin_unlock_irq(&callback_lock); |
| @@ -2462,7 +2462,11 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla · 2461 unmodified lines | ||
| 2462 | 2462 | * event_function_call() user. |
| 2463 | 2463 | */ |
| 2464 | 2464 | raw_spin_lock_irq(&ctx->lock); |
| 2465 | − if (!ctx->is_active) { | |
| 2465 | + /* | |
| 2466 | + * Cgroup events are per-cpu events, and must IPI because of | |
| 2467 | + * cgrp_cpuctx_list. | |
| 2468 | + */ | |
| 2469 | + if (!ctx->is_active && !is_cgroup_event(event)) { | |
| 2466 | 2470 | __perf_remove_from_context(event, __get_cpu_context(ctx), |
| 2467 | 2471 | ctx, (void *)flags); |
| 2468 | 2472 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -2895,11 +2899,14 @@ perf_install_in_context(struct perf_event_context *ctx, · 426 unmodified lines | ||
| 2895 | 2899 | * perf_event_attr::disabled events will not run and can be initialized |
| 2896 | 2900 | * without IPI. Except when this is the first event for the context, in |
| 2897 | 2901 | * that case we need the magic of the IPI to set ctx->is_active. |
| 2902 | + * Similarly, cgroup events for the context also needs the IPI to | |
| 2903 | + * manipulate the cgrp_cpuctx_list. | |
| 2898 | 2904 | * |
| 2899 | 2905 | * The IOC_ENABLE that is sure to follow the creation of a disabled |
| 2900 | 2906 | * event will issue the IPI and reprogram the hardware. |
| 2901 | 2907 | */ |
| 2902 | − if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) { | |
| 2908 | + if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && | |
| 2909 | + ctx->nr_events && !is_cgroup_event(event)) { | |
| 2903 | 2910 | raw_spin_lock_irq(&ctx->lock); |
| 2904 | 2911 | if (ctx->task == TASK_TOMBSTONE) { |
| 2905 | 2912 | raw_spin_unlock_irq(&ctx->lock); |
| @@ -5985,6 +5992,8 @@ static void ring_buffer_attach(struct perf_event *event, · 3079 unmodified lines | ||
| 5985 | 5992 | struct perf_buffer *old_rb = NULL; |
| 5986 | 5993 | unsigned long flags; |
| 5987 | 5994 | |
| 5995 | + WARN_ON_ONCE(event->parent); | |
| 5996 | + | |
| 5988 | 5997 | if (event->rb) { |
| 5989 | 5998 | /* |
| 5990 | 5999 | * Should be impossible, we set this when removing |
| @@ -6042,6 +6051,9 @@ static void ring_buffer_wakeup(struct perf_event *event) · 51 unmodified lines | ||
| 6042 | 6051 | { |
| 6043 | 6052 | struct perf_buffer *rb; |
| 6044 | 6053 | |
| 6054 | + if (event->parent) | |
| 6055 | + event = event->parent; | |
| 6056 | + | |
| 6045 | 6057 | rcu_read_lock(); |
| 6046 | 6058 | rb = rcu_dereference(event->rb); |
| 6047 | 6059 | if (rb) { |
| @@ -6055,6 +6067,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event *event) · 7 unmodified lines | ||
| 6055 | 6067 | { |
| 6056 | 6068 | struct perf_buffer *rb; |
| 6057 | 6069 | |
| 6070 | + if (event->parent) | |
| 6071 | + event = event->parent; | |
| 6072 | + | |
| 6058 | 6073 | rcu_read_lock(); |
| 6059 | 6074 | rb = rcu_dereference(event->rb); |
| 6060 | 6075 | if (rb) { |
| @@ -6763,7 +6778,7 @@ static unsigned long perf_prepare_sample_aux(struct perf_event *event, · 702 unmodified lines | ||
| 6763 | 6778 | if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) != smp_processor_id())) |
| 6764 | 6779 | goto out; |
| 6765 | 6780 | |
| 6766 | − rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | |
| 6781 | + rb = ring_buffer_get(sampler); | |
| 6767 | 6782 | if (!rb) |
| 6768 | 6783 | goto out; |
| 6769 | 6784 | |
| @@ -6829,7 +6844,7 @@ static void perf_aux_sample_output(struct perf_event *event, · 59 unmodified lines | ||
| 6829 | 6844 | if (WARN_ON_ONCE(!sampler || !data->aux_size)) |
| 6830 | 6845 | return; |
| 6831 | 6846 | |
| 6832 | − rb = ring_buffer_get(sampler->parent ? sampler->parent : sampler); | |
| 6847 | + rb = ring_buffer_get(sampler); | |
| 6833 | 6848 | if (!rb) |
| 6834 | 6849 | return; |
| 6835 | 6850 | |
| @@ -3725,12 +3725,6 @@ static noinline int do_init_module(struct module *mod) · 3724 unmodified lines | ||
| 3725 | 3725 | } |
| 3726 | 3726 | freeinit->module_init = mod->init_layout.base; |
| 3727 | 3727 | |
| 3728 | − /* | |
| 3729 | − * We want to find out whether @mod uses async during init. Clear | |
| 3730 | − * PF_USED_ASYNC. async_schedule*() will set it. | |
| 3731 | − */ | |
| 3732 | − current->flags &= ~PF_USED_ASYNC; | |
| 3733 | − | |
| 3734 | 3728 | do_mod_ctors(mod); |
| 3735 | 3729 | /* Start the module */ |
| 3736 | 3730 | if (mod->init != NULL) |
| @@ -3756,22 +3750,13 @@ static noinline int do_init_module(struct module *mod) · 19 unmodified lines | ||
| 3756 | 3750 | |
| 3757 | 3751 | /* |
| 3758 | 3752 | * We need to finish all async code before the module init sequence |
| 3759 | − * is done. This has potential to deadlock. For example, a newly | |
| 3760 | − * detected block device can trigger request_module() of the | |
| 3761 | − * default iosched from async probing task. Once userland helper | |
| 3762 | − * reaches here, async_synchronize_full() will wait on the async | |
| 3763 | − * task waiting on request_module() and deadlock. | |
| 3764 | − * | |
| 3765 | − * This deadlock is avoided by perfomring async_synchronize_full() | |
| 3766 | − * iff module init queued any async jobs. This isn't a full | |
| 3767 | − * solution as it will deadlock the same if module loading from | |
| 3768 | − * async jobs nests more than once; however, due to the various | |
| 3769 | − * constraints, this hack seems to be the best option for now. | |
| 3770 | − * Please refer to the following thread for details. | |
| 3753 | + * is done. This has potential to deadlock if synchronous module | |
| 3754 | + * loading is requested from async (which is not allowed!). | |
| 3771 | 3755 | * |
| 3772 | − * http://thread.gmane.org/gmane.linux.kernel/1420814 | |
| 3756 | + * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous | |
| 3757 | + * request_module() from async workers") for more details. | |
| 3773 | 3758 | */ |
| 3774 | − if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC)) | |
| 3759 | + if (!mod->async_probe_requested) | |
| 3775 | 3760 | async_synchronize_full(); |
| 3776 | 3761 | |
| 3777 | 3762 | ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + |
| @@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) · 977 unmodified lines | ||
| 978 | 978 | * Register a range of page frames the contents of which should not be saved |
| 979 | 979 | * during hibernation (to be used in the early initialization code). |
| 980 | 980 | */ |
| 981 | −void __init __register_nosave_region(unsigned long start_pfn, | |
| 982 | − unsigned long end_pfn, int use_kmalloc) | |
| 981 | +void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) | |
| 983 | 982 | { |
| 984 | 983 | struct nosave_region *region; |
| 985 | 984 | |
| @@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn, · 9 unmodified lines | ||
| 995 | 994 | goto Report; |
| 996 | 995 | } |
| 997 | 996 | } |
| 998 | − if (use_kmalloc) { | |
| 999 | − /* During init, this shouldn't fail */ | |
| 1000 | − region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); | |
| 1001 | − BUG_ON(!region); | |
| 1002 | − } else { | |
| 1003 | − /* This allocation cannot fail */ | |
| 1004 | − region = memblock_alloc(sizeof(struct nosave_region), | |
| 1005 | − SMP_CACHE_BYTES); | |
| 1006 | − if (!region) | |
| 1007 | − panic("%s: Failed to allocate %zu bytes\n", __func__, | |
| 1008 | − sizeof(struct nosave_region)); | |
| 1009 | − } | |
| 997 | + /* This allocation cannot fail */ | |
| 998 | + region = memblock_alloc(sizeof(struct nosave_region), | |
| 999 | + SMP_CACHE_BYTES); | |
| 1000 | + if (!region) | |
| 1001 | + panic("%s: Failed to allocate %zu bytes\n", __func__, | |
| 1002 | + sizeof(struct nosave_region)); | |
| 1010 | 1003 | region->start_pfn = start_pfn; |
| 1011 | 1004 | region->end_pfn = end_pfn; |
| 1012 | 1005 | list_add_tail(®ion->list, &nosave_regions); |
| @@ -39,23 +39,20 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active) · 38 unmodified lines | ||
| 39 | 39 | { |
| 40 | 40 | struct rb_node *node; |
| 41 | 41 | struct wakelock *wl; |
| 42 | − char *str = buf; | |
| 43 | − char *end = buf + PAGE_SIZE; | |
| 42 | + int len = 0; | |
| 44 | 43 | |
| 45 | 44 | mutex_lock(&wakelocks_lock); |
| 46 | 45 | |
| 47 | 46 | for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { |
| 48 | 47 | wl = rb_entry(node, struct wakelock, node); |
| 49 | 48 | if (wl->ws->active == show_active) |
| 50 | − str += scnprintf(str, end - str, "%s ", wl->name); | |
| 49 | + len += sysfs_emit_at(buf, len, "%s ", wl->name); | |
| 51 | 50 | } |
| 52 | − if (str > buf) | |
| 53 | − str--; | |
| 54 | 51 | |
| 55 | − str += scnprintf(str, end - str, "\n"); | |
| 52 | + len += sysfs_emit_at(buf, len, "\n"); | |
| 56 | 53 | |
| 57 | 54 | mutex_unlock(&wakelocks_lock); |
| 58 | − return (str - buf); | |
| 55 | + return len; | |
| 59 | 56 | } |
| 60 | 57 | |
| 61 | 58 | #if CONFIG_PM_WAKELOCKS_LIMIT > 0 |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | static const int ten_thousand = 10000; |
| 13 | 13 | |
| 14 | 14 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
| 15 | − void __user *buffer, size_t *lenp, loff_t *ppos) | |
| 15 | + void *buffer, size_t *lenp, loff_t *ppos) | |
| 16 | 16 | { |
| 17 | 17 | if (write && !capable(CAP_SYS_ADMIN)) |
| 18 | 18 | return -EPERM; |
| @@ -123,7 +123,7 @@ static struct rcu_tasks rt_name = \ · 122 unmodified lines | ||
| 123 | 123 | .call_func = call, \ |
| 124 | 124 | .rtpcpu = &rt_name ## __percpu, \ |
| 125 | 125 | .name = n, \ |
| 126 | − .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS), \ | |
| 126 | + .percpu_enqueue_shift = ilog2(CONFIG_NR_CPUS) + 1, \ | |
| 127 | 127 | .percpu_enqueue_lim = 1, \ |
| 128 | 128 | .percpu_dequeue_lim = 1, \ |
| 129 | 129 | .barrier_q_mutex = __MUTEX_INITIALIZER(rt_name.barrier_q_mutex), \ |
| @@ -216,6 +216,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 86 unmodified lines | ||
| 216 | 216 | int cpu; |
| 217 | 217 | unsigned long flags; |
| 218 | 218 | int lim; |
| 219 | + int shift; | |
| 219 | 220 | |
| 220 | 221 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 221 | 222 | if (rcu_task_enqueue_lim < 0) { |
| @@ -229,7 +230,10 @@ static void cblist_init_generic(struct rcu_tasks *rtp) · 7 unmodified lines | ||
| 229 | 230 | |
| 230 | 231 | if (lim > nr_cpu_ids) |
| 231 | 232 | lim = nr_cpu_ids; |
| 232 | − WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids / lim)); | |
| 233 | + shift = ilog2(nr_cpu_ids / lim); | |
| 234 | + if (((nr_cpu_ids - 1) >> shift) >= lim) | |
| 235 | + shift++; | |
| 236 | + WRITE_ONCE(rtp->percpu_enqueue_shift, shift); | |
| 233 | 237 | WRITE_ONCE(rtp->percpu_dequeue_lim, lim); |
| 234 | 238 | smp_store_release(&rtp->percpu_enqueue_lim, lim); |
| 235 | 239 | for_each_possible_cpu(cpu) { |
| @@ -298,7 +302,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func, · 62 unmodified lines | ||
| 298 | 302 | if (unlikely(needadjust)) { |
| 299 | 303 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 300 | 304 | if (rtp->percpu_enqueue_lim != nr_cpu_ids) { |
| 301 | − WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | |
| 305 | + WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); | |
| 302 | 306 | WRITE_ONCE(rtp->percpu_dequeue_lim, nr_cpu_ids); |
| 303 | 307 | smp_store_release(&rtp->percpu_enqueue_lim, nr_cpu_ids); |
| 304 | 308 | pr_info("Switching %s to per-CPU callback queuing.\n", rtp->name); |
| @@ -413,7 +417,7 @@ static int rcu_tasks_need_gpcb(struct rcu_tasks *rtp) · 108 unmodified lines | ||
| 413 | 417 | if (rcu_task_cb_adjust && ncbs <= rcu_task_collapse_lim) { |
| 414 | 418 | raw_spin_lock_irqsave(&rtp->cbs_gbl_lock, flags); |
| 415 | 419 | if (rtp->percpu_enqueue_lim > 1) { |
| 416 | − WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids)); | |
| 420 | + WRITE_ONCE(rtp->percpu_enqueue_shift, ilog2(nr_cpu_ids) + 1); | |
| 417 | 421 | smp_store_release(&rtp->percpu_enqueue_lim, 1); |
| 418 | 422 | rtp->percpu_dequeue_gpseq = get_state_synchronize_rcu(); |
| 419 | 423 | pr_info("Starting switch %s to CPU-0 callback queuing.\n", rtp->name); |
| @@ -147,11 +147,11 @@ · 146 unmodified lines | ||
| 147 | 147 | #endif |
| 148 | 148 | |
| 149 | 149 | #ifdef CONFIG_RSEQ |
| 150 | −#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \ | |
| 150 | +#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \ | |
| 151 | 151 | (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ |
| 152 | − | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | |
| 152 | + | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ) | |
| 153 | 153 | #else |
| 154 | −#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 | |
| 154 | +#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 | |
| 155 | 155 | #endif |
| 156 | 156 | |
| 157 | 157 | #define MEMBARRIER_CMD_BITMASK \ |
| @@ -159,7 +159,8 @@ · 1 unmodified line | ||
| 159 | 159 | | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ |
| 160 | 160 | | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ |
| 161 | 161 | | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ |
| 162 | − | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) | |
| 162 | + | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \ | |
| 163 | + | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK) | |
| 163 | 164 | |
| 164 | 165 | static void ipi_mb(void *info) |
| 165 | 166 | { |
| @@ -1082,44 +1082,6 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) · 1081 unmodified lines | ||
| 1082 | 1082 | return 0; |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | −static int psi_io_show(struct seq_file *m, void *v) | |
| 1086 | −{ | |
| 1087 | − return psi_show(m, &psi_system, PSI_IO); | |
| 1088 | −} | |
| 1089 | − | |
| 1090 | −static int psi_memory_show(struct seq_file *m, void *v) | |
| 1091 | −{ | |
| 1092 | − return psi_show(m, &psi_system, PSI_MEM); | |
| 1093 | −} | |
| 1094 | − | |
| 1095 | −static int psi_cpu_show(struct seq_file *m, void *v) | |
| 1096 | −{ | |
| 1097 | − return psi_show(m, &psi_system, PSI_CPU); | |
| 1098 | −} | |
| 1099 | − | |
| 1100 | −static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | |
| 1101 | −{ | |
| 1102 | − if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | |
| 1103 | − return -EPERM; | |
| 1104 | − | |
| 1105 | − return single_open(file, psi_show, NULL); | |
| 1106 | −} | |
| 1107 | − | |
| 1108 | −static int psi_io_open(struct inode *inode, struct file *file) | |
| 1109 | −{ | |
| 1110 | − return psi_open(file, psi_io_show); | |
| 1111 | −} | |
| 1112 | − | |
| 1113 | −static int psi_memory_open(struct inode *inode, struct file *file) | |
| 1114 | −{ | |
| 1115 | − return psi_open(file, psi_memory_show); | |
| 1116 | −} | |
| 1117 | − | |
| 1118 | −static int psi_cpu_open(struct inode *inode, struct file *file) | |
| 1119 | −{ | |
| 1120 | − return psi_open(file, psi_cpu_show); | |
| 1121 | −} | |
| 1122 | − | |
| 1123 | 1085 | struct psi_trigger *psi_trigger_create(struct psi_group *group, |
| 1124 | 1086 | char *buf, size_t nbytes, enum psi_res res) |
| 1125 | 1087 | { |
| @@ -1278,6 +1240,45 @@ __poll_t psi_trigger_poll(void **trigger_ptr, · 152 unmodified lines | ||
| 1278 | 1240 | return ret; |
| 1279 | 1241 | } |
| 1280 | 1242 | |
| 1243 | +#ifdef CONFIG_PROC_FS | |
| 1244 | +static int psi_io_show(struct seq_file *m, void *v) | |
| 1245 | +{ | |
| 1246 | + return psi_show(m, &psi_system, PSI_IO); | |
| 1247 | +} | |
| 1248 | + | |
| 1249 | +static int psi_memory_show(struct seq_file *m, void *v) | |
| 1250 | +{ | |
| 1251 | + return psi_show(m, &psi_system, PSI_MEM); | |
| 1252 | +} | |
| 1253 | + | |
| 1254 | +static int psi_cpu_show(struct seq_file *m, void *v) | |
| 1255 | +{ | |
| 1256 | + return psi_show(m, &psi_system, PSI_CPU); | |
| 1257 | +} | |
| 1258 | + | |
| 1259 | +static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) | |
| 1260 | +{ | |
| 1261 | + if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) | |
| 1262 | + return -EPERM; | |
| 1263 | + | |
| 1264 | + return single_open(file, psi_show, NULL); | |
| 1265 | +} | |
| 1266 | + | |
| 1267 | +static int psi_io_open(struct inode *inode, struct file *file) | |
| 1268 | +{ | |
| 1269 | + return psi_open(file, psi_io_show); | |
| 1270 | +} | |
| 1271 | + | |
| 1272 | +static int psi_memory_open(struct inode *inode, struct file *file) | |
| 1273 | +{ | |
| 1274 | + return psi_open(file, psi_memory_show); | |
| 1275 | +} | |
| 1276 | + | |
| 1277 | +static int psi_cpu_open(struct inode *inode, struct file *file) | |
| 1278 | +{ | |
| 1279 | + return psi_open(file, psi_cpu_show); | |
| 1280 | +} | |
| 1281 | + | |
| 1281 | 1282 | static ssize_t psi_write(struct file *file, const char __user *user_buf, |
| 1282 | 1283 | size_t nbytes, enum psi_res res) |
| 1283 | 1284 | { |
| @@ -1392,3 +1393,5 @@ static int __init psi_proc_init(void) · 108 unmodified lines | ||
| 1392 | 1393 | return 0; |
| 1393 | 1394 | } |
| 1394 | 1395 | module_init(psi_proc_init); |
| 1396 | + | |
| 1397 | +#endif /* CONFIG_PROC_FS */ | |
| @@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init); · 69 unmodified lines | ||
| 70 | 70 | #define skip_erasing() false |
| 71 | 71 | #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ |
| 72 | 72 | |
| 73 | −asmlinkage void notrace stackleak_erase(void) | |
| 73 | +asmlinkage void noinstr stackleak_erase(void) | |
| 74 | 74 | { |
| 75 | 75 | /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ |
| 76 | 76 | unsigned long kstack_ptr = current->lowest_stack; |
| @@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void) · 47 unmodified lines | ||
| 124 | 124 | /* Reset the 'lowest_stack' value for the next syscall */ |
| 125 | 125 | current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; |
| 126 | 126 | } |
| 127 | −NOKPROBE_SYMBOL(stackleak_erase); | |
| 128 | 127 | |
| 129 | −void __used __no_caller_saved_registers notrace stackleak_track_stack(void) | |
| 128 | +void __used __no_caller_saved_registers noinstr stackleak_track_stack(void) | |
| 130 | 129 | { |
| 131 | 130 | unsigned long sp = current_stack_pointer; |
| 132 | 131 | |
| @@ -70,10 +70,16 @@ config HAVE_C_RECORDMCOUNT · 69 unmodified lines | ||
| 70 | 70 | help |
| 71 | 71 | C version of recordmcount available? |
| 72 | 72 | |
| 73 | +config HAVE_BUILDTIME_MCOUNT_SORT | |
| 74 | + bool | |
| 75 | + help | |
| 76 | + An architecture selects this if it sorts the mcount_loc section | |
| 77 | + at build time. | |
| 78 | + | |
| 73 | 79 | config BUILDTIME_MCOUNT_SORT |
| 74 | 80 | bool |
| 75 | 81 | default y |
| 76 | − depends on BUILDTIME_TABLE_SORT && !S390 | |
| 82 | + depends on HAVE_BUILDTIME_MCOUNT_SORT && DYNAMIC_FTRACE | |
| 77 | 83 | help |
| 78 | 84 | Sort the mcount_loc section at build time. |
| 79 | 85 | |
| @@ -7740,7 +7740,8 @@ static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) · 7739 unmodified lines | ||
| 7740 | 7740 | err = kzalloc(sizeof(*err), GFP_KERNEL); |
| 7741 | 7741 | if (!err) |
| 7742 | 7742 | err = ERR_PTR(-ENOMEM); |
| 7743 | − tr->n_err_log_entries++; | |
| 7743 | + else | |
| 7744 | + tr->n_err_log_entries++; | |
| 7744 | 7745 | |
| 7745 | 7746 | return err; |
| 7746 | 7747 | } |
| @@ -2503,6 +2503,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, · 2502 unmodified lines | ||
| 2503 | 2503 | (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); |
| 2504 | 2504 | expr->fn = hist_field_unary_minus; |
| 2505 | 2505 | expr->operands[0] = operand1; |
| 2506 | + expr->size = operand1->size; | |
| 2507 | + expr->is_signed = operand1->is_signed; | |
| 2506 | 2508 | expr->operator = FIELD_OP_UNARY_MINUS; |
| 2507 | 2509 | expr->name = expr_str(expr, 0); |
| 2508 | 2510 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -2719,6 +2721,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, · 210 unmodified lines | ||
| 2719 | 2721 | |
| 2720 | 2722 | /* The operand sizes should be the same, so just pick one */ |
| 2721 | 2723 | expr->size = operand1->size; |
| 2724 | + expr->is_signed = operand1->is_signed; | |
| 2722 | 2725 | |
| 2723 | 2726 | expr->operator = field_op; |
| 2724 | 2727 | expr->type = kstrdup_const(operand1->type, GFP_KERNEL); |
| @@ -3935,6 +3938,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data, · 1210 unmodified lines | ||
| 3935 | 3938 | |
| 3936 | 3939 | var_ref_idx = find_var_ref_idx(hist_data, var_ref); |
| 3937 | 3940 | if (WARN_ON(var_ref_idx < 0)) { |
| 3941 | + kfree(p); | |
| 3938 | 3942 | ret = var_ref_idx; |
| 3939 | 3943 | goto err; |
| 3940 | 3944 | } |
| @@ -6163,7 +6167,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 2222 unmodified lines | ||
| 6163 | 6167 | |
| 6164 | 6168 | lockdep_assert_held(&event_mutex); |
| 6165 | 6169 | |
| 6166 | − if (glob && strlen(glob)) { | |
| 6170 | + WARN_ON(!glob); | |
| 6171 | + | |
| 6172 | + if (strlen(glob)) { | |
| 6167 | 6173 | hist_err_clear(); |
| 6168 | 6174 | last_cmd_set(file, param); |
| 6169 | 6175 | } |
| @@ -6196,7 +6202,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, · 26 unmodified lines | ||
| 6196 | 6202 | continue; |
| 6197 | 6203 | } |
| 6198 | 6204 | break; |
| 6199 | − } while (p); | |
| 6205 | + } while (1); | |
| 6200 | 6206 | |
| 6201 | 6207 | if (!p) |
| 6202 | 6208 | param = NULL; |
| @@ -190,6 +190,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) · 189 unmodified lines | ||
| 190 | 190 | kfree(new); |
| 191 | 191 | } else { |
| 192 | 192 | hlist_add_head(&new->node, hashent); |
| 193 | + get_user_ns(new->ns); | |
| 193 | 194 | spin_unlock_irq(&ucounts_lock); |
| 194 | 195 | return new; |
| 195 | 196 | } |
| @@ -210,6 +211,7 @@ void put_ucounts(struct ucounts *ucounts) · 14 unmodified lines | ||
| 210 | 211 | if (atomic_dec_and_lock_irqsave(&ucounts->count, &ucounts_lock, flags)) { |
| 211 | 212 | hlist_del_init(&ucounts->node); |
| 212 | 213 | spin_unlock_irqrestore(&ucounts_lock, flags); |
| 214 | + put_user_ns(ucounts->ns); | |
| 213 | 215 | kfree(ucounts); |
| 214 | 216 | } |
| 215 | 217 | } |