* [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to