From 48da5aa496e1ac1b1b456f559a8979b25349ac24 Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Sat, 28 Nov 2015 10:05:36 -0600
Subject: [PATCH] sched/pthread/: CRITICAL BUGFIX: Logic was wiping out the
 indication that of the type of a pthread.  Hence, it could be confused as a
 task.  Found because this was causing a crash when /proc/nnn/cmdline was
 printed.

---
 ChangeLog                      | 5 +++++
 sched/pthread/pthread_create.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index da0c769ba6..65044a859e 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -11177,3 +11177,8 @@
 	  procfs (2015-11-27).
 	* mtd/filemtd.c and smart.c:  Add support for a /dev/smart loop device.
 	  From Ken Petit (2015-11-28).
+	* sched/pthread/: CRITICAL BUGFIX: Logic was wiping out the indication
+	  that of the type of a pthread.  Hence, it could be confused as a
+	  task.  Found because this was causing a crash when /proc/nnn/cmdline
+	  was printed (2015-11-29).
+
diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c
index c22cead9a9..41c2a85799 100644
--- a/sched/pthread/pthread_create.c
+++ b/sched/pthread/pthread_create.c
@@ -430,7 +430,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
 
   /* Set the appropriate scheduling policy in the TCB */
 
-  ptcb->cmn.flags &= TCB_FLAG_POLICY_MASK;
+  ptcb->cmn.flags &= ~TCB_FLAG_POLICY_MASK;
   switch (policy)
     {
       default:
-- 
GitLab