Skip to content

Commit 2d74ec9

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA
Smatch static checker warning: fs/ksmbd/smb2pdu.c:7759 smb2_ioctl() warn: no lower bound on 'off' Fix unexpected result that could caused from negative off and bfz. Fixes: b5e5f9d ("ksmbd: check invalid FileOffset and BeyondFinalZero in FSCTL_ZERO_DATA") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 728f14c commit 2d74ec9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7755,7 +7755,7 @@ int smb2_ioctl(struct ksmbd_work *work)
77557755

77567756
off = le64_to_cpu(zero_data->FileOffset);
77577757
bfz = le64_to_cpu(zero_data->BeyondFinalZero);
7758-
if (off > bfz) {
7758+
if (off < 0 || bfz < 0 || off > bfz) {
77597759
ret = -EINVAL;
77607760
goto out;
77617761
}

0 commit comments

Comments
 (0)