Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

apparmor: remove useless aafs_create_symlink

commit 1180b4c757aa ("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: 1180b4c757aa ("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>

+9 -41
+9 -41
security/apparmor/apparmorfs.c
··· 341 341 } 342 342 343 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 - 375 - /** 376 344 * aafs_remove - removes a file or directory from the apparmorfs filesystem 377 345 * 378 346 * @dentry: dentry of the file/directory/symlink to removed. ··· 1730 1762 } 1731 1763 1732 1764 if (profile->rawdata) { 1733 - dent = aafs_create_symlink("raw_sha1", dir, NULL, 1734 - profile->label.proxy, 1735 - &rawdata_link_sha1_iops); 1765 + dent = aafs_create("raw_sha1", S_IFLNK | 0444, dir, 1766 + profile->label.proxy, NULL, NULL, 1767 + &rawdata_link_sha1_iops); 1736 1768 if (IS_ERR(dent)) 1737 1769 goto fail; 1738 1770 aa_get_proxy(profile->label.proxy); 1739 1771 profile->dents[AAFS_PROF_RAW_HASH] = dent; 1740 1772 1741 - dent = aafs_create_symlink("raw_abi", dir, NULL, 1742 - profile->label.proxy, 1743 - &rawdata_link_abi_iops); 1773 + dent = aafs_create("raw_abi", S_IFLNK | 0444, dir, 1774 + profile->label.proxy, NULL, NULL, 1775 + &rawdata_link_abi_iops); 1744 1776 if (IS_ERR(dent)) 1745 1777 goto fail; 1746 1778 aa_get_proxy(profile->label.proxy); 1747 1779 profile->dents[AAFS_PROF_RAW_ABI] = dent; 1748 1780 1749 - dent = aafs_create_symlink("raw_data", dir, NULL, 1750 - profile->label.proxy, 1751 - &rawdata_link_data_iops); 1781 + dent = aafs_create("raw_data", S_IFLNK | 0444, dir, 1782 + profile->label.proxy, NULL, NULL, 1783 + &rawdata_link_data_iops); 1752 1784 if (IS_ERR(dent)) 1753 1785 goto fail; 1754 1786 aa_get_proxy(profile->label.proxy);