linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Johan Hovold <johan@kernel.org>
Cc: Arend van Spriel <arend.vanspriel@broadcom.com>,
	Carlos Manuel Santos <cmmpsantos@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: [v3] NFC: pn533: don't send USB data off of the stack
Date: Sat, 19 May 2018 09:08:38 +0200	[thread overview]
Message-ID: <20180519070838.GC2943@kroah.com> (raw)

On Fri, May 18, 2018 at 05:48:47PM +0200, Johan Hovold wrote:
> On Fri, May 18, 2018 at 12:38:11PM +0200, Greg Kroah-Hartman wrote:
> > 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.
> > 
> > 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2018-05-19  7:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-19  7:08 Greg Kroah-Hartman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-18 15:48 [v3] NFC: pn533: don't send USB data off of the stack Johan Hovold
2018-05-18 10:38 Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180519070838.GC2943@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arend.vanspriel@broadcom.com \
    --cc=cmmpsantos@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).