Discussion:
[Linuxptp-devel] [PATCH] port: fix fda initialization.
Miroslav Lichvar
2014-11-05 11:22:43 UTC
Permalink
Initialize all descriptors to prevent polling invalid descriptors from
faulty ports.

Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
port.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/port.c b/port.c
index aae5910..6ce63f7 100644
--- a/port.c
+++ b/port.c
@@ -1401,7 +1401,7 @@ static void port_disable(struct port *p)
for (i = 0; i < N_TIMER_FDS; i++) {
close(p->fda.fd[FD_ANNOUNCE_TIMER + i]);
}
- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, FD_ANNOUNCE_TIMER + N_TIMER_FDS);
clock_fda_changed(p->clock);
}

@@ -2489,7 +2489,7 @@ struct port *port_open(int phc_index,
}
p->nrate.ratio = 1.0;

- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, FD_ANNOUNCE_TIMER + N_TIMER_FDS);
p->fault_fd = -1;
if (number) {
p->fault_fd = timerfd_create(CLOCK_MONOTONIC, 0);
--
1.9.3


------------------------------------------------------------------------------
Richard Cochran
2014-11-05 20:52:14 UTC
Permalink
Post by Miroslav Lichvar
Initialize all descriptors to prevent polling invalid descriptors from
faulty ports.
---
port.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/port.c b/port.c
index aae5910..6ce63f7 100644
--- a/port.c
+++ b/port.c
@@ -1401,7 +1401,7 @@ static void port_disable(struct port *p)
for (i = 0; i < N_TIMER_FDS; i++) {
close(p->fda.fd[FD_ANNOUNCE_TIMER + i]);
}
- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, FD_ANNOUNCE_TIMER + N_TIMER_FDS);
N_POLLFD instead?

Thanks,
Richard
Post by Miroslav Lichvar
clock_fda_changed(p->clock);
}
@@ -2489,7 +2489,7 @@ struct port *port_open(int phc_index,
}
p->nrate.ratio = 1.0;
- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, FD_ANNOUNCE_TIMER + N_TIMER_FDS);
p->fault_fd = -1;
if (number) {
p->fault_fd = timerfd_create(CLOCK_MONOTONIC, 0);
--
1.9.3
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
------------------------------------------------------------------------------
Miroslav Lichvar
2014-11-06 08:52:49 UTC
Permalink
Initialize all descriptors to prevent polling invalid descriptors from
faulty ports.

Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
port.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/port.c b/port.c
index aae5910..08a53b3 100644
--- a/port.c
+++ b/port.c
@@ -1401,7 +1401,7 @@ static void port_disable(struct port *p)
for (i = 0; i < N_TIMER_FDS; i++) {
close(p->fda.fd[FD_ANNOUNCE_TIMER + i]);
}
- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, N_POLLFD);
clock_fda_changed(p->clock);
}

@@ -2489,7 +2489,7 @@ struct port *port_open(int phc_index,
}
p->nrate.ratio = 1.0;

- port_clear_fda(p, N_TIMER_FDS);
+ port_clear_fda(p, N_POLLFD);
p->fault_fd = -1;
if (number) {
p->fault_fd = timerfd_create(CLOCK_MONOTONIC, 0);
--
1.9.3


------------------------------------------------------------------------------
Richard Cochran
2014-11-07 18:11:07 UTC
Permalink
Post by Miroslav Lichvar
Initialize all descriptors to prevent polling invalid descriptors from
faulty ports.
---
port.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Applied.

Thanks,
Richard

------------------------------------------------------------------------------
Loading...