Re: [PATCH] signal/usb: Replace kill_pid_info_as_cred with kill_pid_usb_asyncio

From: Alan Stern
Date: Tue May 21 2019 - 11:32:51 EST


On Tue, 21 May 2019, Eric W. Biederman wrote:

> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> writes:

> >> req = (struct usb_ctrlrequest *) buf;
> >> req->bRequestType = USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE;
> >> req->bRequest = USB_REQ_GET_DESCRIPTOR;
> >> req->wValue = htole16(USB_DT_DEVICE << 8);
> >> req->wIndex = htole16(0);
> >> req->wLength = htole16(sizeof(buf) - sizeof(*req));
> >
> > In fact, these values are supposed to be in host-endian order, not
> > necessarily little-endian. The USB core converts them if necessary.
>
> Please look again. In include/uapi/linux/ch9.h those fields are
> explicitly defined as little endian and the code in devio.c for
> USBDEVFS_URB_TYPE_CONTROL treats them as little endian. Perhaps there
> is a mismatch here but I haven't seen it and I needed this change to get
> the code to work on big endian.

Oops -- you're right. I was thinking of the USBDEVFS_CONTROL ioctl.
Sorry for the mistake.

Alan Stern