aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c19
-rw-r--r--net/core/net-sysfs.c10
-rw-r--r--net/core/request_sock.c4
-rw-r--r--net/core/timestamping.c6
4 files changed, 19 insertions, 20 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 23e9b2a6b4c8..ae21a0d3c4a2 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -589,23 +589,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
589EXPORT_SYMBOL(sk_chk_filter); 589EXPORT_SYMBOL(sk_chk_filter);
590 590
591/** 591/**
592 * sk_filter_rcu_release: Release a socket filter by rcu_head 592 * sk_filter_release_rcu - Release a socket filter by rcu_head
593 * @rcu: rcu_head that contains the sk_filter to free 593 * @rcu: rcu_head that contains the sk_filter to free
594 */ 594 */
595static void sk_filter_rcu_release(struct rcu_head *rcu) 595void sk_filter_release_rcu(struct rcu_head *rcu)
596{ 596{
597 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); 597 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
598 598
599 sk_filter_release(fp); 599 kfree(fp);
600}
601
602static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp)
603{
604 unsigned int size = sk_filter_len(fp);
605
606 atomic_sub(size, &sk->sk_omem_alloc);
607 call_rcu_bh(&fp->rcu, sk_filter_rcu_release);
608} 600}
601EXPORT_SYMBOL(sk_filter_release_rcu);
609 602
610/** 603/**
611 * sk_attach_filter - attach a socket filter 604 * sk_attach_filter - attach a socket filter
@@ -649,7 +642,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
649 rcu_assign_pointer(sk->sk_filter, fp); 642 rcu_assign_pointer(sk->sk_filter, fp);
650 643
651 if (old_fp) 644 if (old_fp)
652 sk_filter_delayed_uncharge(sk, old_fp); 645 sk_filter_uncharge(sk, old_fp);
653 return 0; 646 return 0;
654} 647}
655EXPORT_SYMBOL_GPL(sk_attach_filter); 648EXPORT_SYMBOL_GPL(sk_attach_filter);
@@ -663,7 +656,7 @@ int sk_detach_filter(struct sock *sk)
663 sock_owned_by_user(sk)); 656 sock_owned_by_user(sk));
664 if (filter) { 657 if (filter) {
665 rcu_assign_pointer(sk->sk_filter, NULL); 658 rcu_assign_pointer(sk->sk_filter, NULL);
666 sk_filter_delayed_uncharge(sk, filter); 659 sk_filter_uncharge(sk, filter);
667 ret = 0; 660 ret = 0;
668 } 661 }
669 return ret; 662 return ret;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index a5ff5a89f376..7f902cad10f8 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -712,15 +712,21 @@ static void rx_queue_release(struct kobject *kobj)
712 712
713 713
714 map = rcu_dereference_raw(queue->rps_map); 714 map = rcu_dereference_raw(queue->rps_map);
715 if (map) 715 if (map) {
716 RCU_INIT_POINTER(queue->rps_map, NULL);
716 call_rcu(&map->rcu, rps_map_release); 717 call_rcu(&map->rcu, rps_map_release);
718 }
717 719
718 flow_table = rcu_dereference_raw(queue->rps_flow_table); 720 flow_table = rcu_dereference_raw(queue->rps_flow_table);
719 if (flow_table) 721 if (flow_table) {
722 RCU_INIT_POINTER(queue->rps_flow_table, NULL);
720 call_rcu(&flow_table->rcu, rps_dev_flow_table_release); 723 call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
724 }
721 725
722 if (atomic_dec_and_test(&first->count)) 726 if (atomic_dec_and_test(&first->count))
723 kfree(first); 727 kfree(first);
728 else
729 memset(kobj, 0, sizeof(*kobj));
724} 730}
725 731
726static struct kobj_type rx_queue_ktype = { 732static struct kobj_type rx_queue_ktype = {
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 7552495aff7a..fceeb37d7161 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
45 nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); 45 nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
46 lopt_size += nr_table_entries * sizeof(struct request_sock *); 46 lopt_size += nr_table_entries * sizeof(struct request_sock *);
47 if (lopt_size > PAGE_SIZE) 47 if (lopt_size > PAGE_SIZE)
48 lopt = __vmalloc(lopt_size, 48 lopt = vzalloc(lopt_size);
49 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
50 PAGE_KERNEL);
51 else 49 else
52 lopt = kzalloc(lopt_size, GFP_KERNEL); 50 lopt = kzalloc(lopt_size, GFP_KERNEL);
53 if (lopt == NULL) 51 if (lopt == NULL)
diff --git a/net/core/timestamping.c b/net/core/timestamping.c
index 0ae6c22da85b..c19bb4ee405e 100644
--- a/net/core/timestamping.c
+++ b/net/core/timestamping.c
@@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
96 struct phy_device *phydev; 96 struct phy_device *phydev;
97 unsigned int type; 97 unsigned int type;
98 98
99 skb_push(skb, ETH_HLEN); 99 if (skb_headroom(skb) < ETH_HLEN)
100 return false;
101 __skb_push(skb, ETH_HLEN);
100 102
101 type = classify(skb); 103 type = classify(skb);
102 104
103 skb_pull(skb, ETH_HLEN); 105 __skb_pull(skb, ETH_HLEN);
104 106
105 switch (type) { 107 switch (type) {
106 case PTP_CLASS_V1_IPV4: 108 case PTP_CLASS_V1_IPV4: