@@ -97,7 +97,11 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
97
97
struct path * path , bool do_lock )
98
98
{
99
99
struct qstr last ;
100
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 16 , 0 )
100
101
struct filename * filename __free (putname ) = NULL ;
102
+ #else
103
+ struct filename * filename = NULL ;
104
+ #endif
101
105
struct path * root_share_path = & share_conf -> vfs_path ;
102
106
int err , type ;
103
107
struct dentry * d ;
@@ -116,18 +120,28 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
116
120
err = vfs_path_parent_lookup (filename , flags ,
117
121
path , & last , & type ,
118
122
root_share_path );
119
- if (err )
123
+ if (err ) {
124
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
125
+ putname (filename );
126
+ #endif
120
127
return err ;
128
+ }
121
129
122
130
if (unlikely (type != LAST_NORM )) {
123
131
path_put (path );
132
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
133
+ putname (filename );
134
+ #endif
124
135
return - ENOENT ;
125
136
}
126
137
127
138
if (do_lock ) {
128
139
err = mnt_want_write (path -> mnt );
129
140
if (err ) {
130
141
path_put (path );
142
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
143
+ putname (filename );
144
+ #endif
131
145
return - ENOENT ;
132
146
}
133
147
@@ -141,16 +155,23 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
141
155
inode_unlock (path -> dentry -> d_inode );
142
156
mnt_drop_write (path -> mnt );
143
157
path_put (path );
158
+ putname (filename );
144
159
return - ENOENT ;
145
160
}
146
161
#endif
147
162
dput (path -> dentry );
148
163
path -> dentry = d ;
164
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
165
+ putname (filename );
166
+ #endif
149
167
return 0 ;
150
168
}
151
169
inode_unlock (path -> dentry -> d_inode );
152
170
mnt_drop_write (path -> mnt );
153
171
path_put (path );
172
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
173
+ putname (filename );
174
+ #endif
154
175
return - ENOENT ;
155
176
}
156
177
@@ -167,6 +188,9 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
167
188
}
168
189
if (IS_ERR (d )) {
169
190
path_put (path );
191
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
192
+ putname (filename );
193
+ #endif
170
194
return - ENOENT ;
171
195
}
172
196
dput (path -> dentry );
@@ -176,9 +200,15 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
176
200
err = follow_down (path , 0 );
177
201
if (err < 0 ) {
178
202
path_put (path );
203
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
204
+ putname (filename );
205
+ #endif
179
206
return - ENOENT ;
180
207
}
181
208
}
209
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (6 , 16 , 0 )
210
+ putname (filename );
211
+ #endif
182
212
return 0 ;
183
213
}
184
214
#else
0 commit comments