mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 11:06:03 +02:00
ksmbd: reject blocking compound lock requests
Clients set SMB2_LOCKFLAG_FAIL_IMMEDIATELY when a LOCK request contains multiple lock elements, and servers reject requests that omit it. Accepting such a request can leave earlier elements locked while a later element waits asynchronously, enabling prolonged partial lock ownership and avoidable deadlocks. Return STATUS_INVALID_PARAMETER before processing any element when a multi-element lock request contains a blocking lock. Unlock arrays remain unaffected. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
054bcca4cd
commit
16a7f7c2ec
|
|
@ -9308,6 +9308,13 @@ int smb2_lock(struct ksmbd_work *work)
|
|||
}
|
||||
|
||||
list_for_each_entry_safe(smb_lock, tmp, &lock_list, llist) {
|
||||
if (lock_count > 1 &&
|
||||
!(le32_to_cpu(lock_ele[0].Flags) & SMB2_LOCKFLAG_UNLOCK) &&
|
||||
!(smb_lock->flags & SMB2_LOCKFLAG_FAIL_IMMEDIATELY)) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (smb_lock->cmd < 0) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user