From: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
To: Ian.Jackson@eu.citrix.com
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] usbfront: do not assume sequentially mapped pages
Date: Wed, 01 Apr 2009 15:05:36 +0900 [thread overview]
Message-ID: <49D30430.7030700@jp.fujitsu.com> (raw)
In-Reply-To: <18896.57087.861363.142669@mariner.uk.xensource.com>
Hi,
Oh, I had a misunderstanding about the continuity of buffer pages.
This caused webcam's image to corrupt.
PVUSB applied to this change can work well with the following webcams.
* Creative Labs: WebCam 3 USB (with ov511 driver)
* Creative Labs: WebCam NX pro (with gspca driver)
Now, Webcam works!
Thanks,
Noboru
Ian Jackson wrote:
> xenhcd_gnttab_map in usbfront-q.c looks up the mfn of the start of the
> usb transfer buffer. But the buffer may span several pages, and the
> current code simply increments the obtained mfn. Needless to say this
> is an unwarranted assumption. It causes large transfers to be
> corrupted and/or to overwrite other parts of memory.
>
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> diff -r 87c84f7dd850 drivers/xen/usbfront/usbfront-q.c
> --- a/drivers/xen/usbfront/usbfront-q.c Fri Mar 20 09:00:58 2009 +0000
> +++ b/drivers/xen/usbfront/usbfront-q.c Fri Mar 27 17:53:12 2009 +0100
> @@ -106,12 +106,15 @@ static inline void xenhcd_gnttab_map(str
> unsigned int bytes;
> int i;
>
> - page = virt_to_page(addr);
> - buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
> - offset = offset_in_page(addr);
> len = length;
>
> for(i = 0;i < nr_pages;i++){
> + BUG_ON(!len);
> +
> + page = virt_to_page(addr);
> + buffer_pfn = page_to_phys(page) >> PAGE_SHIFT;
> + offset = offset_in_page(addr);
> +
> bytes = PAGE_SIZE - offset;
> if(bytes > len)
> bytes = len;
> @@ -123,9 +126,8 @@ static inline void xenhcd_gnttab_map(str
> seg[i].offset = (uint16_t)offset;
> seg[i].length = (uint16_t)bytes;
>
> - buffer_pfn++;
> + addr += bytes;
> len -= bytes;
> - offset = 0;
> }
> }
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2009-04-01 6:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-30 15:02 [PATCH] usbfront: do not assume sequentially mapped pages Ian Jackson
2009-04-01 6:05 ` Noboru Iwamatsu [this message]
2009-04-01 16:00 ` Ian Jackson
2009-04-06 9:03 ` Noboru Iwamatsu
2009-04-07 16:40 ` Ian Jackson
2009-04-08 2:15 ` Noboru Iwamatsu
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=49D30430.7030700@jp.fujitsu.com \
--to=n_iwamatsu@jp.fujitsu.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.