Re: Patch [1/1] minor bugfix in 2.6.26/arch/x86/mm/pat.c - causedproblems in mmap() of /dev/mem character file
From: Linus Torvalds
Date: Thu Jul 17 2008 - 13:28:28 EST
On Thu, 17 Jul 2008, V.Radhakrishnan wrote:
>
> The above #ifdef must be actually #ifndef and not #ifdef
> The bug does not allow a valid user (root) from accessing /dev/mem even
> though the CONFIG_PROMISC_DEVMEM is NOT selected.
The real bug is that we shouldn't have "double negatives", and certainly
not negative config options. Making that "promiscuous /dev/mem" option a
negated thing as a config option was bad.
Ingo, over to you..
Linus
> --- arch/x86/mm/pat.c.orig 2008-07-17 22:04:18.000000000 +0530
> +++ arch/x86/mm/pat.c 2008-07-17 22:43:39.000000000 +0530
> @@ -471,7 +475,7 @@ pgprot_t phys_mem_access_prot(struct fil
> return vma_prot;
> }
>
> -#ifdef CONFIG_NONPROMISC_DEVMEM
> +#ifndef CONFIG_NONPROMISC_DEVMEM
> /* This check is done in drivers/char/mem.c in case of NONPROMISC_DEVMEM*/
> static inline int range_is_allowed(unsigned long pfn, unsigned long size)
> {
> @@ -586,4 +590,3 @@ void unmap_devmem(unsigned long pfn, uns
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/