Skip to content

Commit e6900dc

Browse files
committed
Merge fix/virtiofs-clamp-max-pages-dma/6.18 into v6.18.35
* commit '3586f43a9a33f5f12306de85b51f696194778156': fuse: virtio_fs: clamp max_pages_limit by the transport DMA mapping size
2 parents 683eee1 + 3586f43 commit e6900dc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/fuse/virtio_fs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,15 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
17031703
fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
17041704
virtqueue_size - FUSE_HEADER_OVERHEAD);
17051705

1706+
/*
1707+
* Also bound requests by the transport's maximum single DMA mapping
1708+
* size (e.g. swiotlb's 256 KiB cap) so the guest never builds a
1709+
* request whose buffer cannot be DMA-mapped.
1710+
*/
1711+
fc->max_pages_limit = min_t(unsigned int, fc->max_pages_limit,
1712+
virtio_max_dma_size(fs->vqs[VQ_REQUEST].vq->vdev)
1713+
>> PAGE_SHIFT);
1714+
17061715
fsc->s_fs_info = fm;
17071716
sb = sget_fc(fsc, virtio_fs_test_super, set_anon_super_fc);
17081717
if (fsc->s_fs_info)

0 commit comments

Comments
 (0)