Skip to contentSkip to conversation

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

PATCH New Greg Kroah-Hartman 1 participant 1 message Jun 9, 2018 USB

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

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

Quoted 26 lines · Samuel Ortiz

Greg,

Quoted 23 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 off of the stack.

We do this for one command by having a whole urb just for ack messages, as they can be submitted in interrupt context, so we can not use usb_bulk_msg(). But the poweron command can sleep (and does), so use usb_bulk_msg() for that transfer.

---
v4: don't use urb transfer buffer flags as the memory is tied to the urb
(thanks to Johan) Now we have a new static urb, and we use usb_bulk_msg() for the other message.
v3: actually use the correct buffer (thanks to Arend van Spriel)
use kmemdup (thanks to Johannes Berg and Julia Lawall)
v2: set the urb flags correctly

Quoted 4 lines
Quoted 2 lines
 drivers/nfc/pn533/usb.c |   42 ++++++++++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 12 deletions(-)

I can take that one through nfc-next, and the few subsequent patches from Hans and Julia. Please let me know what's more convenient for you.

This patch is already in Linus's tree, along with whatever applied from Julia's patch series. Hans needs to rebase and resend anyway, so either tree is fine once 4.18-rc1 is out.

thanks,

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