aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-01 03:14:04 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:33:39 -0400
commit3e62cbb8436f6c0cb799c8b7f106de7f662a7b8d (patch)
treed36565a4a6f7e0372a1fd9a8750b005635c9c335 /security/smack
parentc3ef1500ec833890275172c7d063333404b64d60 (diff)
smack: opt_dentry is never null in in smack_d_instantiate()
This patch removes some unneeded code for if opt_dentry is null because that can never happen. The function dereferences "opt_dentry" earlier when it checks "if (opt_dentry->d_parent == opt_dentry) {". That code was added in 2008. This function called from security_d_instantiate(). I checked all the places which call security_d_instantiate() and dentry is always non-null. I also checked the selinux version of this hook and there is a comment which says that dentry should be non-null if called from d_instantiate(). Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 0f2fc480fc61..07abc9ce72f2 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -2191,7 +2191,7 @@ static void smack_ipc_getsecid(struct kern_ipc_perm *ipp, u32 *secid)
2191 2191
2192/** 2192/**
2193 * smack_d_instantiate - Make sure the blob is correct on an inode 2193 * smack_d_instantiate - Make sure the blob is correct on an inode
2194 * @opt_dentry: unused 2194 * @opt_dentry: dentry where inode will be attached
2195 * @inode: the object 2195 * @inode: the object
2196 * 2196 *
2197 * Set the inode's security blob if it hasn't been done already. 2197 * Set the inode's security blob if it hasn't been done already.
@@ -2310,20 +2310,10 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
2310 /* 2310 /*
2311 * Get the dentry for xattr. 2311 * Get the dentry for xattr.
2312 */ 2312 */
2313 if (opt_dentry == NULL) { 2313 dp = dget(opt_dentry);
2314 dp = d_find_alias(inode);
2315 if (dp == NULL)
2316 break;
2317 } else {
2318 dp = dget(opt_dentry);
2319 if (dp == NULL)
2320 break;
2321 }
2322
2323 fetched = smk_fetch(inode, dp); 2314 fetched = smk_fetch(inode, dp);
2324 if (fetched != NULL) 2315 if (fetched != NULL)
2325 final = fetched; 2316 final = fetched;
2326
2327 dput(dp); 2317 dput(dp);
2328 break; 2318 break;
2329 } 2319 }