Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
ion: Fix iommu rewrite additions
Browse files Browse the repository at this point in the history
These pointers weren't converted in the iommu rewrite commit, causing
undefined behavior (and out-of-bounds memory access). Fix them.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
kerneltoast authored and 0ctobot committed Feb 5, 2020
1 parent dc68f09 commit 5ffe056
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/android/ion/ion.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
struct ion_dma_buf_attachment *a = attachment->priv;
struct sg_table *table;
int count, map_attrs;
struct ion_buffer *buffer = attachment->dmabuf->priv;
struct ion_buffer *buffer = container_of(attachment->dmabuf->priv,
typeof(*buffer), iommu_data);

table = a->table;

Expand Down Expand Up @@ -276,7 +277,8 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
enum dma_data_direction direction)
{
int map_attrs;
struct ion_buffer *buffer = attachment->dmabuf->priv;
struct ion_buffer *buffer = container_of(attachment->dmabuf->priv,
typeof(*buffer), iommu_data);
struct ion_dma_buf_attachment *a = attachment->priv;

map_attrs = attachment->dma_map_attrs;
Expand Down

0 comments on commit 5ffe056

Please sign in to comment.