diff options
author | Fabien Romano <fabien@cvs.openbsd.org> | 2010-03-15 11:13:41 +0000 |
---|---|---|
committer | Fabien Romano <fabien@cvs.openbsd.org> | 2010-03-15 11:13:41 +0000 |
commit | d9205c1f635ca1642badf4bcdfd8bf7b1e672877 (patch) | |
tree | 75adceb10cf6c463a981ae7191b8f23d0d652af3 /sys | |
parent | 8a0511f6437d5c6de63db694d280b43d1b8d3426 (diff) |
Correct return from attach on error, add splx() and urndis_stop().
This fix a crash on detach.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_urndis.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c index 967940590a7..e8b32725af9 100644 --- a/sys/dev/usb/if_urndis.c +++ b/sys/dev/usb/if_urndis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urndis.c,v 1.17 2010/03/14 22:50:41 mk Exp $ */ +/* $OpenBSD: if_urndis.c,v 1.18 2010/03/15 11:13:40 fabien Exp $ */ /* * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> @@ -1479,6 +1479,8 @@ urndis_attach(struct device *parent, struct device *self, void *aux) if (urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0, &buf, &bufsz) != RNDIS_STATUS_SUCCESS) { printf("%s: unable to get hardware address\n", DEVNAME(sc)); + urndis_stop(sc); + splx(s); return; } @@ -1490,9 +1492,10 @@ urndis_attach(struct device *parent, struct device *self, void *aux) printf("%s: invalid address\n", DEVNAME(sc)); free(buf, M_TEMP); urndis_stop(sc); + splx(s); return; } - + /* Initialize packet filter */ sc->sc_filter = RNDIS_PACKET_TYPE_BROADCAST; sc->sc_filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; @@ -1501,6 +1504,7 @@ urndis_attach(struct device *parent, struct device *self, void *aux) sizeof(filter)) != RNDIS_STATUS_SUCCESS) { printf("%s: unable to set data filters\n", DEVNAME(sc)); urndis_stop(sc); + splx(s); return; } |