* [media] videobuf-dma-contig: fix vm_iomap_memory() call
@ 2014-03-27 11:07 Ma Haijun
2014-03-28 9:28 ` Hans Verkuil
0 siblings, 1 reply; 3+ messages in thread
From: Ma Haijun @ 2014-03-27 11:07 UTC (permalink / raw)
To: linux-media, linux-kernel
Cc: Mauro Carvalho Chehab, Hans Verkuil, Al Viro, Ma Haijun
Hi all,
This is a trivial fix, but I think the patch itself has problem too.
The function requires a phys_addr_t, but we feed it with a dma_handle_t.
AFAIK, this implicit conversion does not always work.
Can I use virt_to_phys(mem->vaddr) to get the physical address instead?
(mem->vaddr and mem->dma_handle are from dma_alloc_coherent)
Regards
Ma Haijun
Ma Haijun (1):
[media] videobuf-dma-contig: fix incorrect argument to
vm_iomap_memory() call
drivers/media/v4l2-core/videobuf-dma-contig.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.8.3.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [media] videobuf-dma-contig: fix vm_iomap_memory() call
2014-03-27 11:07 [media] videobuf-dma-contig: fix vm_iomap_memory() call Ma Haijun
@ 2014-03-28 9:28 ` Hans Verkuil
2014-03-28 16:58 ` Ma Haijun
0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2014-03-28 9:28 UTC (permalink / raw)
To: Ma Haijun, linux-media, linux-kernel; +Cc: Mauro Carvalho Chehab, Al Viro
On 03/27/2014 12:07 PM, Ma Haijun wrote:
> Hi all,
>
> This is a trivial fix, but I think the patch itself has problem too.
> The function requires a phys_addr_t, but we feed it with a dma_handle_t.
> AFAIK, this implicit conversion does not always work.
> Can I use virt_to_phys(mem->vaddr) to get the physical address instead?
> (mem->vaddr and mem->dma_handle are from dma_alloc_coherent)
Does this actually fail? With what driver and on what hardware?
I ask because I am very reluctant to make any changes to videobuf. It is
slowly being replaced by the vastly superior videobuf2 framework. Existing
drivers in the kernel still using the old videobuf seem to work just fine
(or at least as fine as videobuf allows you to be).
Regards,
Hans
>
> Regards
>
> Ma Haijun
>
> Ma Haijun (1):
> [media] videobuf-dma-contig: fix incorrect argument to
> vm_iomap_memory() call
>
> drivers/media/v4l2-core/videobuf-dma-contig.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [media] videobuf-dma-contig: fix vm_iomap_memory() call
2014-03-28 9:28 ` Hans Verkuil
@ 2014-03-28 16:58 ` Ma Haijun
0 siblings, 0 replies; 3+ messages in thread
From: Ma Haijun @ 2014-03-28 16:58 UTC (permalink / raw)
To: 'Hans Verkuil', linux-media, linux-kernel
Cc: 'Mauro Carvalho Chehab', 'Al Viro'
Hi,
> -----Original Message-----
>
> On 03/27/2014 12:07 PM, Ma Haijun wrote:
> > Hi all,
> >
> > This is a trivial fix, but I think the patch itself has problem too.
> > The function requires a phys_addr_t, but we feed it with a dma_handle_t.
> > AFAIK, this implicit conversion does not always work.
> > Can I use virt_to_phys(mem->vaddr) to get the physical address instead?
> > (mem->vaddr and mem->dma_handle are from dma_alloc_coherent)
>
> Does this actually fail? With what driver and on what hardware?
I notice it when I am reading the code,
so I do not know if any driver is broken.
>
> I ask because I am very reluctant to make any changes to videobuf. It is
> slowly being replaced by the vastly superior videobuf2 framework. Existing
> drivers in the kernel still using the old videobuf seem to work just fine
> (or at least as fine as videobuf allows you to be).
Sorry that the cover letter is a bit misleading, hope you does not skip the
patch due to this.
The actual problem is that userland virtual address is erroneously passed to
vm_iomap_memory, while it expects physical address.
And that is what the patch try to address.
Seems this bug can be exploited to map and access physical address.
So it is also a security problem, I think we should ether fix it
or remove the code if not used any more.
Regards,
Haijun
>
> Regards,
>
> Hans
>
> >
> > Regards
> >
> > Ma Haijun
> >
> > Ma Haijun (1):
> > [media] videobuf-dma-contig: fix incorrect argument to
> > vm_iomap_memory() call
> >
> > drivers/media/v4l2-core/videobuf-dma-contig.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-28 16:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 11:07 [media] videobuf-dma-contig: fix vm_iomap_memory() call Ma Haijun
2014-03-28 9:28 ` Hans Verkuil
2014-03-28 16:58 ` Ma Haijun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox