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
This commit is contained in:
Hans Petter Selasky 2011-10-10 15:54:44 +00:00
parent d78e594bc9
commit f6c6639af8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226219

View File

@ -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++) {