All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org,
	Maciej Sosnowski <maciej.sosnowski@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	stable@kernel.org
Subject: Re: [PATCH] dma: fix error handling on out of memory
Date: Thu, 14 Oct 2010 10:11:34 +0200	[thread overview]
Message-ID: <20101014081132.GA11095@redhat.com> (raw)
In-Reply-To: <AANLkTimi4vo_trVGxO9eeaYsfnRkjweG0irCGek=75Yu@mail.gmail.com>

On Wed, Oct 13, 2010 at 05:10:25PM -0700, Dan Williams wrote:
> On Mon, Oct 11, 2010 at 2:44 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > get_user_pages might return less pages than requested. If this happens
> > for the first iovec in dma_pin_iovec_pages, then nr_iovecs is 0 and so
> > dma_unpin_iovec_pages will not unpin any pages, leaking pinned memory.
> > A similar off by one would trigger for any of the following entries.
> >
> > Fix by updating nr_iovecs and nr_pages in this case.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >
> > Error handling in dma_pin_iovec_pages still looks wrong to me.  Am I
> > missing something?
> 
> Still looks wrong it what way?  You make sure that nr_iovecs is
> incremented so that the partial page list is freed, and we only walk
> the initialized entries in pinned_list.

In that before the patch, if get_user_pages returns less pages than
requested, we would leak pinned memory. Right?

> --
> Dan

      reply	other threads:[~2010-10-14  8:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11  9:44 [PATCH] dma: fix error handling on out of memory Michael S. Tsirkin
2010-10-14  0:10 ` Dan Williams
2010-10-14  8:11   ` Michael S. Tsirkin [this message]

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=20101014081132.GA11095@redhat.com \
    --to=mst@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.sosnowski@intel.com \
    --cc=stable@kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.