aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow.c12
-rw-r--r--net/core/net-sysfs.c7
-rw-r--r--net/core/sock.c6
3 files changed, 18 insertions, 7 deletions
diff --git a/net/core/flow.c b/net/core/flow.c
index 8ae42de9c79..e318c7e9804 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -358,6 +358,18 @@ void flow_cache_flush(void)
358 put_online_cpus(); 358 put_online_cpus();
359} 359}
360 360
361static void flow_cache_flush_task(struct work_struct *work)
362{
363 flow_cache_flush();
364}
365
366static DECLARE_WORK(flow_cache_flush_work, flow_cache_flush_task);
367
368void flow_cache_flush_deferred(void)
369{
370 schedule_work(&flow_cache_flush_work);
371}
372
361static int __cpuinit flow_cache_cpu_prepare(struct flow_cache *fc, int cpu) 373static int __cpuinit flow_cache_cpu_prepare(struct flow_cache *fc, int cpu)
362{ 374{
363 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu); 375 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 9d134636f87..4b4d0b0a354 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -669,11 +669,14 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
669 if (count) { 669 if (count) {
670 int i; 670 int i;
671 671
672 if (count > 1<<30) { 672 if (count > INT_MAX)
673 return -EINVAL;
674 count = roundup_pow_of_two(count);
675 if (count > (ULONG_MAX - sizeof(struct rps_dev_flow_table))
676 / sizeof(struct rps_dev_flow)) {
673 /* Enforce a limit to prevent overflow */ 677 /* Enforce a limit to prevent overflow */
674 return -EINVAL; 678 return -EINVAL;
675 } 679 }
676 count = roundup_pow_of_two(count);
677 table = vmalloc(RPS_DEV_FLOW_TABLE_SIZE(count)); 680 table = vmalloc(RPS_DEV_FLOW_TABLE_SIZE(count));
678 if (!table) 681 if (!table)
679 return -ENOMEM; 682 return -ENOMEM;
diff --git a/net/core/sock.c b/net/core/sock.c
index 0c67facf42f..002939cfc06 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -339,11 +339,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
339 unsigned long flags; 339 unsigned long flags;
340 struct sk_buff_head *list = &sk->sk_receive_queue; 340 struct sk_buff_head *list = &sk->sk_receive_queue;
341 341
342 /* Cast sk->rcvbuf to unsigned... It's pointless, but reduces 342 if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) {
343 number of warnings when compiling with -W --ANK
344 */
345 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
346 (unsigned)sk->sk_rcvbuf) {
347 atomic_inc(&sk->sk_drops); 343 atomic_inc(&sk->sk_drops);
348 trace_sock_rcvqueue_full(sk, skb); 344 trace_sock_rcvqueue_full(sk, skb);
349 return -ENOMEM; 345 return -ENOMEM;