Skip to content

Commit e75f7b9

Browse files
committed
Merge: s390/hypfs: Enable limited access during lockdown
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1375 JIRA: https://issues.redhat.com/browse/RHEL-111203 commits: ``` fec7bdf 3868f91 ``` Signed-off-by: Mete Durlu <mdurlu@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents c4e6a9f + a2095a3 commit e75f7b9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

arch/s390/hypfs/hypfs_dbfs.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
77
*/
88

9+
#include <linux/security.h>
910
#include <linux/slab.h>
1011
#include "hypfs.h"
1112

@@ -66,23 +67,27 @@ static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
6667
long rc;
6768

6869
mutex_lock(&df->lock);
69-
if (df->unlocked_ioctl)
70-
rc = df->unlocked_ioctl(file, cmd, arg);
71-
else
72-
rc = -ENOTTY;
70+
rc = df->unlocked_ioctl(file, cmd, arg);
7371
mutex_unlock(&df->lock);
7472
return rc;
7573
}
7674

77-
static const struct file_operations dbfs_ops = {
75+
static const struct file_operations dbfs_ops_ioctl = {
7876
.read = dbfs_read,
7977
.unlocked_ioctl = dbfs_ioctl,
8078
};
8179

80+
static const struct file_operations dbfs_ops = {
81+
.read = dbfs_read,
82+
};
83+
8284
void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df)
8385
{
84-
df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df,
85-
&dbfs_ops);
86+
const struct file_operations *fops = &dbfs_ops;
87+
88+
if (df->unlocked_ioctl && !security_locked_down(LOCKDOWN_DEBUGFS))
89+
fops = &dbfs_ops_ioctl;
90+
df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df, fops);
8691
mutex_init(&df->lock);
8792
}
8893

0 commit comments

Comments
 (0)