Fix unsafe reference of foreign master announce message.
When computing a port's best foreign master, we make use of a message reference that possibly might have been dropped by calling msg_put in the fc_prune subroutine. This commit fixes the issue by copying the needed data from the message before pruning. [ Actually, since msg_put only places the message into a list without altering its contents, there was no ill effect. But using a message after having released it is just plain wrong. ] Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
3616692203
commit
7ac297a082
4
port.c
4
port.c
|
@ -1141,13 +1141,13 @@ struct foreign_clock *port_compute_best(struct port *p)
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
announce_to_dataset(tmp, p->clock, &fc->dataset);
|
||||||
|
|
||||||
fc_prune(fc);
|
fc_prune(fc);
|
||||||
|
|
||||||
if (fc->n_messages < FOREIGN_MASTER_THRESHOLD)
|
if (fc->n_messages < FOREIGN_MASTER_THRESHOLD)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
announce_to_dataset(tmp, p->clock, &fc->dataset);
|
|
||||||
|
|
||||||
if (!p->best)
|
if (!p->best)
|
||||||
p->best = fc;
|
p->best = fc;
|
||||||
else if (dscmp(&fc->dataset, &p->best->dataset) > 0)
|
else if (dscmp(&fc->dataset, &p->best->dataset) > 0)
|
||||||
|
|
Loading…
Reference in New Issue