aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorAlex Markuze <amarkuze@redhat.com>2024-11-27 15:34:10 +0200
committerIlya Dryomov <idryomov@gmail.com>2024-12-16 23:25:43 +0100
commit9abee475803fab6ad59d4f4fc59c6a75374a7d9d (patch)
treeb347ee02f1bb4a89e2e64f7a0484de66cf118095 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent12eb22a5a609421b380c3c6ca887474fb2089b2c (diff)
downloadlinux-9abee475803fab6ad59d4f4fc59c6a75374a7d9d.tar.gz
linux-9abee475803fab6ad59d4f4fc59c6a75374a7d9d.tar.bz2
linux-9abee475803fab6ad59d4f4fc59c6a75374a7d9d.zip
ceph: improve error handling and short/overflow-read logic in __ceph_sync_read()
This patch refines the read logic in __ceph_sync_read() to ensure more predictable and efficient behavior in various edge cases. - Return early if the requested read length is zero or if the file size (`i_size`) is zero. - Initialize the index variable (`idx`) where needed and reorder some code to ensure it is always set before use. - Improve error handling by checking for negative return values earlier. - Remove redundant encrypted file checks after failures. Only attempt filesystem-level decryption if the read succeeded. - Simplify leftover calculations to correctly handle cases where the read extends beyond the end of the file or stops short. This can be hit by continuously reading a file while, on another client, we keep truncating and writing new data into it. - This resolves multiple issues caused by integer and consequent buffer overflow (`pages` array being accessed beyond `num_pages`): - https://tracker.ceph.com/issues/67524 - https://tracker.ceph.com/issues/68980 - https://tracker.ceph.com/issues/68981 Cc: stable@vger.kernel.org Fixes: 1065da21e5df ("ceph: stop copying to iter at EOF on sync reads") Reported-by: Luis Henriques (SUSE) <luis.henriques@linux.dev> Signed-off-by: Alex Markuze <amarkuze@redhat.com> Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
0 files changed, 0 insertions, 0 deletions