xairy / raw-gadget

USB Raw Gadget — a low-level interface for the Linux USB Gadget subsystem
333 stars 35 forks source link

ioctl_ep_read does not return length of data read #7

Closed philhug closed 4 years ago

philhug commented 4 years ago

ioctl_ep_read does not update the length field.

It only copies back to user space the data buffer and not the header with the length field

        ret = copy_to_user((void __user *)(value + sizeof(io)), data, length);

Same for ioctl_ep0_read

xairy commented 4 years ago

The fix is upstream, I've updated the module in the repo. Thanks!

(There are also some other fixes pending that will actually slightly change the interface.)

xairy commented 4 years ago

Nevermind, the fix is not upstream yet, should be merged soon.

xairy commented 4 years ago

For now you can find the fixes in this tree:

https://github.com/xairy/linux/tree/raw-gadget

philhug commented 4 years ago

Thanks alot!

xairy commented 4 years ago

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6e507644209b4a043363e165855a3a3050c4d40e