 isec = inode->i_security;  if (isec->security_attr_init) return 0; 
static int post_create(struct inode *dir,		       struct dentry *dentry){	struct task_security_struct *tsec;	struct inode *inode;	struct inode_security_struct *dsec;	struct superblock_security_struct *sbsec;	u32 newsid;	char *context;	unsigned int len;	int rc;	tsec = current->security;	dsec = dir->i_security;	sbsec = dir->i_sb->s_security;	inode = dentry->d_inode;	if (!inode) {		/* Some file system types (e.g. NFS) may not instantiate		   a dentry for all create operations (e.g. symlink),		   so we have to check to see if the inode is non-NULL. */		printk(KERN_WARNING "post_create:  no inode, dir (dev=%s, "		       "ino=%ld)\n", dir->i_sb->s_id, dir->i_ino);		return 0;	}	if (tsec->create_sid && sbsec->behavior != SECURITY_FS_USE_MNTPOINT) {		newsid = tsec->create_sid;	} else {		rc = security_transition_sid(tsec->sid, dsec->sid,					     inode_mode_to_security_class(inode->i_mode),					     &newsid);		if (rc) {			printk(KERN_WARNING "post_create:  "			       "security_transition_sid failed, rc=%d (dev=%s "			       "ino=%ld)\n",			       -rc, inode->i_sb->s_id, inode->i_ino);			return rc;		}	}	rc = inode_security_set_sid(inode, newsid);	if (rc) {		printk(KERN_WARNING "post_create:  inode_security_set_sid "		       "failed, rc=%d (dev=%s ino=%ld)\n",		       -rc, inode->i_sb->s_id, inode->i_ino);		return rc;	}	if (sbsec->behavior == SECURITY_FS_USE_XATTR &&	    inode->i_op->setxattr) {		/* Use extended attributes. */		rc = security_sid_to_context(newsid, &context, &len);		if (rc) {			printk(KERN_WARNING "post_create:  sid_to_context "			       "failed, rc=%d (dev=%s ino=%ld)\n",			       -rc, inode->i_sb->s_id, inode->i_ino);			return rc;		}		down(&inode->i_sem);		rc = inode->i_op->setxattr(dentry,					   XATTR_NAME_SELINUX,					   context, len, 0);		up(&inode->i_sem);		kfree(context);		if (rc < 0) {			printk(KERN_WARNING "post_create:  setxattr failed, "			       "rc=%d (dev=%s ino=%ld)\n",			       -rc, inode->i_sb->s_id, inode->i_ino);			return rc;		}	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/5e41ff9e0650f327a6c819841fa412da95d57319/hooks.c/buggy/security/selinux/hooks.c