On Mon, Mar 08, 2021 at 06:09:52PM +0000, Marfaba Stewart wrote:

> Synopsis:     Raspberry Pi 3B+ panic on changing video0 permissions for motion
> Category:     arm
> Environment:
>       System      : OpenBSD 6.9
>       Details     : OpenBSD 6.9-beta (GENERIC.MP) #1056: Sat Mar
>                       6 14:04:42 MST 2021
> [email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> 
>       Architecture: OpenBSD.arm64
>       Machine     : arm64
> Description:
>       panic occurs when _motion has permission to access camera
> How-To-Repeat:
>       attach Logitech webcam, chmod g+rw /dev/video0, reboot
>       (where _motion is in the group assigned to /dev/video0)
> Fix:
>       unknown. If _motion's group doesn't have access, then
> the panic does not occur. I've tried variations on the group,
> when camera is plugged in, starting and stopping motion, etc.
> I see a similar error from 2017 and am including it at the end of
> this email. System always froze when trying
> machine ddbcpu x (for x in 0,1,3)
> 
>       If motion should work with this camera, I can try it
> on other Raspberry Pi 3B+ and/or other cameras in the
> future.
> 
> I'll number and summarize the sections I include.
> 
> 1. output of sendbug -P.
> 2. /var/run/dmesg.boot
> 3. pkg_info (motion and dependencies)
> 4. permissions
> 5. motion messages
> 6.  rebooting so camera can be detected.
>       ddb panic, trace, registers, ps, dmesg
> 7. similar error, openbsd-bugs, 2017-06-09

Does this patch make a difference?


Index: sys/dev/usb/dwc2/dwc2.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/dwc2/dwc2.c,v
retrieving revision 1.53
diff -u -p -u -p -r1.53 dwc2.c
--- sys/dev/usb/dwc2/dwc2.c     28 Jan 2021 01:48:54 -0000      1.53
+++ sys/dev/usb/dwc2/dwc2.c     8 Mar 2021 21:00:15 -0000
@@ -1235,11 +1235,14 @@ dwc2_device_start(struct usbd_xfer *xfer
        if (!dwc2_urb)
                return USBD_NOMEM;
 
+       KASSERT(dwc2_urb->packet_count == xfer->nframes);
        memset(dwc2_urb, 0, sizeof(*dwc2_urb) +
-           sizeof(dwc2_urb->iso_descs[0]) * DWC2_MAXISOCPACKETS);
+           sizeof(dwc2_urb->iso_descs[0]) * dwc2_urb->packet_count);
+
+       dwc2_urb->packet_count = xfer->nframes;
 
        dwc2_hcd_urb_set_pipeinfo(hsotg, dwc2_urb, addr, epnum, xfertype, dir,
-                                 mps);
+           mps);
 
        if (xfertype == UE_CONTROL) {
                dwc2_urb->setup_usbdma = &dpipe->req_dma;
@@ -1267,7 +1270,6 @@ dwc2_device_start(struct usbd_xfer *xfer
        dwc2_urb->length = len;
        dwc2_urb->flags = flags;
        dwc2_urb->status = -EINPROGRESS;
-       dwc2_urb->packet_count = xfer->nframes;
 
        if (xfertype == UE_INTERRUPT ||
            xfertype == UE_ISOCHRONOUS) {
@@ -1305,7 +1307,7 @@ dwc2_device_start(struct usbd_xfer *xfer
        xfer->actlen = 0;
 
        KASSERT(xfertype != UE_ISOCHRONOUS ||
-           xfer->nframes < DWC2_MAXISOCPACKETS);
+           xfer->nframes <= dwc2_urb->packet_count);
        KASSERTMSG(xfer->nframes == 0 || xfertype == UE_ISOCHRONOUS,
            "nframes %d xfertype %d\n", xfer->nframes, xfertype);
 

Reply via email to