Skip to content

Commit 6c8b1a2

Browse files
committed
Merge tag '6.10-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd
Pull smb server fixes from Steve French: "Two ksmbd server fixes, both for stable" * tag '6.10-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd: ksmbd: ignore trailing slashes in share paths ksmbd: avoid to send duplicate oplock break notifications
2 parents 54f71b0 + 405ee40 commit 6c8b1a2

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
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;

fs/smb/server/oplock.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,19 +610,24 @@ static int oplock_break_pending(struct oplock_info *opinfo, int req_op_level)
610610
if (opinfo->op_state == OPLOCK_CLOSING)
611611
return -ENOENT;
612612
else if (opinfo->level <= req_op_level) {
613-
if (opinfo->is_lease &&
614-
opinfo->o_lease->state !=
615-
(SMB2_LEASE_HANDLE_CACHING_LE |
616-
SMB2_LEASE_READ_CACHING_LE))
613+
if (opinfo->is_lease == false)
614+
return 1;
615+
616+
if (opinfo->o_lease->state !=
617+
(SMB2_LEASE_HANDLE_CACHING_LE |
618+
SMB2_LEASE_READ_CACHING_LE))
617619
return 1;
618620
}
619621
}
620622

621623
if (opinfo->level <= req_op_level) {
622-
if (opinfo->is_lease &&
623-
opinfo->o_lease->state !=
624-
(SMB2_LEASE_HANDLE_CACHING_LE |
625-
SMB2_LEASE_READ_CACHING_LE)) {
624+
if (opinfo->is_lease == false) {
625+
wake_up_oplock_break(opinfo);
626+
return 1;
627+
}
628+
if (opinfo->o_lease->state !=
629+
(SMB2_LEASE_HANDLE_CACHING_LE |
630+
SMB2_LEASE_READ_CACHING_LE)) {
626631
wake_up_oplock_break(opinfo);
627632
return 1;
628633
}

0 commit comments

Comments
 (0)