Skip to content

Commit 2e4656e

Browse files
committed
ksmbd: fix build error with 6.11 kernel
Signed-off-by: Namjae Jeon <[email protected]>
1 parent 7085953 commit 2e4656e

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

vfs.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
9797
struct path *path, bool do_lock)
9898
{
9999
struct qstr last;
100+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
100101
struct filename *filename __free(putname) = NULL;
102+
#else
103+
struct filename *filename = NULL;
104+
#endif
101105
struct path *root_share_path = &share_conf->vfs_path;
102106
int err, type;
103107
struct dentry *d;
@@ -116,18 +120,28 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
116120
err = vfs_path_parent_lookup(filename, flags,
117121
path, &last, &type,
118122
root_share_path);
119-
if (err)
123+
if (err) {
124+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
125+
putname(filename);
126+
#endif
120127
return err;
128+
}
121129

122130
if (unlikely(type != LAST_NORM)) {
123131
path_put(path);
132+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
133+
putname(filename);
134+
#endif
124135
return -ENOENT;
125136
}
126137

127138
if (do_lock) {
128139
err = mnt_want_write(path->mnt);
129140
if (err) {
130141
path_put(path);
142+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
143+
putname(filename);
144+
#endif
131145
return -ENOENT;
132146
}
133147

@@ -141,16 +155,23 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
141155
inode_unlock(path->dentry->d_inode);
142156
mnt_drop_write(path->mnt);
143157
path_put(path);
158+
putname(filename);
144159
return -ENOENT;
145160
}
146161
#endif
147162
dput(path->dentry);
148163
path->dentry = d;
164+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
165+
putname(filename);
166+
#endif
149167
return 0;
150168
}
151169
inode_unlock(path->dentry->d_inode);
152170
mnt_drop_write(path->mnt);
153171
path_put(path);
172+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
173+
putname(filename);
174+
#endif
154175
return -ENOENT;
155176
}
156177

@@ -167,6 +188,9 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
167188
}
168189
if (IS_ERR(d)) {
169190
path_put(path);
191+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
192+
putname(filename);
193+
#endif
170194
return -ENOENT;
171195
}
172196
dput(path->dentry);
@@ -176,9 +200,15 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
176200
err = follow_down(path, 0);
177201
if (err < 0) {
178202
path_put(path);
203+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
204+
putname(filename);
205+
#endif
179206
return -ENOENT;
180207
}
181208
}
209+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
210+
putname(filename);
211+
#endif
182212
return 0;
183213
}
184214
#else

0 commit comments

Comments
 (0)