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: stable@vger.kernel.org Cc: linux-cifs@vger.kernel.org Cc: Ronnie Sahlberg <lsahlber@redhat.com> Cc: Hyunchul Lee <hyc.lee@gmail.com> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b5e5f9d commit 067baa9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)