On Tue, Jul 7, 2009 at 05:32, <[email protected]> wrote:
> Modified: branches/2009R1/mm/nommu.c (6938 => 6939)
>
>               if (!file->f_op->read)
>                       capabilities &= ~BDI_CAP_MAP_COPY;
>
> +              /* The file shall have been opened with read permission. */
> +             if (!(file->f_mode & FMODE_READ))
> +                     return -EACCES;
> +
>               if (flags & MAP_SHARED) {
>                       /* do checks for writing, appending and locking */
>                       if ((prot & PROT_WRITE) &&

doesnt this reject all mmap()'s if the fd isnt opened for reading ?
this isnt correct as there is nothing wrong with opening a fd for
writing only and then mmap()ing it for writing only.

it should be like the check a few lines below where it checks prot for
PROT_READ and compares it to the f_mode having FMODE_READ:
            if ((prot & PROT_WRITE) &&
                !(file->f_mode & FMODE_WRITE))
                return -EACCES;
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to