OpenCloudOS-Kernel/drivers/uio
Linus Torvalds b655028795 uio: we cannot mmap unaligned page contents
In commit 7314e613d5 ("Fix a few incorrectly checked
[io_]remap_pfn_range() calls") the uio driver started more properly
checking the passed-in user mapping arguments against the size of the
actual uio driver data.

That in turn exposed that some driver authors apparently didn't realize
that mmap can only work on a page granularity, and had tried to use it
with smaller mappings, with the new size check catching that out.

So since it's not just the user mmap() arguments that can be confused,
make the uio mmap code also verify that the uio driver has the memory
allocated at page boundaries in order for mmap to work.  If the device
memory isn't properly aligned, we return

  [ENODEV]
    The fildes argument refers to a file whose type is not supported by mmap().

as per the open group documentation on mmap.

Reported-by: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-12-02 11:50:37 -08:00
..
Kconfig drivers: uio: Kconfig: add MMU dependancy for UIO 2013-08-30 14:19:46 -07:00
Makefile drivers: uio: Add driver for Humusoft MF624 DAQ PCI card 2013-08-30 12:12:49 -07:00
uio.c uio: we cannot mmap unaligned page contents 2013-12-02 11:50:37 -08:00
uio_aec.c uio: uio_aec: remove unnecessary pci_set_drvdata() 2013-09-26 08:47:25 -07:00
uio_cif.c uio: uio_cif: remove unnecessary pci_set_drvdata() 2013-09-26 08:47:25 -07:00
uio_dmem_genirq.c drivers: uio_dmem_genirq: use dev_get_platdata() 2013-08-30 12:10:53 -07:00
uio_mf624.c uio: uio_mf624: remove unnecessary pci_set_drvdata() 2013-09-26 08:47:25 -07:00
uio_netx.c uio: uio_netx: remove unnecessary pci_set_drvdata() 2013-09-26 08:47:25 -07:00
uio_pci_generic.c uio/uio_pci_generic: Use module_pci_driver to register driver 2013-05-21 13:59:25 -07:00
uio_pdrv_genirq.c uio: Simplify uio error path by using devres functions 2013-09-26 08:46:45 -07:00
uio_pruss.c drivers/uio/uio_pruss.c: use gen_pool_dma_alloc() to allocate sram memory 2013-11-13 12:09:23 +09:00
uio_sercos3.c uio: uio_sercos3: remove unnecessary pci_set_drvdata() 2013-09-26 08:47:25 -07:00