Skip to content

Commit a68d59f

Browse files
committed
apparmor: remove useless aafs_create_symlink
commit 1180b4c ("apparmor: fix dangling symlinks to policy rawdata after replacement") reworked how the rawdata symlink is handled but failedto remove aafs_create_symlink which was reduced to a useles stub. Fixes: 1180b4c ("apparmor: fix dangling symlinks to policy rawdata after replacement") Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 6413f85 commit a68d59f

1 file changed

Lines changed: 9 additions & 41 deletions

File tree

‎security/apparmor/apparmorfs.c‎

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -340,38 +340,6 @@ static struct dentry *aafs_create_dir(const char *name, struct dentry *parent)
340340
NULL);
341341
}
342342

343-
/**
344-
* aafs_create_symlink - create a symlink in the apparmorfs filesystem
345-
* @name: name of dentry to create
346-
* @parent: parent directory for this dentry
347-
* @target: if symlink, symlink target string
348-
* @private: private data
349-
* @iops: struct of inode_operations that should be used
350-
*
351-
* If @target parameter is %NULL, then the @iops parameter needs to be
352-
* setup to handle .readlink and .get_link inode_operations.
353-
*/
354-
static struct dentry *aafs_create_symlink(const char *name,
355-
struct dentry *parent,
356-
const char *target,
357-
void *private,
358-
const struct inode_operations *iops)
359-
{
360-
struct dentry *dent;
361-
char *link = NULL;
362-
363-
if (target) {
364-
if (!link)
365-
return ERR_PTR(-ENOMEM);
366-
}
367-
dent = aafs_create(name, S_IFLNK | 0444, parent, private, link, NULL,
368-
iops);
369-
if (IS_ERR(dent))
370-
kfree(link);
371-
372-
return dent;
373-
}
374-
375343
/**
376344
* aafs_remove - removes a file or directory from the apparmorfs filesystem
377345
*
@@ -1762,25 +1730,25 @@ int __aafs_profile_mkdir(struct aa_profile *profile, struct dentry *parent)
17621730
}
17631731

17641732
if (profile->rawdata) {
1765-
dent = aafs_create_symlink("raw_sha1", dir, NULL,
1766-
profile->label.proxy,
1767-
&rawdata_link_sha1_iops);
1733+
dent = aafs_create("raw_sha1", S_IFLNK | 0444, dir,
1734+
profile->label.proxy, NULL, NULL,
1735+
&rawdata_link_sha1_iops);
17681736
if (IS_ERR(dent))
17691737
goto fail;
17701738
aa_get_proxy(profile->label.proxy);
17711739
profile->dents[AAFS_PROF_RAW_HASH] = dent;
17721740

1773-
dent = aafs_create_symlink("raw_abi", dir, NULL,
1774-
profile->label.proxy,
1775-
&rawdata_link_abi_iops);
1741+
dent = aafs_create("raw_abi", S_IFLNK | 0444, dir,
1742+
profile->label.proxy, NULL, NULL,
1743+
&rawdata_link_abi_iops);
17761744
if (IS_ERR(dent))
17771745
goto fail;
17781746
aa_get_proxy(profile->label.proxy);
17791747
profile->dents[AAFS_PROF_RAW_ABI] = dent;
17801748

1781-
dent = aafs_create_symlink("raw_data", dir, NULL,
1782-
profile->label.proxy,
1783-
&rawdata_link_data_iops);
1749+
dent = aafs_create("raw_data", S_IFLNK | 0444, dir,
1750+
profile->label.proxy, NULL, NULL,
1751+
&rawdata_link_data_iops);
17841752
if (IS_ERR(dent))
17851753
goto fail;
17861754
aa_get_proxy(profile->label.proxy);

0 commit comments

Comments
 (0)