Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: sys/uvideo: fix crash on close isochronous endpoint's webcam
To:
Marcus Glocker <marcus@nazgul.ch>
Cc:
tech@openbsd.org
Date:
Sat, 08 Mar 2025 00:57:22 +0100

Download raw body.

Thread
On Fri, 07 Mar 2025 21:39:30 +0100,
Marcus Glocker <marcus@nazgul.ch> wrote:
>
> On Thu, Mar 06, 2025 at 09:12:55AM GMT, Kirill A. Korinsky wrote:
>
> > tech@,
> >
> > I'd like to fix a crash in uvide when I detach my Elgato webcam when
> > it's streamming.
> >
> > uvideo_vs_close is called from videoclose and by VIDIOC_STREAMOFF. When
> > it's happened on detached webcam with isochronous endpoint, the system
> > crashes inside usbd_set_interface.
> >
> > Ok?
>
> Usually we're using usbd_is_dying() to return from a function at the
> very beginning.  Would it also work in your case to return from
> uvideo_vs_close() at the very beginning instead of only wrapping it
> around usbd_set_interface()?
>

Well, I assume that usually driver doesn't sleep before call set interface.

I had tried to move usbd_is_dying(sc->sc_udev) to the first line of
uvideo_vs_close, and it crashed inside usbd_set_interface().

And when I had moved it back, after sleep, it works.

--
wbr, Kirill