[dpdk-stable] patch 'examples/performance-thread: fix out-of-bounds	tls array' has been queued to LTS release 16.11.4
    luca.boccassi at gmail.com 
    luca.boccassi at gmail.com
       
    Mon Oct 30 16:35:11 CET 2017
    
    
  
Hi,
FYI, your patch has been queued to LTS release 16.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/01/17. So please
shout if anyone has objections.
Thanks.
Kind regards,
Luca Boccassi
---
>From 5ab17b0175e2f8c25292168b83b177501af8e19e Mon Sep 17 00:00:00 2001
From: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
Date: Wed, 20 Sep 2017 10:20:24 +0200
Subject: [PATCH] examples/performance-thread: fix out-of-bounds tls array
[ upstream commit c874523dc9fc9c384a760eb5db8c6f295185e5e3 ]
Overrunning array per_lcore_this_sched->current_lthread->tls->data of
1024 8-byte elements at element index 1024 using index k.
Fixed by correct check k condition.
Coverity issue: 143462, 143463
Fixes: 116819b9ed0d ("examples/performance-thread: add lthread subsystem")
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski at intel.com>
---
 examples/performance-thread/common/lthread_tls.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/performance-thread/common/lthread_tls.c b/examples/performance-thread/common/lthread_tls.c
index 6876f831b..e58388b99 100644
--- a/examples/performance-thread/common/lthread_tls.c
+++ b/examples/performance-thread/common/lthread_tls.c
@@ -199,11 +199,12 @@ void _lthread_tls_destroy(struct lthread *lt)
 void
 *lthread_getspecific(unsigned int k)
 {
+	void *res = NULL;
 
-	if (k > LTHREAD_MAX_KEYS)
-		return NULL;
+	if (k < LTHREAD_MAX_KEYS)
+		res = THIS_LTHREAD->tls->data[k];
 
-	return THIS_LTHREAD->tls->data[k];
+	return res;
 }
 
 /*
@@ -213,7 +214,7 @@ void
  */
 int lthread_setspecific(unsigned int k, const void *data)
 {
-	if (k > LTHREAD_MAX_KEYS)
+	if (k >= LTHREAD_MAX_KEYS)
 		return POSIX_ERRNO(EINVAL);
 
 	int n = THIS_LTHREAD->tls->nb_keys_inuse;
-- 
2.11.0
    
    
More information about the stable
mailing list