[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFpJ1rs+XinCYfPs@infradead.org>
Date: Tue, 9 May 2023 06:25:42 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Ruihan Li <lrh2000@....edu.cn>
Cc: syzbot+fcf1a817ceb50935ce99@...kaller.appspotmail.com,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, pasha.tatashin@...een.com,
gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: usbdev_mmap causes type confusion in page_table_check
On Sun, May 07, 2023 at 09:58:44PM +0800, Ruihan Li wrote:
> static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
> {
> // ...
> mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN,
> &dma_handle);
> // ...
> if (hcd->localmem_pool || !hcd_uses_dma(hcd)) {
> if (remap_pfn_range(vma, vma->vm_start,
> virt_to_phys(usbm->mem) >> PAGE_SHIFT,
usb_alloc_coherent and up in the DMA coherent allocator (usually
anyway), and you absolutely must never do a virt_to_phys or virt_to_page
on that return value. This code is a buggy as f**k.
Powered by blists - more mailing lists