mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
ksmbd: fix O(N^2) DoS in smb2_lock via unbounded LockCount
smb2_lock() performs O(N^2) conflict detection with no cap on LockCount. Cap lock_count at 64 to prevent CPU exhaustion from a single request. Signed-off-by: Akif Sait <akif.sait111@gmail.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
b32c8db482
commit
bd0a1ca52b
|
|
@ -7491,7 +7491,12 @@ int smb2_lock(struct ksmbd_work *work)
|
|||
lock_ele = req->locks;
|
||||
|
||||
ksmbd_debug(SMB, "lock count is %d\n", lock_count);
|
||||
if (!lock_count) {
|
||||
/*
|
||||
* Cap lock_count at 64. The MS-SMB2 spec defines Open.LockSequenceArray
|
||||
* as exactly 64 entries so 64 is the intended ceiling. No real workload
|
||||
* comes close to this in a single request.
|
||||
*/
|
||||
if (!lock_count || lock_count > 64) {
|
||||
err = -EINVAL;
|
||||
goto out2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user