aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-04-08 23:19:40 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-08 23:52:40 -0400
commit9eb85125ce218a8b8d9a7c982510388e227adbec (patch)
tree320b87113d2c6b151f14e39d3a7e60174e19b0be
parent47788c58e66c050982241d9a05eb690daceb05a9 (diff)
blktrace: pass the right pointer to kfree()
Impact: fix kfree crash with non-standard act_mask string If passing a string with leading white spaces to strstrip(), the returned ptr != the original ptr. This bug was introduced by me. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <49DD694C.8020902@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/trace/blktrace.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index b32ff446c3fb..921ef5d1f0ba 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1377,12 +1377,12 @@ static int blk_trace_str2mask(const char *str)
1377{ 1377{
1378 int i; 1378 int i;
1379 int mask = 0; 1379 int mask = 0;
1380 char *s, *token; 1380 char *buf, *s, *token;
1381 1381
1382 s = kstrdup(str, GFP_KERNEL); 1382 buf = kstrdup(str, GFP_KERNEL);
1383 if (s == NULL) 1383 if (buf == NULL)
1384 return -ENOMEM; 1384 return -ENOMEM;
1385 s = strstrip(s); 1385 s = strstrip(buf);
1386 1386
1387 while (1) { 1387 while (1) {
1388 token = strsep(&s, ","); 1388 token = strsep(&s, ",");
@@ -1403,7 +1403,7 @@ static int blk_trace_str2mask(const char *str)
1403 break; 1403 break;
1404 } 1404 }
1405 } 1405 }
1406 kfree(s); 1406 kfree(buf);
1407 1407
1408 return mask; 1408 return mask;
1409} 1409}