[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101014081132.GA11095@redhat.com>
Date: Thu, 14 Oct 2010 10:11:34 +0200
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
Maciej Sosnowski <maciej.sosnowski@...el.com>,
"David S. Miller" <davem@...emloft.net>, stable@...nel.org
Subject: Re: [PATCH] dma: fix error handling on out of memory
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@...hat.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@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists