public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	<stable@vger.kernel.org>, Stephen Boyd <sboyd@codeaurora.org>,
	Lime Yang <limey@codeaurora.org>,
	Vikram Mulukutla <markivx@codeaurora.org>
Subject: [for-next][PATCH 5/5] tracing: Fix unmapping loop in tracing_mark_write
Date: Tue, 10 Feb 2015 12:02:26 -0500	[thread overview]
Message-ID: <20150210170407.854141610@goodmis.org> (raw)
In-Reply-To: 20150210170221.012858236@goodmis.org

[-- Attachment #1: 0005-tracing-Fix-unmapping-loop-in-tracing_mark_write.patch --]
[-- Type: text/plain, Size: 1297 bytes --]

From: Vikram Mulukutla <markivx@codeaurora.org>

Commit 6edb2a8a385f0cdef51dae37ff23e74d76d8a6ce introduced
an array map_pages that contains the addresses returned by
kmap_atomic. However, when unmapping those pages, map_pages[0]
is unmapped before map_pages[1], breaking the nesting requirement
as specified in the documentation for kmap_atomic/kunmap_atomic.

This was caught by the highmem debug code present in kunmap_atomic.
Fix the loop to do the unmapping properly.

Link: http://lkml.kernel.org/r/1418871056-6614-1-git-send-email-markivx@codeaurora.org

Cc: stable@vger.kernel.org # 3.5+
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reported-by: Lime Yang <limey@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5afce60e1b68..2078b86750e0 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4928,7 +4928,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 	*fpos += written;
 
  out_unlock:
-	for (i = 0; i < nr_pages; i++){
+	for (i = nr_pages - 1; i >= 0; i--) {
 		kunmap_atomic(map_page[i]);
 		put_page(pages[i]);
 	}
-- 
2.1.4



      parent reply	other threads:[~2015-02-10 17:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 17:02 [for-next][PATCH 0/5] tracing: Some last minute updates for 3.20 Steven Rostedt
2015-02-10 17:02 ` [for-next][PATCH 1/5] tracing: Update the TRACE_EVENT fields available in the sample code Steven Rostedt
2015-02-10 17:02 ` [for-next][PATCH 2/5] tracing: Add TRACE_EVENT_CONDITION sample Steven Rostedt
2015-02-10 17:02 ` [for-next][PATCH 3/5] tracing: Add TRACE_EVENT_FN example Steven Rostedt
2015-02-10 17:02 ` [for-next][PATCH 4/5] tracing: Add samples of DECLARE_EVENT_CLASS() and DEFINE_EVENT() Steven Rostedt
2015-02-10 17:02 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150210170407.854141610@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=limey@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markivx@codeaurora.org \
    --cc=mingo@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox