Skip to content

Commit 8c198ff

Browse files
committed
Merge tag 'driver-core-6.14-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull debugfs fix from Greg KH: "Here is a single debugfs fix from Al to resolve a reported regression in the driver-core tree. It has been reported to fix the issue" * tag 'driver-core-6.14-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: debugfs: Fix the missing initializations in __debugfs_file_get()
2 parents 03cc357 + 57b3147 commit 8c198ff

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

fs/debugfs/file.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static int __debugfs_file_get(struct dentry *dentry, enum dbgfs_get_mode mode)
9494
fsd = d_fsd;
9595
} else {
9696
struct inode *inode = dentry->d_inode;
97+
unsigned int methods = 0;
9798

9899
if (WARN_ON(mode == DBGFS_GET_ALREADY))
99100
return -EINVAL;
@@ -106,25 +107,28 @@ static int __debugfs_file_get(struct dentry *dentry, enum dbgfs_get_mode mode)
106107
const struct debugfs_short_fops *ops;
107108
ops = fsd->short_fops = DEBUGFS_I(inode)->short_fops;
108109
if (ops->llseek)
109-
fsd->methods |= HAS_LSEEK;
110+
methods |= HAS_LSEEK;
110111
if (ops->read)
111-
fsd->methods |= HAS_READ;
112+
methods |= HAS_READ;
112113
if (ops->write)
113-
fsd->methods |= HAS_WRITE;
114+
methods |= HAS_WRITE;
115+
fsd->real_fops = NULL;
114116
} else {
115117
const struct file_operations *ops;
116118
ops = fsd->real_fops = DEBUGFS_I(inode)->real_fops;
117119
if (ops->llseek)
118-
fsd->methods |= HAS_LSEEK;
120+
methods |= HAS_LSEEK;
119121
if (ops->read)
120-
fsd->methods |= HAS_READ;
122+
methods |= HAS_READ;
121123
if (ops->write)
122-
fsd->methods |= HAS_WRITE;
124+
methods |= HAS_WRITE;
123125
if (ops->unlocked_ioctl)
124-
fsd->methods |= HAS_IOCTL;
126+
methods |= HAS_IOCTL;
125127
if (ops->poll)
126-
fsd->methods |= HAS_POLL;
128+
methods |= HAS_POLL;
129+
fsd->short_fops = NULL;
127130
}
131+
fsd->methods = methods;
128132
refcount_set(&fsd->active_users, 1);
129133
init_completion(&fsd->active_users_drained);
130134
INIT_LIST_HEAD(&fsd->cancellations);

0 commit comments

Comments
 (0)