diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2009-07-26 22:11:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-26 22:11:14 -0400 |
commit | dcf777f6ed9799c5ac90ac17a5c369e6b73ca92e (patch) | |
tree | dc15b2d5800241d124528d627f8b039ac29d32d4 /net/rose/rose_route.c | |
parent | d513d018e2236930b6163241bbdce64d2c0de49e (diff) |
NET: ROSE: Don't use static buffer.
The use of a static buffer in rose2asc() to return its result is not
threadproof and can result in corruption if multiple threads are trying
to use one of the procfs files based on rose2asc().
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose/rose_route.c')
-rw-r--r-- | net/rose/rose_route.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index a81066a1010a..9478d9b3d977 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
@@ -1104,6 +1104,7 @@ static void rose_node_stop(struct seq_file *seq, void *v) | |||
1104 | 1104 | ||
1105 | static int rose_node_show(struct seq_file *seq, void *v) | 1105 | static int rose_node_show(struct seq_file *seq, void *v) |
1106 | { | 1106 | { |
1107 | char rsbuf[11]; | ||
1107 | int i; | 1108 | int i; |
1108 | 1109 | ||
1109 | if (v == SEQ_START_TOKEN) | 1110 | if (v == SEQ_START_TOKEN) |
@@ -1112,13 +1113,13 @@ static int rose_node_show(struct seq_file *seq, void *v) | |||
1112 | const struct rose_node *rose_node = v; | 1113 | const struct rose_node *rose_node = v; |
1113 | /* if (rose_node->loopback) { | 1114 | /* if (rose_node->loopback) { |
1114 | seq_printf(seq, "%-10s %04d 1 loopback\n", | 1115 | seq_printf(seq, "%-10s %04d 1 loopback\n", |
1115 | rose2asc(&rose_node->address), | 1116 | rose2asc(rsbuf, &rose_node->address), |
1116 | rose_node->mask); | 1117 | rose_node->mask); |
1117 | } else { */ | 1118 | } else { */ |
1118 | seq_printf(seq, "%-10s %04d %d", | 1119 | seq_printf(seq, "%-10s %04d %d", |
1119 | rose2asc(&rose_node->address), | 1120 | rose2asc(rsbuf, &rose_node->address), |
1120 | rose_node->mask, | 1121 | rose_node->mask, |
1121 | rose_node->count); | 1122 | rose_node->count); |
1122 | 1123 | ||
1123 | for (i = 0; i < rose_node->count; i++) | 1124 | for (i = 0; i < rose_node->count; i++) |
1124 | seq_printf(seq, " %05d", | 1125 | seq_printf(seq, " %05d", |
@@ -1267,7 +1268,7 @@ static void rose_route_stop(struct seq_file *seq, void *v) | |||
1267 | 1268 | ||
1268 | static int rose_route_show(struct seq_file *seq, void *v) | 1269 | static int rose_route_show(struct seq_file *seq, void *v) |
1269 | { | 1270 | { |
1270 | char buf[11]; | 1271 | char buf[11], rsbuf[11]; |
1271 | 1272 | ||
1272 | if (v == SEQ_START_TOKEN) | 1273 | if (v == SEQ_START_TOKEN) |
1273 | seq_puts(seq, | 1274 | seq_puts(seq, |
@@ -1279,7 +1280,7 @@ static int rose_route_show(struct seq_file *seq, void *v) | |||
1279 | seq_printf(seq, | 1280 | seq_printf(seq, |
1280 | "%3.3X %-10s %-9s %05d ", | 1281 | "%3.3X %-10s %-9s %05d ", |
1281 | rose_route->lci1, | 1282 | rose_route->lci1, |
1282 | rose2asc(&rose_route->src_addr), | 1283 | rose2asc(rsbuf, &rose_route->src_addr), |
1283 | ax2asc(buf, &rose_route->src_call), | 1284 | ax2asc(buf, &rose_route->src_call), |
1284 | rose_route->neigh1->number); | 1285 | rose_route->neigh1->number); |
1285 | else | 1286 | else |
@@ -1289,10 +1290,10 @@ static int rose_route_show(struct seq_file *seq, void *v) | |||
1289 | if (rose_route->neigh2) | 1290 | if (rose_route->neigh2) |
1290 | seq_printf(seq, | 1291 | seq_printf(seq, |
1291 | "%3.3X %-10s %-9s %05d\n", | 1292 | "%3.3X %-10s %-9s %05d\n", |
1292 | rose_route->lci2, | 1293 | rose_route->lci2, |
1293 | rose2asc(&rose_route->dest_addr), | 1294 | rose2asc(rsbuf, &rose_route->dest_addr), |
1294 | ax2asc(buf, &rose_route->dest_call), | 1295 | ax2asc(buf, &rose_route->dest_call), |
1295 | rose_route->neigh2->number); | 1296 | rose_route->neigh2->number); |
1296 | else | 1297 | else |
1297 | seq_puts(seq, | 1298 | seq_puts(seq, |
1298 | "000 * * 00000\n"); | 1299 | "000 * * 00000\n"); |