[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: PATCH: was Re: mmap bug in 2.2.13 (or in documentation)
From:       Abramo Bagnara <abramo () alsa-project ! org>
Date:       1999-12-31 16:03:45
[Download RAW message or body]

Alan Cox wrote:
> 
> >       if (file) {
> > -             if (file->f_mode & 1)
> > -                     vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
> > +             vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
> 
> You cannot go around allowing anyone to write to an mmapped file without having
> it open for writing.

From fs.h
#define FMODE_READ 1
#define FMODE_WRITE 2

BTW I can't understand why in so many place in kernel sources it's used
the numeric form (potentially misunderstanding) instead of the symbolic
one.
Are there only historical reason or also other reasons?

The patch I propose is to avoid to check if file is opened for reading.
This check is useless because if we have reached this point the file
*have* to be opened for reading (for the mmap explicit limitation
subject of this thread).

-- 
Abramo Bagnara                       mailto:abramo@alsa-project.org

Opera Unica
Via Emilia Interna, 140              Phone: +39.0546.656023
48014 Castel Bolognese (RA) - Italy  Fax:   +39.0546.656023

ALSA project is            http://www.alsa-project.org
sponsored by SuSE Linux    http://www.suse.com

It sounds good!

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic