Re-fetch the interface handle after setting the config number,

because the previous interface handle gets freed when the config
number is set. This fixes a problem where memory could be accessed
after it was freed when the interface was ifconfig'd up.

Reviewed by:	n_hibma
This commit is contained in:
Ian Dowse 2002-07-15 14:37:36 +00:00
parent 19612036d9
commit 417d8f25fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100089
2 changed files with 4 additions and 1 deletions

View File

@ -363,7 +363,9 @@ kue_setmulti(struct kue_softc *sc)
Static void
kue_reset(struct kue_softc *sc)
{
if (usbd_set_config_no(sc->kue_udev, KUE_CONFIG_NO, 0)) {
if (usbd_set_config_no(sc->kue_udev, KUE_CONFIG_NO, 0) ||
usbd_device2interface_handle(sc->kue_udev, KUE_IFACE_IDX,
&sc->kue_iface)) {
printf("kue%d: getting interface handle failed\n",
sc->kue_unit);
}

View File

@ -121,6 +121,7 @@ struct kue_ether_desc {
#define KUE_CTL_WRITE 0x02
#define KUE_CONFIG_NO 1
#define KUE_IFACE_IDX 0
/*
* The interrupt endpoint is currently unused