Skip to content

Commit 405ee40

Browse files
bonifaidoSteve French
authored andcommitted
ksmbd: ignore trailing slashes in share paths
Trailing slashes in share paths (like: /home/me/Share/) caused permission issues with shares for clients on iOS and on Android TV for me, but otherwise they work fine with plain old Samba. Cc: stable@vger.kernel.org Signed-off-by: Nandor Kracser <bonifaido@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent c91ecba commit 405ee40

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/smb/server/mgmt/share_config.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ static struct ksmbd_share_config *share_config_request(struct unicode_map *um,
165165

166166
share->path = kstrndup(ksmbd_share_config_path(resp), path_len,
167167
GFP_KERNEL);
168-
if (share->path)
168+
if (share->path) {
169169
share->path_sz = strlen(share->path);
170+
while (share->path_sz > 1 &&
171+
share->path[share->path_sz - 1] == '/')
172+
share->path[--share->path_sz] = '\0';
173+
}
170174
share->create_mask = resp->create_mask;
171175
share->directory_mask = resp->directory_mask;
172176
share->force_create_mode = resp->force_create_mode;

0 commit comments

Comments
 (0)