Skip to content

Commit fde2564

Browse files
Jason Wanggregkh
authored andcommitted
VDUSE: avoid leaking information to userspace
[ Upstream commit 9c15238 ] The bounceing is not necessarily page aligned, so current VDUSE can leak kernel information through mapping bounce pages to userspace. Allocate bounce pages with __GFP_ZERO to avoid leaking information to userspace. Fixes: 8c773d5 ("vduse: Implement an MMU-based software IOTLB") Cc: stable@vger.kernel.org Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Xie Yongji <xieyongji@bytedance.com> Reviewed-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260130050750.4050-1-jasowang@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 680a383 commit fde2564

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/vdpa/vdpa_user/iova_domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int vduse_domain_map_bounce_page(struct vduse_iova_domain *domain,
124124
if (!map->bounce_page) {
125125
head_map = &domain->bounce_maps[(iova & PAGE_MASK) >> BOUNCE_MAP_SHIFT];
126126
if (!head_map->bounce_page) {
127-
tmp_page = alloc_page(GFP_ATOMIC);
127+
tmp_page = alloc_page(GFP_ATOMIC | __GFP_ZERO);
128128
if (!tmp_page)
129129
return -ENOMEM;
130130
if (cmpxchg(&head_map->bounce_page, NULL, tmp_page))

drivers/vdpa/vdpa_user/vduse_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ static void *vduse_dev_alloc_coherent(struct device *dev, size_t size,
855855

856856
*dma_addr = DMA_MAPPING_ERROR;
857857

858-
addr = alloc_pages_exact(size, flag);
858+
addr = alloc_pages_exact(size, flag | __GFP_ZERO);
859859
if (!addr)
860860
return NULL;
861861

0 commit comments

Comments
 (0)