kern/124996: "filesystem goof: vop_panic[vop_revoke]" panic on removal of USB serial adapter

Arthur Hartwig arthur.hartwig at nokia.com
Thu Jun 26 02:30:06 UTC 2008


>Number:         124996
>Category:       kern
>Synopsis:       "filesystem goof: vop_panic[vop_revoke]" panic on removal of USB serial adapter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 26 02:30:06 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Arthur Hartwig
>Release:        6.3 and 7.0, i386 and amd64 architectures
>Organization:
Nokia
>Environment:
>Description:
Removal of a USB serial adapter over which a login has occurred can cause a variety of panics. I seem to have resolved most of them by including the changes in src/sys/kern/tty.c from revision 1.273 to 1.273.2.4 however the filesystem goof panic remains.


>How-To-Repeat:
Edit /etc/ttys to allow login on /dev/ttyU0, plug in USB serial adapter, run the included usb-login program to start getty/login on the USB serial adapter, login, issue a command that generates a fair amount of output (e.g. "dmesg") and while output is active remove the USB adapter. It may be necessary to repeat this a couple of times to provoke the panic. Note that I have seen at least three different panics produced by this procedure on released versions of both FreeBSD 6.3 and 7.0 but including the mentioned change to tty.c eliminates the panics other than the "filesystem goof".

I used a ATEN UC-232A as the USB to serial adapter (FreeBSD uplcom driver), plugged it into the FreeBSD system and connected the RS-232 side of the adapter to a serial port on a PC running Linux. I used minicom on the Linux system to access the serial port and set the serial port speed to 9600.

>Fix:
Update sys/kern/tty.c to include the changes in revision 1.273.2.4 from 1.273 and add:

       /* Since the hardware has gone, carrier is not asserted */
       CLR(tp->t_state, TS_CARR_ON);
       ttymodem(tp, 0);

to ttygone() immediately before the sequence of calls to wakeup().

I built the following program by the command:

# cc -Wall usb-login.c -o usb-login -lc -lutil

--------------------------- usb-login.c ---------------------------------------
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
#include <libutil.h>
#include <unistd.h>

int main(int argc, char **argv)
{
        int tfd, rc, savefd, pid;
        struct termios tattr;

        tfd = open("/dev/ttyU0", O_RDWR | O_NONBLOCK);
        if (tfd == -1 ) {
                perror("open(ttyU0) failed");
                exit(EXIT_FAILURE);
        }

        fcntl(tfd, F_SETFL, 0);         /* Clear O_NONBLOCK */
        tcgetattr(tfd, &tattr);
        if ((tattr.c_cflag & CLOCAL) ==0) {
                /* Set terminal local so modem signals are ignored */
                tattr.c_cflag |= CLOCAL;
                tattr.c_ispeed = 9600;
                tattr.c_ospeed = 9600;
                tcsetattr(tfd, TCSANOW, &tattr);
        }

        pid = fork();
        if (pid == 0) {
                /* Child process */
                savefd = dup(0);
                rc = login_tty(tfd);
                if (rc == -1) {
                        perror("login_tty() failed");
                        exit(EXIT_FAILURE);
                }

                execl("/usr/libexec/getty", "getty", "std.9600", "-", NULL);

                dup2(savefd, 0);
        }
        else {
                printf("getty/login in process %d\n", pid);
                wait(&rc);
        }
        exit(EXIT_SUCCESS);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list