Re: chown/chmod -R from kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 30, 2004 at 02:00:25 +0200, Domen Puncer wrote:
> I've been trying to fix usbfs bug (bugme 1418), and i have problems
> implementing chown/chmod.
> 
> I've come up with following code (outputs 4xabd, even when there should be
> directories; nothing seems chmoded in /proc/bus/usb/)
> 
> Any pointer what did i do wrong appreciated.

You shouldn't do chmod from kernel. You should call_usermodehelper.

Dentry cache is a cache -- it does not hold ALL the files. Only some of
them. At mostly random.

Permissions for /proc files must be fixed in the code that registers
them.

> 
> 	Domen
> 
> struct dentry *dentry;   
> list_for_each_entry(dentry, &s_root->d_subdirs, d_subdirs) {  
> 	printk("a\n");     
> 	if (!dentry->d_inode)    
> 		continue;     
> 	printk("b\n");     
> 	if (dentry->d_inode->i_mode & S_IFDIR) { 
> 		printk("c\n");     
> 		struct dentry *devd;   
> 		     
> 		dentry->d_inode->i_uid = busuid;   
> 		dentry->d_inode->i_gid = busgid;   
> 		dentry->d_inode->i_mode = busmode & S_IFDIR; 
> 		     
> 		list_for_each_entry(devd, &dentry->d_subdirs,    
> 				d_subdirs) {    
> 			dentry->d_inode->i_uid = devuid;   
> 			dentry->d_inode->i_gid = devgid;   
> 			dentry->d_inode->i_mode = devmode & S_IFREG; 
> 		}     
> 	} else {   
> 		printk("d\n");     
> 		dentry->d_inode->i_uid = listuid;   
> 		dentry->d_inode->i_gid = listgid;   
> 		dentry->d_inode->i_mode = listmode & S_IFREG; 
> 	}     
> }     
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux