Revert "scsi: target: Fix SELinux error when systemd-modules loads the target module"

This reverts commit 89b804f254ae731be5f86e671b3ac126f2f452a8.

As Dan points out, our backport is incorrect:

> This backport is weird. The creds stuff was supposed to protect
> target_init_dbroot(), but now it just changes the creds and then changes
> it back for no reason. It does call target_xcopy_release_pt() in the
> error handling. I don't see how that's related to the creds, so maybe
> that's a separate bug fix?

We don't have the target_init_dbroot() call there, so changing the creds
just to change them back immediately is useless. Revert this commit.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
This commit is contained in:
Vegard Nossum 2024-08-08 14:57:24 +00:00
parent e4913de917
commit 037ba8c484

View File

@ -3211,8 +3211,6 @@ static int __init target_core_init_configfs(void)
{
struct configfs_subsystem *subsys = &target_core_fabrics;
struct t10_alua_lu_gp *lu_gp;
struct cred *kern_cred;
const struct cred *old_cred;
int ret;
pr_debug("TARGET_CORE[0]: Loading Generic Kernel Storage"
@ -3289,20 +3287,9 @@ static int __init target_core_init_configfs(void)
if (ret < 0)
goto out;
/* We use the kernel credentials to access the target directory */
kern_cred = prepare_kernel_cred(&init_task);
if (!kern_cred) {
ret = -ENOMEM;
goto out;
}
old_cred = override_creds(kern_cred);
revert_creds(old_cred);
put_cred(kern_cred);
return 0;
out:
target_xcopy_release_pt();
configfs_unregister_subsystem(subsys);
core_dev_release_virtual_lun0();
rd_module_exit();