summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-10-12 01:30:33 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-10-12 01:30:33 -0300
commite914f8eb445e8f74b00303c19c2ffceaedd16a05 (patch)
tree86b60bdecb3cf6abe8546f30803b673892a40335 /kernel
parent1c29f4306f557ef5d9ed515ec8881f4d1735b058 (diff)
Linux-libre 4.7.6-gnupck-4.7.6-gnu
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c6
-rw-r--r--kernel/power/hibernate.c4
-rw-r--r--kernel/power/snapshot.c10
-rw-r--r--kernel/trace/Makefile4
-rw-r--r--kernel/trace/trace.c29
5 files changed, 33 insertions, 20 deletions
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;