[PATCH] afs: proc cells and rootcell are writeable

David Howells dhowells at redhat.com
Tue Jan 28 15:56:44 EST 2014


Al Viro <viro at ZenIV.linux.org.uk> 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



More information about the linux-afs mailing list