lkml.org 
[lkml]   [2010]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] dma: fix error handling on out of memory
From
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.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-10-14 02:13    [W:0.307 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site