From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Paul Bolle <pebolle@tiscali.nl>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] omap_vout: find_vma() needs ->mmap_sem held
Date: Mon, 07 Jan 2013 15:15:16 +0100 [thread overview]
Message-ID: <3603534.Q7XcdlK8lK@avalon> (raw)
In-Reply-To: <20121216200446.GF4939@ZenIV.linux.org.uk>
On Sunday 16 December 2012 20:04:46 Al Viro wrote:
> On Sun, Dec 16, 2012 at 09:01:10PM +0100, Paul Bolle wrote:
> > > + vma = find_vma(mm, virtp);
> > >
> > > } else if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
> >
> > Shouldn't that line become
> >
> > if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
> >
> > so that this actually compiles?
>
> *Do'h*
>
> Yes, it should. Mea culpa...
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> diff --git a/drivers/media/platform/omap/omap_vout.c
> b/drivers/media/platform/omap/omap_vout.c index 9935040..cb564d0 100644
> --- a/drivers/media/platform/omap/omap_vout.c
> +++ b/drivers/media/platform/omap/omap_vout.c
> @@ -207,19 +207,21 @@ static u32 omap_vout_uservirt_to_phys(u32 virtp)
> struct vm_area_struct *vma;
> struct mm_struct *mm = current->mm;
>
> - vma = find_vma(mm, virtp);
> /* For kernel direct-mapped memory, take the easy way */
> - if (virtp >= PAGE_OFFSET) {
> - physp = virt_to_phys((void *) virtp);
> - } else if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
> + if (virtp >= PAGE_OFFSET)
> + return virt_to_phys((void *) virtp);
> +
> + down_read(¤t->mm->mmap_sem);
> + vma = find_vma(mm, virtp);
> + if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
> /* this will catch, kernel-allocated, mmaped-to-usermode
> addresses */
> physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
> + up_read(¤t->mm->mmap_sem);
> } else {
> /* otherwise, use get_user_pages() for general userland pages */
> int res, nr_pages = 1;
> struct page *pages;
> - down_read(¤t->mm->mmap_sem);
>
> res = get_user_pages(current, current->mm, virtp, nr_pages, 1,
> 0, &pages, NULL);
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2013-01-07 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-15 20:12 [PATCH] omap_vout: find_vma() needs ->mmap_sem held Al Viro
2012-12-15 20:38 ` Al Viro
2013-01-06 13:02 ` Mauro Carvalho Chehab
2013-01-07 14:03 ` Laurent Pinchart
2013-01-07 14:06 ` Laurent Pinchart
2012-12-16 20:01 ` Paul Bolle
2012-12-16 20:04 ` Al Viro
2013-01-07 14:15 ` Laurent Pinchart [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=3603534.Q7XcdlK8lK@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=pebolle@tiscali.nl \
--cc=viro@zeniv.linux.org.uk \
/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.