[AX25]: Make ax2asc thread-proof
Ax2asc was still using a static buffer for all invocations which isn't exactly SMP-safe. Change ax2asc to take an additional result buffer as the argument. Change all callers to provide such a buffer. Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Tento commit je obsažen v:
@@ -1874,6 +1874,7 @@ static void ax25_info_stop(struct seq_file *seq, void *v)
|
||||
static int ax25_info_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
ax25_cb *ax25 = v;
|
||||
char buf[11];
|
||||
int k;
|
||||
|
||||
|
||||
@@ -1885,13 +1886,13 @@ static int ax25_info_show(struct seq_file *seq, void *v)
|
||||
seq_printf(seq, "%8.8lx %s %s%s ",
|
||||
(long) ax25,
|
||||
ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name,
|
||||
ax2asc(&ax25->source_addr),
|
||||
ax2asc(buf, &ax25->source_addr),
|
||||
ax25->iamdigi? "*":"");
|
||||
seq_printf(seq, "%s", ax2asc(&ax25->dest_addr));
|
||||
seq_printf(seq, "%s", ax2asc(buf, &ax25->dest_addr));
|
||||
|
||||
for (k=0; (ax25->digipeat != NULL) && (k < ax25->digipeat->ndigi); k++) {
|
||||
seq_printf(seq, ",%s%s",
|
||||
ax2asc(&ax25->digipeat->calls[k]),
|
||||
ax2asc(buf, &ax25->digipeat->calls[k]),
|
||||
ax25->digipeat->repeated[k]? "*":"");
|
||||
}
|
||||
|
||||
|
@@ -36,9 +36,8 @@ ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}};
|
||||
/*
|
||||
* ax25 -> ascii conversion
|
||||
*/
|
||||
char *ax2asc(ax25_address *a)
|
||||
char *ax2asc(char *buf, ax25_address *a)
|
||||
{
|
||||
static char buf[11];
|
||||
char c, *s;
|
||||
int n;
|
||||
|
||||
|
@@ -298,6 +298,8 @@ static void ax25_rt_seq_stop(struct seq_file *seq, void *v)
|
||||
|
||||
static int ax25_rt_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
char buf[11];
|
||||
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_puts(seq, "callsign dev mode digipeaters\n");
|
||||
else {
|
||||
@@ -308,7 +310,7 @@ static int ax25_rt_seq_show(struct seq_file *seq, void *v)
|
||||
if (ax25cmp(&ax25_rt->callsign, &null_ax25_address) == 0)
|
||||
callsign = "default";
|
||||
else
|
||||
callsign = ax2asc(&ax25_rt->callsign);
|
||||
callsign = ax2asc(buf, &ax25_rt->callsign);
|
||||
|
||||
seq_printf(seq, "%-9s %-4s",
|
||||
callsign,
|
||||
@@ -328,7 +330,8 @@ static int ax25_rt_seq_show(struct seq_file *seq, void *v)
|
||||
|
||||
if (ax25_rt->digipeat != NULL)
|
||||
for (i = 0; i < ax25_rt->digipeat->ndigi; i++)
|
||||
seq_printf(seq, " %s", ax2asc(&ax25_rt->digipeat->calls[i]));
|
||||
seq_printf(seq, " %s",
|
||||
ax2asc(buf, &ax25_rt->digipeat->calls[i]));
|
||||
|
||||
seq_puts(seq, "\n");
|
||||
}
|
||||
|
@@ -168,12 +168,14 @@ static void ax25_uid_seq_stop(struct seq_file *seq, void *v)
|
||||
|
||||
static int ax25_uid_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
char buf[11];
|
||||
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_printf(seq, "Policy: %d\n", ax25_uid_policy);
|
||||
else {
|
||||
struct ax25_uid_assoc *pt = v;
|
||||
|
||||
seq_printf(seq, "%6d %s\n", pt->uid, ax2asc(&pt->call));
|
||||
seq_printf(seq, "%6d %s\n", pt->uid, ax2asc(buf, &pt->call));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele