Skip to content

Commit 067baa9

Browse files
zx2c4smfrench
authored andcommitted
ksmbd: use vfs_llseek instead of dereferencing NULL
By not checking whether llseek is NULL, this might jump to NULL. Also, it doesn't check FMODE_LSEEK. Fix this by using vfs_llseek(), which always does the right thing. Fixes: f441584 ("cifsd: add file operations") Cc: [email protected] Cc: [email protected] Cc: Ronnie Sahlberg <[email protected]> Cc: Hyunchul Lee <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Reviewed-by: Namjae Jeon <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b5e5f9d commit 067baa9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ksmbd/vfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
10481048
*out_count = 0;
10491049
end = start + length;
10501050
while (start < end && *out_count < in_count) {
1051-
extent_start = f->f_op->llseek(f, start, SEEK_DATA);
1051+
extent_start = vfs_llseek(f, start, SEEK_DATA);
10521052
if (extent_start < 0) {
10531053
if (extent_start != -ENXIO)
10541054
ret = (int)extent_start;
@@ -1058,7 +1058,7 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
10581058
if (extent_start >= end)
10591059
break;
10601060

1061-
extent_end = f->f_op->llseek(f, extent_start, SEEK_HOLE);
1061+
extent_end = vfs_llseek(f, extent_start, SEEK_HOLE);
10621062
if (extent_end < 0) {
10631063
if (extent_end != -ENXIO)
10641064
ret = (int)extent_end;

0 commit comments

Comments
 (0)