+67
−43
Loading
Improve completion handling of as many as 3 IOs associated with each misaligned DIO by using a atomic_t to track completion of each IO. Update nfs_local_pgio_done() to use precise atomic_t accounting for remaining iov_iter (up to 3) associated with each iocb, so that each NFS LOCALIO pgio header is only released after all IOs have completed. But also allow early return if/when a short read or write occurs. Fixes reported BUG: KASAN: slab-use-after-free in nfs_local_call_read: https://lore.kernel.org/linux-nfs/aPSvi5Yr2lGOh5Jh@dell-per750-06-vm-07.rhts.eng.pek2.redhat.com/ Reported-by:Yongcheng Yang <yoyang@redhat.com> Fixes: c817248f ("nfs/localio: add proper O_DIRECT support for READ and WRITE") Signed-off-by:
Mike Snitzer <snitzer@kernel.org> Signed-off-by:
Anna Schumaker <anna.schumaker@oracle.com>