libax25 axio_flush bug hangs node and fix

From: Tihomir Heidelberg (terhi.victor@logonet.com)
Date: Tue Oct 15 2002 - 12:57:16 EEST

  • Next message: Mike Fenske: "Re: IP over Packet Ham Radio"

    Hi

    I noticed that my awznode (a variant of linux node) hangs and
    use maximum CPU when user starts any external command and
    incoming AX.25 connection get broken.

    After tracing found something strange in libax25-0.0.10 in
    ax25io.c.

    In function static int flush_obuf(ax25io *p)
    it returns -1 if write to output file descriptor failed
    if ((ret = write(p->ofd, p->obuf, p->optr < p->paclen ? p->optr : p->paclen)) < 0)
    return -1

    but, in axio_flush(ax25io *p)
    we have following loop:
    while (p->optr) {
                    FD_ZERO(&fdset);
                    FD_SET(p->ofd, &fdset);
                    if (select(p->ofd+1, NULL, &fdset, NULL, NULL)<0)
                            return -1;
                    flushed+=flush_obuf(p);
                    flushed+=j;
    }
    it is obvious that this loop will never end if above mentioned write
    failed. After breaking this loop if flush_obuf returns -1 my awnnode
    does not hangs.

    Can maintainer of libax25 fix this in next release ?

    73 de Tihomir Heidelberg, terhi.victor@logonet.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-hams" in
    the body of a message to rpqu@nttdocomo.co.jp
    More majordomo info at http://vger.kernel.org/majordomo-info.html



    This archive was generated by hypermail 2b30 : Tue Oct 15 2002 - 12:57:17 EEST