diff options
author | hselasky <hselasky@FreeBSD.org> | 2011-10-10 15:54:44 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2011-10-10 15:54:44 +0000 |
commit | 09089cc9ae9e4f73f43eda7d6b9dac8a2a1a0707 (patch) | |
tree | 48eb4f3ef7bb621dbd1ca1cff293c9bcf54e91f0 /sys/dev | |
parent | a38603b0b57960e07b576fdc7c8ed64d919770d0 (diff) | |
download | FreeBSD-src-09089cc9ae9e4f73f43eda7d6b9dac8a2a1a0707.zip FreeBSD-src-09089cc9ae9e4f73f43eda7d6b9dac8a2a1a0707.tar.gz |
Bugfix: The ucom detach function is sometimes called on zeroed structures.
Check for this case and just return, so that the UCOM unit number zero is
not accidentially freed.
Submitted by: Danish FreeBSD user at EuroBSDcon 2011
MFC after: 3 days
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/serial/usb_serial.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c index b0ff3bf..61885ea 100644 --- a/sys/dev/usb/serial/usb_serial.c +++ b/sys/dev/usb/serial/usb_serial.c @@ -289,6 +289,9 @@ ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) { uint32_t subunit; + if (ssc->sc_subunits == 0) + return; /* not initialized */ + usb_proc_drain(&ssc->sc_tq); for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { |