lkml.org 
[lkml]   [2008]   [Jan]   [16]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 16 Jan 2008 08:33:22 +0100
FromIngo Molnar <>
SubjectRe: [patch 4/4] x86: PAT followup - use ioremap for devmem read of reserved regions
* venkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com> wrote:

> --- linux-2.6.git.orig/drivers/char/mem.c	2008-01-15 10:05:13.000000000 -0800
> +++ linux-2.6.git/drivers/char/mem.c	2008-01-15 10:05:51.000000000 -0800
> @@ -127,9 +127,14 @@
>  		 * by the kernel or data corruption may occur
>  		 */
>  		ptr = xlate_dev_mem_ptr(p);
> +		if (!ptr)
> +			return -EFAULT;
> 
>  		if (copy_to_user(buf, ptr, sz))
>  			return -EFAULT;
> +
> +		unxlate_dev_mem_ptr(p, ptr);

sidenote: drivers/char/mem.c has no locking here, are you sure it's safe 
to create a possibly large number of aliases here? At least on 32-bit it 
could deplete the vmalloc area. (where all ioremaps go)

since /dev/mem access is strongly discouraged anyway (except perhaps for 
debugging purposes), wouldnt it be safer to stick a mutex around these 
areas?

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-01-16 07:37    [from the cache]
©2003-2008