Skip to contentSkip to conversation

NFC: pn533: don't send USB data off of the stack

PATCH Superseded Greg Kroah-Hartman 1 participant 1 message May 19, 2018 USB

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH v3 1/1 NFC: pn533: don't send USB data off of the stack

Quoted 6 lines · Johan Hovold
Quoted 5 lines · Greg Kroah-Hartman

It's amazing that this driver ever worked, but now that x86 doesn't allow USB data to be sent off of the stack, it really does not work at all. Fix this up by properly allocating the data for the small "commands" that get sent to the device.

Quoted 7 lines
Quoted 2 lines

The USB stack will free the buffer when the data has been transmitted, that is why there is no kfree() to mirror the call to kmalloc().

It looks like you're now leaking all but the final transfer buffer that is allocated for outgoing commands, as the URBs themselves are not freed until disconnect() (and that's when core would free the buffers along with the URBs if URB_FREE_BUFFER is set).

Ugh, you are right. The urb handling in this driver is crazy...

Let me go redo this whole thing, give me a few days...

thanks for the review, much appreciated.

Carlos, it would be good to know if your testing showed that the patch at least enables the device to work for now. It will leak memory like crazy, so I don't recomment relying on the driver, but it should be good enough to see if my thinking as to why the driver was not working is correct or not.

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html