From e914f8eb445e8f74b00303c19c2ffceaedd16a05 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 12 Oct 2016 01:30:33 -0300 Subject: Linux-libre 4.7.6-gnu --- kernel/cgroup.c | 6 ++++++ kernel/power/hibernate.c | 4 ++-- kernel/power/snapshot.c | 10 +++++----- kernel/trace/Makefile | 4 ++++ kernel/trace/trace.c | 29 ++++++++++++++++------------- 5 files changed, 33 insertions(+), 20 deletions(-) (limited to 'kernel') diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e0be49fc3..129a7ca5f 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -6240,6 +6240,12 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd) if (cgroup_sk_alloc_disabled) return; + /* Socket clone path */ + if (skcd->val) { + cgroup_get(sock_cgroup_ptr(skcd)); + return; + } + rcu_read_lock(); while (true) { diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 31b665ba1..2444206e9 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -299,12 +299,12 @@ static int create_image(int platform_mode) save_processor_state(); trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true); error = swsusp_arch_suspend(); + /* Restore control flow magically appears here */ + restore_processor_state(); trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false); if (error) printk(KERN_ERR "PM: Error %d creating hibernation image\n", error); - /* Restore control flow magically appears here */ - restore_processor_state(); if (!in_suspend) events_check_enabled = false; diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 542163a01..dc3bab15e 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -812,9 +812,9 @@ static bool memory_bm_pfn_present(struct memory_bitmap *bm, int index, unsigned */ static bool rtree_next_node(struct memory_bitmap *bm, int index) { - bm->cur[index].node = list_entry(bm->cur[index].node->list.next, - struct rtree_node, list); - if (&bm->cur[index].node->list != &bm->cur[index].zone->leaves) { + if (!list_is_last(&bm->cur[index].node->list, &bm->cur[index].zone->leaves)) { + bm->cur[index].node = list_entry(bm->cur[index].node->list.next, + struct rtree_node, list); bm->cur[index].node_pfn += BM_BITS_PER_BLOCK; bm->cur[index].node_bit = 0; touch_softlockup_watchdog(); @@ -822,9 +822,9 @@ static bool rtree_next_node(struct memory_bitmap *bm, int index) } /* No more nodes, goto next zone */ - bm->cur[index].zone = list_entry(bm->cur[index].zone->list.next, + if (!list_is_last(&bm->cur[index].zone->list, &bm->zones)) { + bm->cur[index].zone = list_entry(bm->cur[index].zone->list.next, struct mem_zone_bm_rtree, list); - if (&bm->cur[index].zone->list != &bm->zones) { bm->cur[index].node = list_entry(bm->cur[index].zone->leaves.next, struct rtree_node, list); bm->cur[index].node_pfn = 0; diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index 979e7bfbd..d0a1617b5 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile @@ -1,4 +1,8 @@ +# We are fully aware of the dangers of __builtin_return_address() +FRAME_CFLAGS := $(call cc-disable-warning,frame-address) +KBUILD_CFLAGS += $(FRAME_CFLAGS) + # Do not instrument the tracer itself: ifdef CONFIG_FUNCTION_TRACER diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8a4bd6b68..77eeab277 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4890,19 +4890,20 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, struct trace_iterator *iter = filp->private_data; ssize_t sret; - /* return any leftover data */ - sret = trace_seq_to_user(&iter->seq, ubuf, cnt); - if (sret != -EBUSY) - return sret; - - trace_seq_init(&iter->seq); - /* * Avoid more than one consumer on a single file descriptor * This is just a matter of traces coherency, the ring buffer itself * is protected. */ mutex_lock(&iter->mutex); + + /* return any leftover data */ + sret = trace_seq_to_user(&iter->seq, ubuf, cnt); + if (sret != -EBUSY) + goto out; + + trace_seq_init(&iter->seq); + if (iter->trace->read) { sret = iter->trace->read(iter, filp, ubuf, cnt, ppos); if (sret) @@ -5929,9 +5930,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, return -EBUSY; #endif - if (splice_grow_spd(pipe, &spd)) - return -ENOMEM; - if (*ppos & (PAGE_SIZE - 1)) return -EINVAL; @@ -5941,6 +5939,9 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, len &= PAGE_MASK; } + if (splice_grow_spd(pipe, &spd)) + return -ENOMEM; + again: trace_access_lock(iter->cpu_file); entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file); @@ -5998,19 +5999,21 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, /* did we read anything? */ if (!spd.nr_pages) { if (ret) - return ret; + goto out; + ret = -EAGAIN; if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) - return -EAGAIN; + goto out; ret = wait_on_pipe(iter, true); if (ret) - return ret; + goto out; goto again; } ret = splice_to_pipe(pipe, &spd); +out: splice_shrink_spd(&spd); return ret; -- cgit v1.2.3-54-g00ecf