Al Viro <[email protected]> wrote:

> > ... and then making proc_create() only permit regular files (and complain
> > if the S_IFMT field is not zero)?
> 
> We already do: in proc_create_data() we have
>         struct proc_dir_entry *pde;
>         if ((mode & S_IFMT) == 0)
>                 mode |= S_IFREG;
> 
>         if (!S_ISREG(mode)) {
>                 WARN_ON(1);     /* use proc_mkdir() */
>                 return NULL;
>         }
> 
> proc_mkdir{,_data,_mode} are there for purpose.  Nobody had been insane
> enough to put FIFOs or sockets in procfs and anything else would need
> additional data anyway.  proc_symlink() is there, proc_mknod() isn't and
> nobody has complained yet.  Let's keep it that way, plese...

Should we then change the proc_create_data() to do:

        struct proc_dir_entry *pde;

        if (mode & S_IFMT) {
                WARN_ON(1);     /* use proc_mkdir() */
                return NULL;
        }
        mode |= S_IFREG;

and stop passing S_IFREG into it?

David
--
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