lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1109062317580.7016@swampdragon.chaosbits.net>
Date:	Tue, 6 Sep 2011 23:21:04 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	linux-kernel@...r.kernel.org
cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	J Freyensee <james_p_freyensee@...ux.intel.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jeremy Rocher <rocher.jeremy@...il.com>,
	Sergei Trofimovich <slyfox@...too.org>
Subject: [PATCH] misc/pti: give 'comm' function scope in
 pti_control_frame_built_and_sent()

In drivers/misc/pti.c::pti_control_frame_built_and_sent() we assign
'comm' to 'thread_name_p' if (!thread_name). The problem is that 'comm'
then goes out of scope and later we use 'thread_name_p' which now
refers to an out-of-scope variable.
To fix that, simply move 'comm' up to have function scope.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/misc/pti.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

 Only compile tested.

diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 06df187..0b56e3f 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -165,6 +165,11 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc,
 static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
 					     const char *thread_name)
 {
+	/*
+	 * Since we access the comm member in current's task_struct, we only
+	 * need to be as large as what 'comm' in that structure is.
+	 */
+	char comm[TASK_COMM_LEN];
 	struct pti_masterchannel mccontrol = {.master = CONTROL_ID,
 					      .channel = 0};
 	const char *thread_name_p;
@@ -172,13 +177,6 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
 	u8 control_frame[CONTROL_FRAME_LEN];
 
 	if (!thread_name) {
-		/*
-		 * Since we access the comm member in current's task_struct,
-		 * we only need to be as large as what 'comm' in that
-		 * structure is.
-		 */
-		char comm[TASK_COMM_LEN];
-
 		if (!in_interrupt())
 			get_task_comm(comm, current);
 		else
-- 
1.7.6.1


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ