On Mon, May 02, 2022 at 11:06:02AM +0200, Arkadiusz Kubalewski wrote: > Used by synce_port to create, control and destroy RX/TX threads. > Ports in sync mode can use only TX thread (device in external input > mode) or both RX and TX threads (device in internal input mode).
> +++ b/synce_port_ctrl.c > @@ -0,0 +1,1077 @@ > +static int init_ql_str(struct allowed_qls_head *qls_stailq_head, > + const char *allowed_qls) > +{ ... > + ptr = allowed_qls; > + while (*ptr) { > + unsigned long value; > + struct ql *newql; > + > + if (ptr > allowed_qls + allowed_qls_len) { > + break; > + } This check needs to be performed before the "*ptr" in the while condition to avoid invalid memory access. > +static int init_allowed_ext_qls(struct synce_port_rx *rx, struct config *cfg, > + const char *name) > +{ > + const char *allowed_qls; > + > + STAILQ_INIT((struct allowed_qls_head *)&rx->allowed_ext_qls); The casting looks wrong/unnecessary, or at least it is causing compiler warnings about breaking strict aliasing. > +static int thread_start_wait(struct thread_common_data *cd) > +{ > + int cnt = (cd->heartbeat_usec / THREAD_STOP_SLEEP_USEC) + 1; > + > + if (cd->state == THREAD_STARTED) { > + pr_debug("THREAD_STARTED"); > + > + return 0; > + } > + > + while (cnt-- && cd->state != THREAD_STARTED) { > + usleep(THREAD_STOP_SLEEP_USEC); > + } This should be THREAD_START_SLEEP_USEC? And shouldn't be there some locking between the threads, e.g. with mutexes? -- Miroslav Lichvar _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel